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
|
|---|---|---|---|---|---|
3c561c0baf2fd5372e971f2c595367adb63a0ea4
|
FIELD TESTED SERVICE ORIENTED ROBOTIC ARCHITECTURE: CASE STUDY
Lorenzo Flückiger and Hans Utz
Carnegie Mellon University, NASA Ames Research Center, Mail Stop 269-3, Moffett Field, CA-94035, USA.
{Lorenzo.Fluckiger,Hans.Utz}@nasa.gov
ABSTRACT
This paper presents the lessons learned from six years of experiments with planetary rover prototypes running the Service Oriented Robotic Architecture (SORA) developed by the Intelligent Robotics Group (IRG) at NASA Ames Research Center. SORA relies on proven software methods and technologies applied to the robotic world. Based on a Service Oriented Architecture and robust middleware, SORA extends its reach beyond the on-board robot controller and supports the full suite of software tools used during mission scenarios from ground control to remote robotic sites. SORA has been field tested in numerous scenarios of robotic lunar and planetary exploration. The results of these high fidelity experiments are illustrated through concrete examples that have shown the benefits of using SORA as well as its limitations.
Key words: Service Oriented Architecture, Space Robotics, Field Tests Experiments.
1. INTRODUCTION
Advanced software methodologies are necessary to cope efficiently with the complexity of the software powering any modern robotics system. This need is even amplified for robots designed for the exploration of uncharted environments since the tasks involved require a high level of autonomy combined with a rich set of interactions with a control team. The Intelligent Robotics Group (IRG) at the NASA Ames Research Center developed a Service Oriented Robotic Architecture (SORA) to control its exploration robot prototypes. SORA has enabled complex exploration scenarios in realistic environments to be conducted while allowing IRG’s research in human-robot exploration to smoothly evolve. This paper reports on the lessons learned from over six years of experiments with the SORA software system.
1.1. Context
Human-robot exploration of remote locations has been one of IRG’s key research topics for more than a decade.
and Service Oriented Architecture (SOA). This is however still a very young domain and despite standardization efforts such as RTC [3] and RoSta [4], the landscape of solutions is still extremely fragmented. Some approaches are focused on constructing a new type of middleware specifically for robotics like OROCOS [5] or the ROS [6], increasingly adopted in the robotic research community. Other approaches are building component frameworks using an existing middleware like [7] or [8] or are designed to be middleware independent [9].
SORA shares several characteristics common to CBAs and SOAs in robotics and adds the following specificities:
1) SORA extends well beyond the robot controller and is used across the whole mission tool suite and 2) SORA has been used extensively in high fidelity robotic mission simulations.
1.2. Experience with Exploration Robots
In [1] we have shown how SORA has supported a Lunar analog robotic field test during the summer 2007 at Haughton Crater, Devon Island (Canada). This first full deployment of SORA involved two K10 rovers performing systematic site surveys on a site above the Arctic circle [10]. Since then, SORA has been used during the summer periods of 2008 at Moses Lake (WA), 2009 at Black Point Lava Flow (AZ) [11] and 2010 at the Haughton Crater site again [12], as well as in a couple of small-scale mission experiments conducted at sites closer to the NASA Ames Research Center. These unique opportunities allowed IRG to test SORA robustness in applied scenarios involving full teams depending on the robotic resource availability (mobility and data gathering). Field experiments also put SORA services interactions (within the robot and to the ground control) in real situations with non homogeneous networks including satellite links with variable Quality of Service (QoS).
1.3. SORA as Mission Backbone
Fig. 2 illustrates a typical field test where SORA is used across the full system deployment: within rovers, by the field team supporting the robots, by the control team executing remote operations and by the science team using analysis and mission planning tools. Whenever SORA services are collocated or distributed across a network, their interactions are based on unified interfaces and are transparently optimized by the supporting middleware.
The following Section 2 describes the high level concepts of SORA. Then, using specific examples the paper highlights the benefits of the SORA in Section 3 and the shortcomings of SORA in Section 4. Finally the paper concludes with future extensions to the current research.
2. SORA CONCEPTS
It is first important to emphasis that SORA is a software architecture supporting robotic systems, and does not define a particular robot control architecture. Fig. 3 illustrates a simplified controller constructed with SORA. The details of the services internal structure, and unified services communication modes are described in [1]. The key points concept of SORA are briefly highlighted in this section, starting with the common characteristics shared by SOAs and finishing with the SORA specificities.
2.1. Essential SOA aspects of SORA
This section describes what properties make SORA a typical SOA.
2.1.1. Services
SORA services encapsulate a set of interconnected classes to offer high level functionalities to the system. Each service is self contained and is dynamically loadable. In addition, a service manages its own control-flow requirements (message loops, threads etc). A service can be passive, just waiting for events, or active with one or multiple threads of execution.
2.1.2. Interfaces
Strongly typed, network transparent interfaces, specified with the Interface Definition Language (IDL) [13], allow connecting to the services. Implementation of the interfaces in different languages allows heterogeneous systems to interact. The same control interfaces are accessed using Remote Method Invocation (RMI) for interactions between services on the robot as well as by applications running at ground control.
2.1.3. Data Distribution
In addition to RMI, SORA uses a Publish/Subscribe scheme to distribute data across services, within a single controller, and to the ground control systems. SORA initially used the CORBA Notification Service [14] to implement a publish/subscribe mechanism. This implementation still remains active while SORA transitions to the Data Distribution System (DDS) [15]. DDS is a recent standard by the Object Management Group (OMG) on the publish-subscribe paradigm. At publication, most of the rover telemetry will be also distributed using DDS.
1 The current control architecture of IRG robots is constructed as a two tiered system combined with some services acting like behaviors, thus it should be probably characterized as a mixed control architecture.
2.1.4. Middleware
SORA relies heavily on middleware, specifically the ACE/TAO implementation [16] of the CORBA [14] standard. In addition to CORBA, SORA uses the Middleware for RObots (Miro) [17]. Miro facilitates the use of CORBA in the robotics context, without introducing an extra layer of indirection, but by providing a configuration of the middleware tailored to the robotics domain. In addition to CORBA that will continue to be used for commanding, SORA relies on the RTI [18] DDS implementation for data distribution. DDS offers numerous new Quality of Service (QoS) compared to CORBA for data distribution across heterogeneous, non-reliable networks. For example, building on DDS QoS, IRG was able to conduct a field test where a 50s transmission delay was introduced.
2.2. Specific aspects of SORA
This section describes some characteristics that are unique to SORA.
2.2.1. Services Assembly
A robot controller is constructed from a set of services. These services are started according to a configuration file crafted for a particular scenario. The same configuration mechanism is used also for services not running on the robot, like simulated components. A robot controller assembled for a typical exploration scenario with autonomous navigation and a few science instruments average 45 services. These services could be grouped into three categories:
1. Hardware: an average of 14 hardware services are in charge of communication with physical sensors and actuators.
2. Software: an average of 19 software services are in charge of data processing and high level algorithms for autonomy and control.
3. Infrastructure: an average of 12 services are performing infrastructure tasks ranging from audible notifications to bandwidth management.
2.2.2. Loose coupling
Services of a SOA are not subject to the same level of coupling as the components of a CBA. SORA services need to respect some rules, like resource usage to play nice in the overall system. However, these rules are not enforced by a formalism or a compiler. In addition, the loose coupling between services allows freedom on the implementation method of each service. In contrast CBA’s can offer facilities for architecture analysis, system composition, and individual components building. IRG is considering using the CORBA Component Model (CCM) [19] in the future to gain some structured CBA benefits, however CCM was not mature enough when SORA was initiated.
2.2.3. Standard messaging between NASA robots
From its inception, SORA exposed a set of messages for data distribution within the robot and to external subscribers. Building on the expertise gained using this system during several years, a collaboration with other NASA centers started an effort to create standard messages for exploration robots across NASA. This effort led to the RAPID project [20]. RAPID defines a set of standard data structures that are shared between the robots of already three NASA centers: NASA Ames (K10s and K-REX rovers), Johnson Space Center (LER, Centaur-2 rovers) and the Jet Propulsion Laboratory (Athlete 6-legged robot). RAPID is Open-Source Software and essentially consists of a set of IDLs plus utilities classes.
Figure 3: A minimal robot controller built with only a few services. Data distribution is unified across the full deployment. Provided interfaces are transparently accessible within a robot or remotely.
These IDLs are processed to generate code supporting messages that are distributed using DDS.
2.2.4. Validation with field tests
As mentioned above, SORA was deployed in multiple field tests on various rovers. In addition to powering the K10 series rovers, SORA has also been tested on a smaller scale rover, K10-mini (footprint of 40cmx30cm), as well as the much larger new IRG rover K-Rex (footprint 2mx1.6m). Outside of IRG rovers, SORA also currently supports a navigation system based on a LIDAR for the Centaur-2 rover [21]. The range of situations encountered across these field tests is summarized in Tab. 1. SORA’s exposure to these real world situations confirms that SORA meets three key characteristics of robotic space systems: flexibility, scalability and reliability. The unified interfaces across the system, for both collocated and distributed scenarios, provide a great flexibility. Similarly, the facility to create specific robot controllers for particular scenarios by easily assembling different sets of services brings a great flexibility. Scalability is obtained by the service encapsulation, the loose coupling between services, and the interchangeability of services providing identical interfaces. Finally, insulation of each service and reliance on robust middleware promote a high level of reliability.
3. SORA BENEFITS
This section describes the benefits of SORA during the IRG robotics field tests. Each of these benefits are generated by architectural concepts and illustrated with a concrete example. Most of the advantages reported below are derived from Service Oriented Architecture specific concepts like encapsulation, communication pattern, and exposition of stable interfaces. In addition, the use of a component configurator pattern and reliance on robust middleware increases the flexibility and reliability of the system.
Figure 4: Two successive versions of the K10 controller (only few services shown).
3.1. Encapsulation
Encapsulation of robotics capabilities into services exposing well defined interfaces is effectively shielding the overall system from any code modification within services. As long as the IDLs for the interfaces and messages for data distribution remain the same, any change to the internals of a service will not affect other services. This is illustrated in Fig. 4 with the evolution of the Navigator service. The navigator service allows the rover to reach a given goal while avoiding obstacles by building a dynamic map of the environment. While ignoring the mapping services dependencies for the simplicity of the discussion, we can see that the Navigator service has strong dependency on the Locomotor service and PoseEstimator service. In addition the Navigator service is used by the Executive service. The navigator has undergone major re-structuring over the years to gain performance and obtain more flexibility. In particular the initial navigator heavily relied the Navigation classes from the CLARAty [22] framework, state of the art at the time. The current navigator replaces the previously sequential model with a newly developed,
Table 1: Range of key parameters during field tests using SORA
<table>
<thead>
<tr>
<th>Parameter</th>
<th>Minimal/Unfavorable configuration</th>
<th>Full-blown/Optimal configuration</th>
</tr>
</thead>
<tbody>
<tr>
<td>Configuration</td>
<td>1 robot + field team of 5</td>
<td>2 robots + field team of 6 + ground team of 9 + science team of 12</td>
</tr>
<tr>
<td>Local wireless network</td>
<td>10Mbps (degraded 802.11b) to no comms (robot out of range for extended periods and navigating fully autonomously)</td>
<td>50Mbps (Meshed Tropos network with 802.11n)</td>
</tr>
<tr>
<td>Link to ground</td>
<td>2Mbps (satellite link) to no comms (link loss or no ground team)</td>
<td>15Mbps (microwave link) with optional 50s delay introduced</td>
</tr>
<tr>
<td>Number of services on the robot</td>
<td>Simple navigation: 12 [Hardware (HW)=2, Software (SW)=6, IN (Infrastructure)=4]</td>
<td>Autonomous navigation and science instruments: 55 [HW=19, SW=22, IN=14]</td>
</tr>
<tr>
<td>Distributed services (not on the robot)</td>
<td>1-2 (“mission manager” to start an autonomous plan and monitor robot health)</td>
<td>> 5 multiple control panels and 3D visualization plus data collection system</td>
</tr>
<tr>
<td>Data collected on the robot</td>
<td>80MB/h (no science and exclude stereo images)</td>
<td>1GB/h (LIDAR data + stereo images included)</td>
</tr>
</tbody>
</table>
concurrent framework: sensor reading, map building and action selection are asynchronous and the robot drives continuously. New terrain analysis and path evaluation algorithms were incorporated into the navigation system. This extensive development effort has been transparent to the many users of the navigator interface.
3.2. Communication Patterns
SORA services are interconnected with a dual communication pattern: RMI and Data Publish/Subscribe. These two modes are complementary. RMI is especially convenient for commanding individual services and querying their state while the Publish/Subscribe mechanism is better suited for distributing data to multiple services. Even though it is possible to implement a request/reply pattern using a data distribution model, the stricter RMI approach enables greater static checking and code generation. Thus RMI makes the implementation of transaction-oriented interfaces, such as robot commanding, more efficient and less error prone. In addition to the regular RMI concept, SORA uses the Asynchronous Method Invocation (AMI) [23] pattern which augments the service decoupling and simplifies services implementation. For example, a service can take minutes to complete an operation; however, it can be impractical for the caller of this operation to block its thread of execution while waiting for completion. Using AMI, the call will immediately return and the caller will be notified by a callback when the completion actually occurred. All the complexity of AMI, thread safety, and exception handling is handled by the middleware.
Despite the advantages of RMI and AMI, data distribution is preferable when multiple consumers are interested in the same type of data or when data needs to be transmitted periodically. In addition, the Publish/Subscribe mechanism decouples the services further as producers of data are totally unaware of the consumers. SORA contains a key service exploiting fully the Publish/Subscribe mechanism: the data logger. This service is a generic data consumer, that can subscribe to any message type and serialize it to file, including a trace of the request/reply pairs of commands. With the Miro LogPlayer tool, the log files created can be replayed at one’s convenience to analyze a particular situation. The LogPlayer also permits data to be fed back to the data-bus, where it can be consumed in the same manner as the original data.
3.3. Stable Interfaces
All SORA interfaces (allowing remote method invocation), and all data structures (participating in the publish/subscribe mechanism) are defined with the IDL language. Each IDL specification is carefully designed to be as generic as possible while allowing access to specific capabilities of the sub-system. These interfaces and data structures have certainly evolved from the initial SORA conception to today’s system. However, changes are mostly extensions of existing interfaces or addition of new data structures to address a new domain. Keeping these interfaces stable and their specification in a unique repository (shared by all the parties contributing to software for robotic field tests) permits to easily swap a service for an equivalent one and enables to maintain all the tools around the robot controller up to date.
An example of this evolution is shown in Fig. 4. A new version of the PoseEstimator has been written for the second HMP field test. The PoseEstimator computes the best estimate of the rover position and orientation using a Kalman Filter to process various sensor inputs (not all included in this figure). The second version of the PoseEstimator relies on an additional sensor, and computes poses using a new algorithm. Thanks to the SORA architecture, the previously existing sensor data is consumed the same way and the services depending on the PoseEstimator did not have to be modified at all.
CORBA interfaces support inheritance. SORA uses this feature extensively to define the services interfaces. In addition SORA extend this polymorphism to the imple-
The need to be activated/deactivated, or when to acquire a scientist. A plan contains instructions when instruments need to be controlled and access any instrument in a transparent manner at a high level. This is particularly the case for the specific methods to access its functionalities. However, all the interfaces to the services encapsulating science inherit from the same base interface. This allows a range of services to control and access any instrument in a transparent manner. The abstract interfaces in combination with the easy reconfigurability of the controller is also used to replace some (or all) services of the controller for the physical robot with simulated components. The Locomotion service on Fig. 3 is responsible for translating high level locomotion commands (translate, drive arc) to individual motor commands regarding the rover kinematics and actuation capabilities. These low level commands are passed to the WheelGroup service that abstracts the actual robot hardware. A simulated WheelGroupSim service which simulates the robot wheels motion has been developed. It can simply be started in place of the original service to obtain a simulation of the rover motion. Applications like the 3D visualization tool which is used to monitor the rover progress, do not need to be modified at all and it is a matter of switching configuration files to start a real rover controller or a simulated rover controller.
3.4. Component Configurator Pattern
SORA uses the “Component Configurator” pattern [24] to combine the services in a full system. A configuration file specifies which services should be started to create a particular controller. Despite the fact that these controller configuration files are currently crafted manually, they have been a tremendous tool to develop and test our robotic software. Configurations are created for each individual scenario. Scenarios are ranging from a minimal controller containing only the locomotion service to a full blown field test controller requiring a suite of science instruments, passing by controllers containing simulated components. In addition to facilitate developers task, the simplicity and rapidity of creating a new controller configuration also allows tuning controllers regarding resource usage or memory footprint. The flexibility and robustness of the SORA services assembled with the component configurator pattern can be measured by the number of services (range 30 to 50) running in concert on a robot, while sharing the resources harmoniously.
3.5. Robust Middleware
The architectural paradigms implemented in SORA would not have achieved such a reliable and extensive set of features without adopting a robust middleware. As mentioned in the Section 2, SORA heavily relies on CORBA coupled Miro, and increasingly on DDS. These dependencies obviously are imposing some constraints due to the choice of a specific middleware (see Section 4 for the drawbacks). Middleware is pervasive, so replacing any middleware for another one would require substantial code changes. However, this commitment to a set of well-established libraries enables rapid progress with a finite (and usually limited) amount of resources. The ACE/TAO CORBA implementation went through several release cycles, so about once a year SORA updates to use the latest revision. Each new revision of ACE/TAO resolves some issues and brings new improvements. SORA directly benefited from these new versions representing a considerable amount of work from outside parties. At the same time, CORBA being a standard, new revisions of the implementation only require minor changes on the user side. The same stability argument can be made for Miro. The few changes in the Miro source code over the years is a praise to its reliability and SORA has been very well supported by Miro’s initial set of features.
Finally, appropriate usage of middleware frees the developers of the robotic software from issues or changes of the lower layers. For example, as shown in Fig. 2, the Field Site and Ground Operations are connected using an unreliable satellite link. To cope with lower and intermittent data rates, the robot telemetry is transferred using a specific method developed as part of Miro. However, this extension of the data distribution method is completely transparent to the services running either on the Field Site or Ground Operations. The exact same applications are running on each site, not cognizant if the connection is supported by a direct optical fiber link (situation for the local test site at NASA Ames) or by a satellite link.
4. SORA SHORTCOMINGS
The long-term use, continuous development and intensive field testing of SORA provided a good stress-test uncovering weaknesses in the design and implementation choices as well as the deployed software technologies of the SORA architecture. In this section we want to discuss some of those: scalability of the publish/subscribe mechanism, re-use of data structures, synchronization of services and middleware acceptance by external parties.
4.1. Publish/Subscribe Scalability
The CORBA Notification service is designed as a central monolithic data-relay. This obviously makes it a
single-point of failure and is not scalable to complex distributed applications. Also, the QoS options do not support bandwidth-management very well, which is a major scalability concern in heterogeneous networks. Furthermore the Notification service has other shortcomings, such as a very inefficient transfer of type-code information, that are of concern especially on low-bandwidth network-links. We overcame these problems by deploying a customized extension that allows to create a federation of notification service instances exchanging events between instances on a separate data-channel [25]. We also added a time-based filter, implementing message-frequency limits between nodes of the federation.
While this system provides a solution for our specific requirements it is obviously not a generalized system aimed at addressing all design deficiencies of the Notification service. SORA transition to DDS allows to overcome these limitations regarding data distribution. DDS extensive QoS capabilities permits its deployment in very difficult network environments. Furthermore it supports different modes of data-dissemination that allow implementation of a wider set of communication patterns over a data-bus. On the down-side, adding a second middleware package neither helps the footprint nor the complexity of the software architecture.
4.2. Rigidity of Data Structures
The publish-subscribe model of data-distribution is central to many SORA like distributed systems. Unfortunately this model violates some of the abstraction concepts of the object-oriented paradigm. The data-structures used for distributing information through the system become the public interface to write applications against. This is a necessary caveat in a data-centric distributed applications such as robotics, but can affect maintainability and code re-use.
In addition, the data-distribution systems used by SORA do not efficiently support type-polymorphism. A data-bus supporting single-inheritance in the disseminated data-structures would allow generic data-consumers subscribing to a generalized concept (i.e. position), to ignore the specific sensor information (i.e. additional GPS data fields). However, the CORBA Notification service as well as DDS only allow retrieval of the payload-type of an event that was put in on the publisher side.
In consequence, SORA data producers (like a pose sensor) are less interchangeable than if type-polymorphism was available. In a similar way, code re-use is limited when writing data consumers since they cannot share a common high level data type. Finally, this limitation also affects the maintainability of data collected during field tests. The logged data is used extensively after the field tests for analysis and development purpose. So any extension of previously defined data-types requires additional effort to convert the logged data to match the new type-signatures.
4.3. Synchronization of Services
In a loosely coupled architecture tight synchronization of services is generally not envisioned. This is generally true for most of our services, too. Triggering activity in one service on an event emitted by another service is straightforward, but other synchronization primitives do not exist.
This becomes more of an issue, with simulation, when single-stepping and faster-than-real-time execution become of interest. Synchronization of the systems real-time clock is usually provided by network services. But a uniform, synchronized time-step is difficult to provide efficiently in a large-scale distributed system and generally not provided by any middleware or object model infrastructure.
4.4. Middleware Acceptance
Objective criteria generally state a clear benefit of middleware over ad-hoc solutions for distributed systems development. Nevertheless, the acceptance of middleware, especially of CORBA is often an issue. The major issues reported usually are footprint and complexity.
Both those arguments are only partially true. Middleware packages usually have similar foot-print as other frameworks and libraries that are regularly used in the development of large-scale systems (GUI toolkits, databases, JIT-compiler etc.). It is difficult to over-come established misconceptions regarding the complexity and performance of middleware. In our experience, the complexity of middleware can be managed by a small number of domain experts, though. The other developers then do not have to be concerned about the details of the distributedness of their applications.
One factor which stays true is, that most middleware packages (especially open-source packages like ACE/TAO) are not trivial to install and to integrate into the build-process. ACE/TAO now provides packages for most Linux distributions, but an installer for Windows is still missing. Also, the poor readability of the generated code also makes it difficult for the non-domain expert to directly look up the method signatures in the code generated by the IDL-compiler.
5. CONCLUSION AND FUTURE WORK
This paper describes the Service Oriented Robotic Architecture (SORA) design concepts, the benefits brought by this approach and the difficulties encountered. SORA has been deployed to multiple high fidelity mission simulations of remote rovers controlled from ground operations. These experiments have demonstrated the advantages of SORA in term of flexibility, scalability and re-
liability. At the same time, these experiments helped to identify SORA limitations in those areas.
Future work on SORA includes refining some of the SOA concepts, fully replacing the CORBA publish/subscribe mechanism with the DDS standard, and continuing to standardize the robotic interfaces with other NASA centers. In addition, the SORA source code has been cleared for release under the NASA Open Source Agreement licensing and thus will be available to a larger community for evaluation and contributions.
The advantages of SORA extend beyond the domain of the robot controller architecture. SORA is the backbone supporting IRG field test scenarios by connecting the various robotic mission tools with a powerful distributed system infrastructure. The SORA design and implementation has enabled a full eco-system of robotic capabilities, and will continue to smoothly support their evolution in the future.
ACKNOWLEDGMENTS
This work was supported by the NASA Exploration Technology Development Program and the NASA Enabling Technology Development and Demonstration Program. The authors would like to thank all the individuals who contributed to SORA: Mark B. Allan, Xavier Bouyssounouse, Matthew Deans, Susan Lee, Mike Lundy, Eric Park, Liam Pedersen and Vinh To.
REFERENCES
|
{"Source-Url": "https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20120016368.pdf", "len_cl100k_base": 6054, "olmocr-version": "0.1.53", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 23418, "total-output-tokens": 7632, "length": "2e12", "weborganizer": {"__label__adult": 0.0004515647888183594, "__label__art_design": 0.0005054473876953125, "__label__crime_law": 0.0004646778106689453, "__label__education_jobs": 0.0005469322204589844, "__label__entertainment": 0.00010830163955688477, "__label__fashion_beauty": 0.00021898746490478516, "__label__finance_business": 0.0003306865692138672, "__label__food_dining": 0.0004305839538574219, "__label__games": 0.0008168220520019531, "__label__hardware": 0.0037784576416015625, "__label__health": 0.0006756782531738281, "__label__history": 0.0006003379821777344, "__label__home_hobbies": 0.00014507770538330078, "__label__industrial": 0.0013713836669921875, "__label__literature": 0.0002779960632324219, "__label__politics": 0.0004417896270751953, "__label__religion": 0.0005636215209960938, "__label__science_tech": 0.270263671875, "__label__social_life": 9.226799011230467e-05, "__label__software": 0.013671875, "__label__software_dev": 0.701171875, "__label__sports_fitness": 0.000583648681640625, "__label__transportation": 0.0021076202392578125, "__label__travel": 0.00033402442932128906}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 34476, 0.03673]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 34476, 0.43512]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 34476, 0.89184]], "google_gemma-3-12b-it_contains_pii": [[0, 2096, false], [2096, 6927, null], [6927, 10134, null], [10134, 13461, null], [13461, 18792, null], [18792, 24007, null], [24007, 29428, null], [29428, 34476, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2096, true], [2096, 6927, null], [6927, 10134, null], [10134, 13461, null], [13461, 18792, null], [18792, 24007, null], [24007, 29428, null], [29428, 34476, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 34476, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 34476, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 34476, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 34476, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 34476, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 34476, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 34476, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 34476, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 34476, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 34476, null]], "pdf_page_numbers": [[0, 2096, 1], [2096, 6927, 2], [6927, 10134, 3], [10134, 13461, 4], [13461, 18792, 5], [18792, 24007, 6], [24007, 29428, 7], [29428, 34476, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 34476, 0.064]]}
|
olmocr_science_pdfs
|
2024-12-08
|
2024-12-08
|
893786a519b72f4d64044bd86c1f0d899b8b2b3b
|
Instructions
- This exam contains 12 pages, including this cover page and a blank sheet at the end. Show scratch work for partial credit, but put your final answers in the boxes and blanks provided.
- Write your student ID number at the top of every page. This helps us reassemble your exam when the pages are inevitably separated.
- The exam is closed book (no laptops, tablets, wearable devices, or calculators). You are allowed two pages (US letter, double-sided) of handwritten notes.
- Please silence and put away all cell phones and other mobile or noise-making devices.
- You have 110 minutes to complete this exam.
Advice
- Read questions carefully before starting. Skip questions that are taking a long time.
- Read all questions first and start where you feel the most confident.
- Breathe. You’ve got this. You belong here.
<table>
<thead>
<tr>
<th>Question</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>Total</th>
</tr>
</thead>
<tbody>
<tr>
<td>Possible Points</td>
<td>12</td>
<td>16</td>
<td>14</td>
<td>24</td>
<td>3</td>
<td>6</td>
<td>15</td>
<td>10</td>
<td>1</td>
<td>101</td>
</tr>
</tbody>
</table>
Question 1:
[12 pts] Recall that the `read()` syscall has the following signature:
```c
ssize_t read(int fd, void *buf, size_t count);
```
and furthermore may set the global variable `errno` to values such as `EINTR` (the read was interrupted) or `EBADF` (the passed-in file descriptor was bad).
You are trying to read the entire contents of a file by invoking `read()` in a loop. Draw the flow chart for your loop.
```
read()
<table>
<thead>
<tr>
<th></th>
<th>Returns <0</th>
<th>Returns 0</th>
<th>Returns >0</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>errno == EINTR</code></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>errno != EINTR</code></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>Error; exit loop</td>
<td>Success; exit loop</td>
<td></td>
</tr>
</tbody>
</table>
```
Question 2:
[16 pts] Below, we list several items. Check the box if it has space reserved within a process’s virtual memory; if it does exist and a process may have more than one instance of it in its memory, also check the second box.
<table>
<thead>
<tr>
<th>Item</th>
<th>Exists</th>
<th>More than One</th>
</tr>
</thead>
<tbody>
<tr>
<td>🦄 Unicorns 🦄</td>
<td>😜 😸</td>
<td>🎈 I wish!</td>
</tr>
<tr>
<td>Program counter / Instruction pointer</td>
<td>X</td>
<td>X</td>
</tr>
<tr>
<td>Recursion</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Heap</td>
<td>X</td>
<td></td>
</tr>
<tr>
<td>Stack</td>
<td>X</td>
<td>X</td>
</tr>
<tr>
<td>Stack pointer</td>
<td>X</td>
<td>X</td>
</tr>
<tr>
<td>Static data segments (eg, .data, .text)</td>
<td>X</td>
<td></td>
</tr>
<tr>
<td>Current value of general-purpose registers (eg, eax, ebx, ecx)</td>
<td>X</td>
<td>X</td>
</tr>
</tbody>
</table>
Question 3:
We’ve created a SmartMutex class that locks an (externally-instantiated) pthread_mutex_t and unlocks it when the instance goes out of scope. A client might write the following example code to use our class; assume all relevant headers have been #include’d.
```c
char *g_buffer; // protected by g_lock
pthread_mutex_t g_lock; // protects g_buffer
void InitializeBuffer(int64_t length, char init) {
SmartMutex m(&g_lock); // implicitly locks g_lock
if (g_buffer != nullptr || length <= 0) { return; }
g_buffer = new char[length]; // 'new' may throw an exception
for (int i = 0; i < length; ++i) {
g_buffer[i] = init;
}
}
```
(A) [4 pts] Why might this SmartMutex class be useful?
Even though it’s quite simple, the example code still has 3 exit points. As it grows in complexity, the likelihood of forgetting to unlock g_lock will also grow. Using RAII to manage the lock will ensure it’s unlocked regardless of how we exit the function.
(B) [6 pts] Based on our example code above, define and implement the SmartMutex class.
```c
class SmartMutex {
public:
SmartMutex(pthread_mutex_t *m) : m_(m) {
pthread_mutex_lock(m_);
}
~SmartMutex() { pthread_mutex_unlock(m_); }
private:
pthread_mutex_t *m_;
};
```
(C) [1 pt] Our client noticed they didn’t unlock g_lock when they exited InitializeBuffer() and has asked us to add an explicit Unlock() method to SmartMutex. Is this method necessary in their example code?
- □ Yes, necessary x No, unnecessary
(D) [3 pts] If this method is necessary, enumerate all the places where the client needs to call Unlock() in their sample code. If this method is not necessary, please explain your reasoning.
They do not need to manually unlock g_lock because it is automatically unlocked when the Mutex m stack variable goes out of scope.
Question 4:
Examine the following classes. Assume all relevant #include and using statements have been made.
class Window {
public:
virtual void DrawString(const string &s) { /* ... */ }
virtual void Add(Widget *w) {
// Take ownership of the argument, then set their owner pointer to us.
ownedWidgets_.push_back(shared_ptr<Widget>(w));
w->SetOwner(this);
}
private:
vector<shared_ptr<Widget>> ownedWidgets_;}
class Widget {
public:
virtual void Draw(Window *w) { /* nothing to do */ }
void SetOwner(Window *w) { owner_.reset(w); }
private:
shared_ptr<Window> owner_;}
class Box : public Widget {
public:
Box(int w, int h) : w_(w), h_(h) { }
virtual void Draw(Window *w) { /* nothing to do; boxes are invisible */ }
int Area() { return w_ * h_; }
protected:
int w_, h_;}
class TextBox : public Box {
public:
TextBox(const string &msg, int w, int h) : Box(w, h), msg_(msg) { }
virtual void Draw(Window *w) { w->DrawString(msg_); }
private:
string msg_;}
class MultilineTextBox : public Box {
public:
MultilineTextBox(const vector<string> &msgs, int w, int h) : Box(w, h), msgs_(msgs) { }
virtual void Draw(Window *w) {
for (const auto &m : msgs_) { w->DrawString(m); }
}
int Area() { return w_ * h_ * msgs_.size(); }
private:
vector<string> msgs_;}
(A) [5 pts] Draw a diagram of the inheritance relationship between these classes (ie, the “inheritance hierarchy”). You do not need to add the methods; just the class names.
(B) [7 pts] Suppose we define the following variables:
```cpp
Box *b = new Box(1, 1);
TextBox *t = new TextBox("hello winter break", 10, 20);
MultilineTextBox *m = new MultilineTextBox({"bye", "autumn", "quarter"}, 20, 20);
Widget *w_b = b;
Widget *w_t = t;
Box *b_m = m;
Window *win; // used for Draw() calls, below. You can assume it’s initialized
```
Which class’s method is invoked by each of the following calls? If the call would not compile, please write “Compiler Error” instead.
<table>
<thead>
<tr>
<th>Method Call</th>
<th>Invoked Method’s Class</th>
</tr>
</thead>
<tbody>
<tr>
<td>t->Draw(win)</td>
<td>TextBox</td>
</tr>
<tr>
<td>w_b->Draw(win);</td>
<td>Box</td>
</tr>
<tr>
<td>w_t->Draw(win);</td>
<td>TextBox</td>
</tr>
<tr>
<td>(*t).Draw(win);</td>
<td>TextBox</td>
</tr>
<tr>
<td>(*w_t).Draw(win);</td>
<td>Widget</td>
</tr>
<tr>
<td>(*w_b)->Area();</td>
<td>Compiler Error; Widget does not have an Area() method</td>
</tr>
<tr>
<td>b_m->Area();</td>
<td>Box</td>
</tr>
<tr>
<td>m->Area();</td>
<td>MultilineTextBox</td>
</tr>
</tbody>
</table>
(C) [6 pts] Using the same variables from part (B), fill in the blank with the C++-style cast that would cause the statement to compile. If the statement compiles without a cast, check the “Unnecessary” box. Recall that you may choose from `static_cast<>`, `dynamic_cast<>`, `const_cast<>`, and `reinterpret_cast<>`.
<table>
<thead>
<tr>
<th>Code</th>
<th>Unnecessary</th>
</tr>
</thead>
<tbody>
<tr>
<td>( w_b = ) (b);</td>
<td></td>
</tr>
<tr>
<td>( b = ) dynamic_cast<Box*>(w_b);</td>
<td>( x )</td>
</tr>
<tr>
<td>double ( x = 3.14159 );</td>
<td></td>
</tr>
<tr>
<td>int ( pi = ) static_cast<int>(x);</td>
<td></td>
</tr>
<tr>
<td>( t = ) reinterpret_cast<TextBox*>(1234);</td>
<td></td>
</tr>
<tr>
<td>const Window *( cp = ) (win);</td>
<td>( x )</td>
</tr>
<tr>
<td>( \text{const Window} ) ( \text{cw} = ) ( ) (( \text{win} ));</td>
<td></td>
</tr>
<tr>
<td>( \text{const Window} ) ( \text{cw} = ) ( ) (( \text{&cw} ));</td>
<td></td>
</tr>
</tbody>
</table>
Note: the final exam, as given, had a typo which made the question harder than intended. I’ve preserved the exam version as “D.i” because of its educational value. The question, as intended, is presented as “D.ii”.
(D.i) [6 pts] Does this code snippet have any memory allocation errors?
```cpp
Box *b = new Box(1, 1);
TextBox *t = new TextBox(10, 20);
MultilineTextBox *m = new MultilineTextBox(20, 20);
Window win; // takes ownership of widgets added to it
win.Add(b);
win.Add(t);
win.Add(m);
```
- □ No errors
- ★ Memory leak (fix described below)
- ★ Double delete (fix described below)
Because the Window is stack-allocated, it is destroyed at the end of this snippet. This drops the Widgets’ refcount to 0, so they are also destroyed. However, when their destructors are called, the refcount for Window also drops to 0 so it is destroyed a second time. To fix this, we should allocate Window on the heap, which triggers the memory leak described in D.ii
(D.ii) [6 pts] Does this code snippet have any memory allocation errors?
```cpp
Box *b = new Box(1, 1);
TextBox *t = new TextBox(10, 20);
MultilineTextBox *m = new MultilineTextBox(20, 20);
shared_ptr<Window> win(new Window); // takes ownership of widgets added to it
win->Add(b);
win->Add(t);
win->Add(m);
```
- □ No errors
- ★ Memory leak (fix described below)
- ★ Double delete (fix described below)
There is a shared_ptr cycle between Window and the various Widgets. As discussed in lecture, we can break this cycle by changing the type of Widget’s owner_pointer to weak_ptr (we also accepted a raw pointer as a valid response).
Question 5:
[3 pts] Let’s map the latency of common computer operations to the human-scale operations required for studying for the 333 final. You may use the following:
A. Reading a sticky note on your monitor (0.5 secs)
B. Finding the right page/paragraph in the textbook kept next to your monitor (2 mins)
C. Asking on Piazza (36 mins)
D. Texting another 333 student for the answer (1 hour)
E. Requesting a scanned article from UW Libraries (2 days)
F. Buying the physical textbook \textit{without Amazon Prime} (1 week)
G. Re-taking CSE 351 and then re-taking CSE 333 (20 weeks)
H. Buying the physical textbook \textit{currently on Jupiter} (6 years)
I. Buying the physical textbook \textit{currently in the Alpha Centauri system} (78,000 years)
<table>
<thead>
<tr>
<th>Computer Operation</th>
<th>Human Analogue</th>
</tr>
</thead>
<tbody>
<tr>
<td>L1 cache reference</td>
<td>A</td>
</tr>
<tr>
<td>Main memory reference</td>
<td>B</td>
</tr>
<tr>
<td>Packet round trip within same datacenter</td>
<td>F</td>
</tr>
<tr>
<td>Disk seek</td>
<td>G</td>
</tr>
<tr>
<td>Packet round trip across a submarine cable</td>
<td>H</td>
</tr>
</tbody>
</table>
Question 6:
Consider the following code. Assume all relevant \#include statements have been made.
```
struct Coordinate {
int x, y;
};
void Modify(Coordinate &c) {
c.y = c.y + 10;
}
int main(int argc, char *argv[]) {
Coordinate arr[] = { {0, 10}, {1, 11}, {2, 12}, {3, 13} };
Coordinate *p = &arr[0];
Coordinate c0 = *p;
c0.x = 10;
Modify(c0);
Modify(*p);
Coordinate &c1 = arr[0];
Modify(c1);
Coordinate *c2 = arr + 3;
Modify(*c2);
// ** HERE **
return EXIT_SUCCESS;
}
```
[6 pts] Draw a memory diagram showing the state of the program when we exit (ie, at “*** HERE ***”).
Stack
Heap
- `arr`:
- `{0, 30}`
- `{1, 11}`
- `{2, 12}`
- `{3, 23}`
- `p`:
- `c0`:
- `{10, 20}`
- `c1`
- `c2`
Question 7:
(A) [7 pts] Recall that the 7 steps of server-side network programming are:
1. Get local IP address and port
2. Create socket
3. Bind socket to local IP address and port
4. Listen on socket
5. Accept connection from client
6. Read and write data on that connection
7. Close socket
The `HttpServer::Run()` method from HW4 implements the “server read/write loop”; a simplified version of it is below. Note that `SocketServer`’s methods have been renamed to make this question harder (sorry!).
In the right column, write the step number alongside the line in which it occurs. Note that every step occurs in a helper function, so a single line may have multiple step numbers.
```cpp
void HttpServer::Run() {
SocketServer ss;
int listen_fd;
if (!ss.Method1(AF_INET6, &listen_fd)) {
return;
}
ThreadPool tp(kNumThreads);
while (1) {
HttpServerTask *hst = new HttpServerTask(
&HttpServer_ThrFn);
InitializeHST(hst);
ss.Method2(&hst->client_fd,
&hst->caddr,
&hst->cport,
&hst->cdns,
&hst->saddr,
&hst->sdns);
tp.Dispatch(hst); // Dispatch() invokes the
// function whose pointer was
// passed to hst’s constructor
}
}
```
```cpp
void HttpServer_ThrFn(HttpServerTask *hst) {
HttpConnection conn(hst->client_fd);
while (1) {
HttpRequest req = conn.GetNextRequest();
HttpResponse resp = ProcessRequest(req,
hst->basedir, hst->indices);
conn.WriteResponse(resp);
if (req.GetHeaderValue("connection") == "close") {
break;
}
}
}
```
For reference only.
Do not mark in this box.
(B) [4 pts] Oftentimes, when maintaining a server you want to answer questions such as “how many requests has it served?” or “what percentage of those requests are HTTP2?”. A common solution for these questions involve adding global statistics to your server. You reimplemnet `HttpServer_ThrFn()` as follows:
```c
int g_request_count = 0;
int g_http2_request_count = 0;
void HttpServer_ThrFn(HttpServerTask *hst) {
HttpConnection conn(hst->client_fd);
while (1) {
HttpRequest req = conn.GetNextRequest();
g_request_count++;
if (req.isHttp2()) {
g_http2_request_count++;
}
HttpResponse resp = ProcessRequest(req,
hst->basedir, hst->indices);
conn.WriteResponse(resp);
if (req.GetHeaderValue("connection") == "close") {
break;
}
}
}
```
Does this code demonstrate a data race?
- [ ] No race (reason below)
- [x] Yes, there is a race (fix described below)
`HttpServer_ThrFn` is called by multiple threads concurrently. Therefore, we need to ensure access to our two global variables is synchronized. It is simplest to lock both of them with the same lock (though we accepted answers with two independent locks).
(C) [2 pts] Assume your server’s threadpool has 3 threads and it has processed 100 HTTP requests.
- If you answered “no race” in part (B), what is the value of `g_request_count` as viewed from the “main thread”?
- If you answered “yes, there is a race”, what set of values might `g_request_count` have, as viewed from the “main thread”? Assume the bug has not been fixed yet.
[1, 100]
(D) [2 pts] HW4 used threads to implement concurrency. If, instead, we had run \texttt{HttpServer\_ThrFn()} in forked processes (using the double-fork trick), what would be the value or set of values for \texttt{g\_request\_count} as viewed from the “main process”? Justify your answer.
| 0. \texttt{g\_request\_count} is incremented by the forked process, which has its own virtual memory and therefore its own copy of \texttt{g\_request\_count}. The main process would never see the incremented value. |
Question 8:
(A) [2 pts] Recall that each layer in the OSI network model (e.g., physical, data link, network) has its own packet format, consisting of a packet header and a packet body. How is each layer’s packet represented in the next layer down? For example, how is an IP packet (data link) represented as an ethernet packet (physical)?
| Each packet’s header and body is stored in the body of the layer below. |
(B) [8 pts] Are each of the following statements true or false?
<table>
<thead>
<tr>
<th>Statement</th>
<th>True / False</th>
</tr>
</thead>
<tbody>
<tr>
<td>DNS is a network-level protocol</td>
<td>True / False</td>
</tr>
<tr>
<td>SSH is an application-level protocol</td>
<td>True / False</td>
</tr>
<tr>
<td>TCP is a client/server protocol (one server to one client)</td>
<td>True / False</td>
</tr>
<tr>
<td>If a TCP packet needs to be split across multiple IP packets, it will add a sequence number to each IP packet to detect their intended ordering and to detect if any IP packets were lost</td>
<td>True / False</td>
</tr>
<tr>
<td>If a host detects that an IP packet was lost, it will re-request the entire TCP packet.</td>
<td>True / False</td>
</tr>
<tr>
<td>UDP is a client/server protocol (one server to one client)</td>
<td>True / False</td>
</tr>
<tr>
<td>UDP is a good transport protocol for HTTP</td>
<td>True / False</td>
</tr>
<tr>
<td>HTTP headers can contain arbitrary key/value pairs</td>
<td>True / False</td>
</tr>
</tbody>
</table>
Question 9:
[1 pt; all non-empty answers receive this point] Draw or describe a friend for your unicorn, below.
| Thanks for a great quarter! Have a wonderful winter break and come say “hi” in the new year! |
😊 🦄
|
{"Source-Url": "https://courses.cs.washington.edu/courses/cse333/exams/cse333-19au-final-sol.pdf", "len_cl100k_base": 4931, "olmocr-version": "0.1.53", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 31199, "total-output-tokens": 5114, "length": "2e12", "weborganizer": {"__label__adult": 0.0007476806640625, "__label__art_design": 0.0006442070007324219, "__label__crime_law": 0.0005521774291992188, "__label__education_jobs": 0.019805908203125, "__label__entertainment": 0.0001577138900756836, "__label__fashion_beauty": 0.0003349781036376953, "__label__finance_business": 0.000232696533203125, "__label__food_dining": 0.0010061264038085938, "__label__games": 0.001934051513671875, "__label__hardware": 0.0023670196533203125, "__label__health": 0.0006618499755859375, "__label__history": 0.0004794597625732422, "__label__home_hobbies": 0.00040602684020996094, "__label__industrial": 0.0006933212280273438, "__label__literature": 0.0006399154663085938, "__label__politics": 0.0003402233123779297, "__label__religion": 0.0008530616760253906, "__label__science_tech": 0.01031494140625, "__label__social_life": 0.0004189014434814453, "__label__software": 0.005725860595703125, "__label__software_dev": 0.94873046875, "__label__sports_fitness": 0.0007672309875488281, "__label__transportation": 0.0015506744384765625, "__label__travel": 0.00045943260192871094}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 17092, 0.02145]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 17092, 0.40571]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 17092, 0.81449]], "google_gemma-3-12b-it_contains_pii": [[0, 1021, false], [1021, 2700, null], [2700, 4548, null], [4548, 5909, null], [5909, 7397, null], [7397, 8285, null], [8285, 9885, null], [9885, 11458, null], [11458, 11684, null], [11684, 13476, null], [13476, 15122, null], [15122, 17092, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1021, true], [1021, 2700, null], [2700, 4548, null], [4548, 5909, null], [5909, 7397, null], [7397, 8285, null], [8285, 9885, null], [9885, 11458, null], [11458, 11684, null], [11684, 13476, null], [13476, 15122, null], [15122, 17092, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 17092, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 17092, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 17092, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 17092, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 17092, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 17092, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 17092, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 17092, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 17092, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 17092, null]], "pdf_page_numbers": [[0, 1021, 1], [1021, 2700, 2], [2700, 4548, 3], [4548, 5909, 4], [5909, 7397, 5], [7397, 8285, 6], [8285, 9885, 7], [9885, 11458, 8], [11458, 11684, 9], [11684, 13476, 10], [13476, 15122, 11], [15122, 17092, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 17092, 0.17629]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
45c43bde4696ff1aec05e5069a226d04ea8f34df
|
4. Types and Polymorphism
Oscar Nierstrasz
Roadmap
- Static and Dynamic Types
- Type Completeness
- Types in Haskell
- Monomorphic and Polymorphic types
- Hindley-Milner Type Inference
- Overloading
References
Roadmap
- Static and Dynamic Types
- Type Completeness
- Types in Haskell
- Monomorphic and Polymorphic types
- Hindley-Milner Type Inference
- Overloading
What is a Type?
**Type errors:**
```
? 5 + [ ]
ERROR: Type error in application
*** expression : 5 + [ ]
*** term : 5
*** type : Int
*** does not match : [a]
```
**A type is a set of values?**
> `int = { ... -2, -1, 0, 1, 2, 3, ... }`
> `bool = { True, False }`
> `Point = { [x=0,y=0], [x=1,y=0], [x=0,y=1] ... }`
The notion of a type as a set of values is very natural and intuitive: Integers are a set of values; the Java type JButton corresponds to all possible instance of the JButton class (or any of its possible subclasses).
What is a Type?
A type is a partial specification of behaviour?
> n,m:int ⇒ n+m is valid, but not(n) is an error
> n:int ⇒ n := 1 is valid, but n := “hello world” is an error
What kinds of specifications are interesting? Useful?
A Java interface is a simple example of a partial specification of behaviour. Any object that conforms to a given interface can be used where that interface is expected. This is arguably more useful than the notion of a type as a set of values, because we may not care about the specific internal representation of an object but just what it can do for us.
**Static and Dynamic Types**
*Values* have **static types** defined by the programming language. A variable may have a declared, static type.
*Variables and expressions* have **dynamic types** determined by the values they assume at run time.
```java
Applet myApplet = new GameApplet();
```
Declared, static type is `Applet`
Static type of value is `GameApplet`
Actual dynamic type is `GameApplet`
The terms “static” and “dynamic” can be very confusing, especially given their use as keywords in languages like C++ and Java.
“Static” simply means: “based on program text alone.” Static typing (for example) means types are checked based on the source code, not by executing the program. Static analysis more generally means “analysis based on source code alone.”
“Dynamic” means: “determined at run time.” So, dynamic analysis means “analysis based on run-time behaviour.”
Aside: “run time” (noun) = execution time; “run-time” (adjective) = something happening at run time; “runtime” (noun) = run-time language support, e.g., in the virtual machine.
Static types restrict the programs you may write!
Object wyatt = new Cowboy();
wyatt.draw();
A static type system (typically) forbids you from running programs that the type system cannot validate.
This Java code will not run without the explicit downcast (int), even though the downcast does nothing.
```java
List<Object> myList = new ArrayList<Object>();
myList.add(10);
return 2 + (int) myList.get(1);
```
Static and Dynamic Typing
A language is **statically typed** if it is always possible to determine the (static) type of an expression based on the program text alone.
A language is **dynamically typed** if only values have fixed type. Variables and parameters may take on different types at run-time, and must be checked immediately before they are used.
A language is “strongly typed” if it is impossible to perform an operation on the wrong kind of object.
Type consistency may be assured by
I. compile-time type-checking,
II. type inference, or
III. dynamic type-checking.
The term “strongly typed” is not very meaningful, just as the term “untyped” is misleading. Actually, all programming languages have a notion of type; they just handle types in very different ways.
The more useful distinction whether a language is statically-typed, like Java or C++, or dynamically-typed, like Smalltalk or Ruby.
Haskell is interesting in that it is statically-typed, but does not require explicit type annotations.
## Strong, weak, static, dynamic
<table>
<thead>
<tr>
<th></th>
<th>Static</th>
<th>Dynamic</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>“Strong”</strong></td>
<td>Java, Pascal</td>
<td>Smalltalk, Ruby</td>
</tr>
<tr>
<td><strong>“Weak”</strong></td>
<td>C</td>
<td>Assembler</td>
</tr>
</tbody>
</table>
Kinds of Types
All programming languages provide some set of built-in types.
> **Primitive types:** booleans, integers, floats, chars ...
> **Composite types:** functions, lists, tuples ...
Most statically-typed modern languages provide for additional user-defined types.
> **User-defined types:** enumerations, recursive types, generic types, objects ...
Roadmap
- Static and Dynamic Types
- **Type Completeness**
- Types in Haskell
- Monomorphic and Polymorphic types
- Hindley-Milner Type Inference
- Overloading
The Type Completeness Principle:
No operation should be arbitrarily restricted in the types of values involved.
— Watt
First-class values can be evaluated, passed as arguments and used as components of composite values.
Functional languages attempt to make no class distinctions, whereas imperative languages typically treat functions (at best) as second-class values.
Pretty much all programming languages limit the kinds of entities that may be pass as values (and therefore have a meaningful type). In C or C++, functions are not values, though pointers to functions are. Classes are not values.
In Java, methods and classes are not values, though you can obtain a reified object representing a class as a value, and in Java 8, you can pass method references as values. Packages are not values, however.
In Haskell, functions are first-class values, so can be passed as arguments and returned as values. Since Haskell is statically-typed, the type system is capable of expressing function types.
Roadmap
- Static and Dynamic Types
- Type Completeness
- **Types in Haskell**
- Monomorphic and Polymorphic types
- Hindley-Milner Type Inference
- Overloading
Function Types
Function types allow one to deduce the types of expressions without the need to evaluate them:
\[
\text{fact} :: \text{Int} \rightarrow \text{Int} \\
42 :: \text{Int} \quad \Rightarrow \quad \text{fact} 42 :: \text{Int}
\]
Curried types:
\[
\text{Int} \rightarrow \text{Int} \rightarrow \text{Int} \quad = \quad \text{Int} \rightarrow (\text{Int} \rightarrow \text{Int})
\]
and
\[
\text{plus} 5 \ 6 \quad = \quad ((\text{plus} 5) \ 6)
\]
so:
\[
\text{plus} :: \text{Int} \rightarrow \text{Int} \rightarrow \text{Int} \quad \Rightarrow \quad \text{plus} \ 5 :: \text{Int} \rightarrow \text{Int}
\]
All expressions are typed. If you know the types of the individual sub-expressions, you can compute the type of the expression as a whole.
In Haskell, you can query the type of a value with the operator :t
Prelude> :t 'a'
'a' :: Char
Prelude> :t 1
1 :: Num a => a
Prelude> :t 1 :: Int
1 :: Int :: Int
Prelude> :t 1 :: Float
1 :: Float :: Float
Note that numbers have a “funny” type: “Num a => a” means “if the type a is a kind of number, then the type is a”. Since Int and Float are both kinds of number, we can be more specific:
A list of values of type `a` has the type `[a]`:
```
[ 1 ] :: [ Int ]
```
*NB: All of the elements in a list must be of the same type!*
```
['a', 2, False] -- illegal! can't be typed!
```
Tuple Types
If the expressions $x_1$, $x_2$, ..., $x_n$ have types $t_1$, $t_2$, ..., $t_n$ respectively, then the tuple $(x_1, x_2, ..., x_n)$ has the type $(t_1, t_2, ..., t_n)$:
$$(1, [2], 3) :: (\text{Int}, [\text{Int}], \text{Int})$$
$$(\text{'a'}, \text{False}) :: (\text{Char}, \text{Bool})$$
$$(1,2),(3,4)) :: ((\text{Int}, \text{Int}), (\text{Int}, \text{Int}))$$
The unit type is written $(\ )$ and has a single element which is also written as $(\ )$.
New data types can be introduced by specifying
I. a datatype name,
II. a set of parameter types, and
III. a set of constructors for elements of the type:
\[
data \ \text{DatatypeName} \ a_1 \ldots \ a_n = \text{constr}_1 \mid \ldots \mid \text{constr}_m\]
where the constructors may be either:
1. Named constructors:
\[
\text{Name type}_1 \ldots \text{type}_k
\]
2. Binary constructors (i.e., anything starting with "::"):
\[
\text{type}_1 \ \text{BINOP} \ \text{type}_2
\]
Data types are somehow comparable to classes in object-oriented languages, yet also very different. A *constructor* is used to create a value of an abstract data type, but each value must be *deconstructed* before it can be used.
Deconstruction is simply pattern matching using the constructor names: if a value matches a constructor, then that gives you access to the arguments used with that constructor to create that value in the first place.
Enumeration types
User data types that do not hold any data can model enumerations:
```
data Day = Sun | Mon | Tue | Wed | Thu | Fri | Sat
```
Functions over user data types must *deconstruct* the arguments, with one case for each constructor:
```
whatShallIDo Sun = "relax"
whatShallIDo Sat = "go shopping"
whatShallIDo _ = "guess I'll have to go to work"
```
Notice how the data type Day has seven constructors, each without any arguments.
To find out which value a day is, we just pattern match it against its constructors, thus revealing what it is.
This is the *opposite* of encapsulation in OO languages, where you *never* deconstruct a value to access its data — instead the object has its own methods (services) that have exclusive access to the hidden data.
Union types
data Temp = Centigrade Float | Fahrenheit Float
freezing :: Temp -> Bool
freezing (Centigrade temp) = temp <= 0.0
freezing (Fahrenheit temp) = temp <= 32.0
In this case \texttt{Temp} has two constructors, each of which takes a single number as an argument. By pattern matching, we deconstruct the value and gain access to the hidden data inside.
A recursive data type provides constructors over the type itself:
```haskell
data Tree a = Lf a | Tree a :^: Tree a
mytree = (Lf 12 :^: (Lf 23 :^: Lf 13)) :^: Lf 10
? :t mytree
⇒ mytree :: Tree Int
```
my tree =
```
^:
/ \
Lf 12 Lf 23 Lf 13
```
```haskell
mytree
```
Recall that binary constructors are operators that start with “::”. In order to suggest tree-like structures, we pick “::^::” as our constructor for building a tree out of two subtrees.
Trees therefore have two constructors: Lf, for building a leaf node from a single element of an arbitrary type, and ::^:: for building a composite tree from two subtrees containing elements of consistent types.
Note that Haskell allows us to build a tree of strings or a tree of integers, but not a tree of integers and strings.
*Can you define a tree data type in Haskell that could hold either integers or strings? If so, how? If not, why not?*
Using recursive data types
\[\text{leaves, leaves'} :: \text{Tree } a \rightarrow [a]\]
\[
\text{leaves} (\text{Lf } l) = [l]
\]
\[
\text{leaves} (l ^ : : r) = \text{leaves} l ++ \text{leaves} r
\]
\[
\text{leaves'} t = \text{leavesAcc} t [ ]
\]
where \[
\text{leavesAcc} (\text{Lf } l) = (l:)
\]
\[
\text{leavesAcc} (l ^ : : r) = \text{leavesAcc} l . \text{leavesAcc} r
\]
NB: \((f \ . \ g) x = f (g x)\)
- What do these functions do?
- Which function should be more efficient? Why?
- What is \((l : )\) and what does it do?
Recall that : is Haskell's built-in operator for constructing lists from a head and a tail.
Prelude> :t (:)
(,:) :: a -> [a] -> [a]
Since : is a Curried function, we can supply one argument and get a function back. What does this function do?
NB: Dot (.) is the traditional function composition operator from mathematics. It is also a Curried function:
Prelude> :t (.)
(.) :: (b -> c) -> (a -> b) -> a -> c
Roadmap
- Static and Dynamic Types
- Type Completeness
- Types in Haskell
- Monomorphic and Polymorphic types
- Hindley-Milner Type Inference
- Overloading
Monomorphism
Languages like Pascal and C have monomorphic type systems: every constant, variable, parameter and function result *has a unique type.*
> good for type-checking
> bad for writing generic code
— it is *impossible* in Pascal to write a generic sort procedure
“Monomorphic” simple means “every value has a single, unique type”.
“Polymorphic” means “values may have more than one type.”
Polymorphism
A polymorphic function accepts arguments of different types:
\[
\begin{align*}
\text{length} & \quad :: \ [a] \rightarrow \text{Int} \\
\text{length} \ [\ ] & \quad = \ 0 \\
\text{length} \ (x:xs) & \quad = \ 1 + \text{length} \ \text{xs}
\end{align*}
\]
\[
\begin{align*}
\text{map} & \quad :: \ (a \rightarrow b) \rightarrow [a] \rightarrow [b] \\
\text{map} \ f \ [\ ] & \quad = \ [\ ] \\
\text{map} \ f \ (x:xs) & \quad = \ f \ x : \text{map} \ f \ \text{xs}
\end{align*}
\]
\[
\begin{align*}
(\cdot) & \quad :: \ (b \rightarrow c) \rightarrow (a \rightarrow b) \rightarrow (a \rightarrow c) \\
(f \ . \ g) \ x & \quad = \ f \ (g \ x)
\end{align*}
\]
Kinds of Polymorphism
> **Universal polymorphism:**
> — **Parametric**: polymorphic map function in Haskell; nil/void pointer type in Pascal/C
> — **Inclusion**: subtyping — graphic objects
> **Ad Hoc polymorphism:**
> — **Overloading**: + applies to both integers and reals
> — **Coercion**: integer values can be used where reals are expected and v.v.
The kind of polymorphism supported by Haskell is also known as *parametric polymorphism* (functions may be generic in their parameter types). Object-oriented languages also support *inclusion* or *subtype polymorphism*, another kind of polymorphism that is not part of Haskell.
More on this in the lecture on “Objects and Types”.
Roadmap
- Static and Dynamic Types
- Type Completeness
- Types in Haskell
- Monomorphic and Polymorphic types
- Hindley-Milner Type Inference
- Overloading
We can infer the type of many expressions by simply examining their structure. Consider:
\[
\begin{align*}
\text{length } [ ] &= 0 \\
\text{length } (x:xs) &= 1 + \text{length } xs
\end{align*}
\]
Clearly:
\[
\text{length} :: a \rightarrow b
\]
Furthermore, \( b \) is obvious \( \text{int} \), and \( a \) is a list, so:
\[
\text{length} :: [c] \rightarrow \text{Int}
\]
We cannot further refine the type, so we are done.
Note how the definition of length deconstructs lists by pattern-matching using the list constructors, i.e., [ ] to construct an empty list and : to construct a non-empty list.
By examining the definition of length, we can infer its type. First, it is clearly a function with a single argument and return value, so its shape is clearly \texttt{a -> b} (where \texttt{a} and \texttt{b} are types or type variables).
Second, \texttt{a} is clearly a list, so its type can be refined to \texttt{[c]}, and \texttt{b} is clearly a number (let's say \texttt{Int}). Conclusion:
\texttt{length :: [c] -> Int}
Composing polymorphic types
We can deduce the types of expressions using polymorphic functions by simply *binding type variables to concrete types.*
Consider:
```haskell
length :: [a] -> Int
map :: (a -> b) -> [a] -> [b]
```
Then:
```haskell
map length :: [[a]] -> [Int]
[ "Hello", "World" ] :: [[Char]]
map length [ "Hello", "World" ] :: [Int]
```
Note that type variables like `a` or `b` can be bound to any Haskell type, no matter how complex.
Hindley-Milner Type Inference automatically determines the types of many polymorphic functions.
\[
\text{map} \quad f \quad \text{[]} \quad = \quad \text{[]} \\
\text{map} \quad f \quad \text{(x:xs)} \quad = \quad f \ x : \ \text{map} \ f \ \text{xs}
\]
\[
\text{map} :: \quad X \quad \rightarrow \quad Y \quad \rightarrow \quad Z \\
\text{map} :: \quad (a \rightarrow b) \quad \rightarrow \quad [c] \quad \rightarrow \quad [d] \\
\text{map} :: \quad (a \rightarrow b) \quad \rightarrow \quad [a] \quad \rightarrow \quad [b]
\]
The corresponding type system is used in many modern functional languages, including ML and Haskell.
The Hindley-Milner type inference algorithm was discovered independently first by J. Roger Hindley and later by Robin Milner.
Here we only sketch out the main idea, not the details of the algorithm itself. The algorithm is linear in the size of the source code, so it is very practical for real language implementations. Note that the algorithm only deals with parametric polymorphism, not subtype polymorphism, so it cannot be used for languages like Java.
Type Specialization
A polymorphic function may be explicitly assigned a more specific type:
\[
\text{idInt} :: \text{Int} \rightarrow \text{Int}
\]
\[
\text{idInt} \ x = x
\]
Note that the \( :\text{t} \) command can be used to find the type of a particular expression that is inferred by Haskell:
\[
? :\text{t} \ \lambda x \rightarrow [x]
\]
\[
\Leftrightarrow \lambda x \rightarrow [x] :: a \rightarrow [a]
\]
\[
? :\text{t} (\lambda x \rightarrow [x]) :: \text{Char} \rightarrow \text{String}
\]
\[
\Leftrightarrow \lambda x \rightarrow [x] :: \text{Char} \rightarrow \text{String}
\]
Roadmap
> Static and Dynamic Types
> Type Completeness
> Types in Haskell
> Monomorphic and Polymorphic types
> Hindley-Milner Type Inference
> Overloading
Coercion vs overloading
Coercion or overloading — how do you distinguish?
Are there several overloaded + functions, or just one, with values automatically coerced?
Are there four different overloaded + functions; two, with coercion to real if one arg is int; or one with coercion to real?
Overloading
Overloaded operators are introduced by means of type classes:
```haskell
class Eq a where
(==), (/=) :: a -> a -> Bool
x /= y = not (x == y)
-- NB: defined in standard prelude
```
A type class must be instantiated to be used:
```haskell
instance Eq Bool where
True == True = True
False == False = True
_ == _ = False
```
Note that type classes have nothing to do with classes in OO languages! A type class in Haskell has more affinity with interfaces in Java: A type class defines a set of overloaded operators that must all be implemented by a given data type.
Instantiating overloaded operators
For each overloaded instance a separate definition must be given
```
instance Eq Int where (==) = primEqInt
instance Eq Char where c == d = ord c == ord d
instance (Eq a, Eq b) => Eq (a,b) where
(x,y) == (u,v) = x==u && y==v
instance Eq a => Eq [a] where
[ ] == [ ] = True
[ ] == (y:ys) = False
(x:xs) == [ ] = False
(x:xs) == (y:ys) = x==y && xs==ys
```
Equality for Data Types
Why not automatically provide equality for all types of values?
User data types:
```haskell
data Set a = Set [a]
instance Eq a => Eq (Set a) where
Set xs == Set ys = xs `subset` ys && ys `subset` xs
where xs `subset` ys = all (`elem` ys) xs
```
How would you define equality for the Tree data type?
NB: `all ('elem' ys) xs` tests that every `x` in `xs` is an element of `ys`
Equality for Functions
*Functions:*
\( ? \ (1==) \ == \ (\lambda x->1==x) \)
ERROR: Cannot derive instance in expression
```plaintext
*** Expression : (==) d148 ((==) {dict} 1) (\x->(==) {dict} 1 x)
*** Required instance : Eq (Int -> Bool)
```
Determining equality of functions is undecidable in general!
What you should know!
✎ How are the types of functions, lists and tuples specified?
✎ How can the type of an expression be inferred without evaluating it?
✎ What is a polymorphic function?
✎ How can the type of a polymorphic function be inferred?
✎ How does overloading differ from parametric polymorphism?
✎ How would you define == for tuples of length 3?
✎ How can you define your own data types?
✎ Why isn’t == pre-defined for all types?
Can you answer these questions?
- Can any set of values be considered a type?
- Why does Haskell sometimes fail to infer the type of an expression?
- What is the type of the predefined function `all`? How would you implement it?
- How would you define equality for the Tree data type?
Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
You are free to:
Share — copy and redistribute the material in any medium or format
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
http://creativecommons.org/licenses/by-sa/4.0/
|
{"Source-Url": "http://scg.unibe.ch/download/lectures/pl/PL-04TypesAndPolymorphism.pdf", "len_cl100k_base": 5748, "olmocr-version": "0.1.53", "pdf-total-pages": 59, "total-fallback-pages": 0, "total-input-tokens": 77382, "total-output-tokens": 8130, "length": "2e12", "weborganizer": {"__label__adult": 0.00044155120849609375, "__label__art_design": 0.0002579689025878906, "__label__crime_law": 0.0002758502960205078, "__label__education_jobs": 0.0005655288696289062, "__label__entertainment": 6.222724914550781e-05, "__label__fashion_beauty": 0.00016617774963378906, "__label__finance_business": 0.0001366138458251953, "__label__food_dining": 0.0004351139068603515, "__label__games": 0.00045680999755859375, "__label__hardware": 0.0005350112915039062, "__label__health": 0.0005207061767578125, "__label__history": 0.00021588802337646484, "__label__home_hobbies": 8.434057235717773e-05, "__label__industrial": 0.00033593177795410156, "__label__literature": 0.00034117698669433594, "__label__politics": 0.00025463104248046875, "__label__religion": 0.0005984306335449219, "__label__science_tech": 0.005352020263671875, "__label__social_life": 0.00012218952178955078, "__label__software": 0.0027980804443359375, "__label__software_dev": 0.98486328125, "__label__sports_fitness": 0.0003764629364013672, "__label__transportation": 0.0005159378051757812, "__label__travel": 0.00023877620697021484}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 21178, 0.00636]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 21178, 0.81485]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 21178, 0.79438]], "google_gemma-3-12b-it_contains_pii": [[0, 44, false], [44, 201, null], [201, 579, null], [579, 736, null], [736, 1054, null], [1054, 1272, null], [1272, 1505, null], [1505, 1862, null], [1862, 2266, null], [2266, 2921, null], [2921, 3015, null], [3015, 3333, null], [3333, 3914, null], [3914, 4349, null], [4349, 4623, null], [4623, 4985, null], [4985, 5146, null], [5146, 5519, null], [5519, 6151, null], [6151, 6318, null], [6318, 6938, null], [6938, 7498, null], [7498, 7690, null], [7690, 8157, null], [8157, 8658, null], [8658, 9106, null], [9106, 9476, null], [9476, 9884, null], [9884, 10054, null], [10054, 10244, null], [10244, 10526, null], [10526, 11162, null], [11162, 11692, null], [11692, 12103, null], [12103, 12260, null], [12260, 12534, null], [12534, 12660, null], [12660, 13332, null], [13332, 13696, null], [13696, 14027, null], [14027, 14184, null], [14184, 14613, null], [14613, 15215, null], [15215, 15569, null], [15569, 15667, null], [15667, 16299, null], [16299, 16758, null], [16758, 17352, null], [17352, 17509, null], [17509, 17675, null], [17675, 17800, null], [17800, 18162, null], [18162, 18403, null], [18403, 18808, null], [18808, 19220, null], [19220, 19530, null], [19530, 19972, null], [19972, 20258, null], [20258, 21178, null]], "google_gemma-3-12b-it_is_public_document": [[0, 44, true], [44, 201, null], [201, 579, null], [579, 736, null], [736, 1054, null], [1054, 1272, null], [1272, 1505, null], [1505, 1862, null], [1862, 2266, null], [2266, 2921, null], [2921, 3015, null], [3015, 3333, null], [3333, 3914, null], [3914, 4349, null], [4349, 4623, null], [4623, 4985, null], [4985, 5146, null], [5146, 5519, null], [5519, 6151, null], [6151, 6318, null], [6318, 6938, null], [6938, 7498, null], [7498, 7690, null], [7690, 8157, null], [8157, 8658, null], [8658, 9106, null], [9106, 9476, null], [9476, 9884, null], [9884, 10054, null], [10054, 10244, null], [10244, 10526, null], [10526, 11162, null], [11162, 11692, null], [11692, 12103, null], [12103, 12260, null], [12260, 12534, null], [12534, 12660, null], [12660, 13332, null], [13332, 13696, null], [13696, 14027, null], [14027, 14184, null], [14184, 14613, null], [14613, 15215, null], [15215, 15569, null], [15569, 15667, null], [15667, 16299, null], [16299, 16758, null], [16758, 17352, null], [17352, 17509, null], [17509, 17675, null], [17675, 17800, null], [17800, 18162, null], [18162, 18403, null], [18403, 18808, null], [18808, 19220, null], [19220, 19530, null], [19530, 19972, null], [19972, 20258, null], [20258, 21178, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 21178, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 21178, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 21178, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 21178, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 21178, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 21178, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 21178, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 21178, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 21178, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 21178, null]], "pdf_page_numbers": [[0, 44, 1], [44, 201, 2], [201, 579, 3], [579, 736, 4], [736, 1054, 5], [1054, 1272, 6], [1272, 1505, 7], [1505, 1862, 8], [1862, 2266, 9], [2266, 2921, 10], [2921, 3015, 11], [3015, 3333, 12], [3333, 3914, 13], [3914, 4349, 14], [4349, 4623, 15], [4623, 4985, 16], [4985, 5146, 17], [5146, 5519, 18], [5519, 6151, 19], [6151, 6318, 20], [6318, 6938, 21], [6938, 7498, 22], [7498, 7690, 23], [7690, 8157, 24], [8157, 8658, 25], [8658, 9106, 26], [9106, 9476, 27], [9476, 9884, 28], [9884, 10054, 29], [10054, 10244, 30], [10244, 10526, 31], [10526, 11162, 32], [11162, 11692, 33], [11692, 12103, 34], [12103, 12260, 35], [12260, 12534, 36], [12534, 12660, 37], [12660, 13332, 38], [13332, 13696, 39], [13696, 14027, 40], [14027, 14184, 41], [14184, 14613, 42], [14613, 15215, 43], [15215, 15569, 44], [15569, 15667, 45], [15667, 16299, 46], [16299, 16758, 47], [16758, 17352, 48], [17352, 17509, 49], [17509, 17675, 50], [17675, 17800, 51], [17800, 18162, 52], [18162, 18403, 53], [18403, 18808, 54], [18808, 19220, 55], [19220, 19530, 56], [19530, 19972, 57], [19972, 20258, 58], [20258, 21178, 59]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 21178, 0.00909]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
6f4249d0f4e54ca08ef2df6738ebf9865ab9b5d5
|
Unwrapping
Oracle
PLSQL
DOCUMENT HISTORY
<table>
<thead>
<tr>
<th>Version</th>
<th>Date</th>
<th>Changed By:</th>
<th>Remarks</th>
</tr>
</thead>
<tbody>
<tr>
<td>1.0</td>
<td>10/10/09</td>
<td>G S Chapman</td>
<td>Initial Version</td>
</tr>
<tr>
<td>1.1</td>
<td>19/03/10</td>
<td>G S Chapman</td>
<td>Add some additional checks in unwrap package body.</td>
</tr>
</tbody>
</table>
DOCUMENT DISTRIBUTION
<table>
<thead>
<tr>
<th>Copy No</th>
<th>Name</th>
<th>Role</th>
<th>Organisation</th>
</tr>
</thead>
</table>
unwrap
# DOCUMENT REFERENCES
<table>
<thead>
<tr>
<th>Document Name</th>
<th>Originator</th>
<th>Part Number</th>
<th>Version</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="http://technology.amis.nl/blog/4753/unwrapping-10g-wrapped-plsql">http://technology.amis.nl/blog/4753/unwrapping-10g-wrapped-plsql</a></td>
<td>Anton Scheffer</td>
<td>N/A</td>
<td>N/A</td>
<td></td>
</tr>
<tr>
<td>The Oracle Hacker’s Handbook</td>
<td>David Litchfield</td>
<td>N/A</td>
<td>N/A</td>
<td></td>
</tr>
<tr>
<td><a href="http://www.gzip.org/zlib/rfc-zlib.html">http://www.gzip.org/zlib/rfc-zlib.html</a></td>
<td>-</td>
<td>N/A</td>
<td>N/A</td>
<td></td>
</tr>
</tbody>
</table>
**TABLE OF CONTENTS**
1 | Introduction ......................................................................................... 1
1.1 | History ........................................................................................... 1
1.2 | Wrapped code display ...................................................................... 1
2 | Code .................................................................................................. 5
2.1 | Java package code .......................................................................... 5
2.2 | PLSQL wrapper for java code ........................................................... 5
2.3 | Unwrap package ............................................................................ 6
2.4 | Test code ...................................................................................... 10
2.5 | Script to generate substation table. ............................................... 11
**TABLE OF FIGURES**
Figure 1- Unwrap display ........................................................................ 1
Figure 2 - Unwrap display 2 ................................................................... 2
Figure 3 - Trying a line feed: ................................................................ 3
Figure 4 - Trying a space character .................................................... 4
**TABLES**
Table 1 - Wrap database type codes ...................................................... 2
**Appendices**
A. Notes
PURPOSE OF DOCUMENT
A description of how to unwrap Oracle ‘wrapped’ database code.
1 Introduction
1.1 History
This document started out as an investigation into how secure the database wrapped code is in practise as a means of securing account passwords for remote web service connection or accessing a Microsoft Active Directory LDAP service. Since the database in use was an Oracle 10g database it was decided to concentrate upon this and later database and not investigate Oracle 9 or earlier. The code developed has also been successfully tested on an Oracle 11g database.
Investigation on the web reveals that many people have tried to unwrap wrapped PL/SQL. Most people were unsuccessful but a presentation by Pete Finnegan’s presentation at the 2006 Black Hat conference indicated that is possible. Additionally David Litchfield, in his book “The Oracle Hacker’s Handbook”, described a method to unwrap code on a 10G database. This described how the code is base64 decoded, and then, each byte is re-substituted with a second corresponding substitution table. Finally the text is decompressed, leaving the clear text of the PL/SQL.
The key to the mechanism is the substitution table, and this document describes how this was discovered and how a few procedures have been written to enable the unwrapping of both code stored in the database and also operating system flat files.
1.2 Wrapped code display
The first step is to look at the output of some simple wrapped procedures. The executable wrap.exe (Windows) is used to wrap the PL/SQL code in a file, alternatively the database procedure dbms_ddl.wrap can be used.

In this output we see a line with a000000 and 15 lines with ‘abcd’. This display is typical of all inspected wrapped code. The third line, in this example 367, is probably related with the database version. Upon an 10.2.0.4 database it seems to always be a value of 367, upon an 10.2.0.1 database is seems to be 2e. With an 11g release 1 database the values seems to be a 1.
The 19th line appears to be an indication of the type of the wrapped object.
### Table 1 - Wrap database type codes
<table>
<thead>
<tr>
<th>Code</th>
<th>Database type</th>
</tr>
</thead>
<tbody>
<tr>
<td>7</td>
<td>Procedure</td>
</tr>
<tr>
<td>8</td>
<td>Function</td>
</tr>
<tr>
<td>b</td>
<td>Package Body</td>
</tr>
</tbody>
</table>
The following line contains 2 hex numbers. The first is the length from the unwrapped text without the create + 1, and the second is the length of the base64-encoded text.
It is possible to use a shorter piece of code.

From Litchfield's book we can if we base64-decode this, skip the first 20 bytes (the size of a SHA1-hash) there are only 18 bytes left to decipher. For the base64-decoding one uses the package `utl_encode`. There is also an Oracle package `utl_compress`, which can be used for Lempel-Ziv compression/decompression.
There are 2 options:
- Find a substitution table, apply it, and decompress the result to get unwrapped PL/SQL code.
- Compress PL/SQL code, and compare this to the base64-decoded output to FIND (a part of) the substitution table.
Using the second option we can use different inputs to the `dbms_ddl.wrap` package.
Unfortunately the output is one byte short, but remember the two hex numbers in the wrapped output. The first hex number was the length of the unwrapped code + 1. So if one adds a newline character to the input of the compression, that will give 1 more byte for the zipped code. This reveals another small problem in that the output of the wrapped column we has 2 lines with the value of 166. These lines should both have the same value in the zipped column which is no so. One alternative is to add a space character.
The above display thus provides 16 entries of the possible 256, for the substitution table. Changing the test code and retesting reveals other values but unfortunately there are different “zipped values” for the same “wrapped values”. This indicates that the use of a space character is incorrect. Further testing reveals that the character to be used has to be a byte 0.
If an attempt is made to create the additional values in a PLSQL loop more errors are discovered, this time related with the second byte. This is where the compression level is stored, and changing it to a value of 9 enables the whole substitution table to be generated.
The above mechanism can be used it in a SQL-statement or in a Java-program to unwrap the plb-files of any lost sources.
2 Code
2.1 Java package code
The following java source package is called by a database PLSQL package supplied below. It uses a java supplied compression algorithm.
```java
DROP JAVA SOURCE MY_COMPRESS;
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED MY_COMPRESS as import java.io.*;
import java.util.zip.*;
public class MY_COMPRESS
{
public static String Inflate(byte[] src)
{
try
{
ByteArrayInputStream bis = new ByteArrayInputStream(src);
InflaterInputStream iis = new InflaterInputStream(bis);
StringBuffer sb = new StringBuffer();
for(int c = iis.read(); c != -1; c = iis.read())
{
sb.append((char)c);
}
return sb.toString();
}
catch(Exception e)
{
}
return null;
}
public static byte[] Deflate(String src, int quality)
{
try
{
byte[] tmp = new byte[src.length() + 100];
Deflater defl = new Deflater(quality);
defl.setInput(src.getBytes("UTF-8"));
defl.finish();
int cnt = defl.deflate(tmp);
byte[] res = new byte[cnt];
for(int i = 0; i < cnt; i++)
{ res[i] = tmp[i]; }
return res;
}
catch(Exception e)
{
}
return null;
}
}
```
2.2 PLSQL wrapper for java code
The following is a small wrapper around the Java code supplied above to enable it to be called easily from a PLSQL (or SQL) procedure.
```sql
CREATE OR REPLACE package mycompress
is
function deflate( src in varchar2 )
return raw;
-- function deflate( src in varchar2, quality in number )
-- return raw;
-- function inflate( src in raw )
-- return varchar2;
-- end;
/
```
CREATE OR REPLACE package body mycompress is
function deflate( src in varchar2 ) return raw is
begin
return deflate( src, 6 );
end;
function deflate( src in varchar2, quality in number ) return raw as language java name 'MY_COMPRESS.Deflate( java.lang.String, int ) return byte[]';
function inflate( src in raw ) return varchar2 as language java name 'MY_COMPRESS.Inflate( byte[] ) return java.lang.String';
end;
/
2.3 Unwrap package
The following package, which contains the translation table provides a number of mechanisms to call the java code to unwrap the source whether it is supplied as a text string, a database procedure (or package) or as an operating system file. In the case of the latter the usual Oracle requirements for defined directories, etc apply.
Note that the procedure to accept a named package from the dba_source view assumes that the package owner has the correct grants. Using all_source does not always find the package being requested.
CREATE OR REPLACE PACKAGE UNWRAP AS
PROCEDURE table_source (p_owner IN VARCHAR2,
p_name IN VARCHAR2,
p_type IN VARCHAR2);
PROCEDURE text_source (p_text IN VARCHAR2);
PROCEDURE file_source (p_dir IN VARCHAR2,
p_fname IN VARCHAR2);
END UNWRAP;
/
CREATE OR REPLACE PACKAGE BODY UNWRAP AS
/*
Make into a package with the base functions included below and a few procedures.
One to accept an input string as is.
One to read a file
One to table a schema and name to enable a read the text line from the all_source table.
DBMS_OUTPUT output is probably more than suitable since there would be a need to add comments and modify the header in some way if only to insert the phrase 'CREATE OR REPLACE'.
The output could be spooled to an output file if desired.
*/
not_wrapped EXCEPTION;
PROCEDURE Print (p_text IN VARCHAR2) IS
BEGIN
dbms_output.put_line(p_text);
END;
FUNCTION TRANS (v_inp VARCHAR2)
RETURN VARCHAR2
IS
/*
*/
BEGIN
RETURN UTL_RAW.TRANSLATE (v_inp,
'0012030405060708090A0B0C0D0E0F'
|| '101112131415161718191A1B1C1D1E1F'
|| '202122232425262728292A2B2C2D2E2F'
|| '303132333435363738393A3B3C3D3E3F'
|| '404142434445464748494A4B4C4D4E4F'
|| '505152535455565758595A5B5C5D5E5F'
|| '606162636465666768696A6B6C6D6E6F'
|| '707172737475767778797A7B7C7D7E7F'
|| '808182838485868788898A8B8C8D8E8F'
|| '909192939495969798999A9B9C9D9E9F'
|| 'A0A1A2A3A4A5A6A7A8A9AAACADAEAF'
|| 'B0B1B2B3B4B5B6B7B8B9BABBCCDBDBEF'
|| 'C0C1C2C3C4C5C6C7C8C9CACCBCDCCDECF'
|| 'D0D1D2D3D4D5D6D7D8D9DADDCCDDEDFF'
|| 'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEDF'
|| 'F0F1F2F3F4F5F6F7F8F9FAFBFCCFDFEFF',
'3D658B318DB287F152AB634B5A05F'
|| '7D687B9B24C228678ADEA4261E03EB17'
|| '6F343EA7A3DF2A96A0FE935561FB14D10'
|| '78D975F6C14081610619AD6D5297E1'
|| '86E79E505BA84CE627E8803DF4F8F39F'
|| 'DDA271B858DD2C38994C4075SE4538C'
|| '486B2DA5AF32224DCC50CA250B9C16'
|| '65CCFCD0C81CD4376D3C3A0EE86C31'
|| '47F533DA43C8E35E194ECEA59514EDC'
|| '9D6FA5915C52FCABB0BDF297BA076'
|| 'B4494A5D0F009621807F1A2394FC1'
|| 'AD70D1D18F1319370EE5EBFB09B977'
|| '72EB854B728C73906620051EDF87C'
|| '82EP412C62B813DACC0B3C44EC06936'
|| '6202AE88FCAA4208A64557D39ABDE123'
|| '8D924A189746B91FBBFEC901EA1BF7CE' + 1,
CHR (10));
END;
FUNCTION subst (v_inp IN VARCHAR2)
RETURN VARCHAR2
IS
/*
*/
BEGIN
RETURN SUBSTR (UTL_ENCODE.base64_decode (UTL_RAW.cast_to_raw (RTRIM (SUBSTR (v_inp, INSTR (v_inp, CHR (10)), 1, 20) + 1), CHR (10)) + 1), 41)
END;
PROCEDURE OpenFile (dir_in IN VARCHAR2, fname IN VARCHAR2, fhandle OUT UTL_FILE.FILE_TYPE)
IS
fhandle := UTL_FILE.FOPEN (dir_in, fname, 'r');
EXCEPTION
WHEN UTL_FILE.INVALID_PATH
THEN
PROCEDURE CloseFile (fhandle_in IN UTL_FILE.FILE_TYPE)
IS
BEGIN
UTL_FILE.FCLOSE_ALL;
EXCEPTION
WHEN UTL_FILE.INVALID_PATH
THEN
DBMS_OUTPUT.PUT_LINE ('invalid_path');
WHEN UTL_FILE.INVALID_MODE
THEN
DBMS_OUTPUT.PUT_LINE ('invalid_mode');
WHEN UTL_FILE.INVALID_FILEHANDLE
THEN
DBMS_OUTPUT.PUT_LINE ('invalid_filehandle');
WHEN UTL_FILE.INVALID_OPERATION
THEN
DBMS_OUTPUT.PUT_LINE ('invalid_operation');
WHEN UTL_FILE.READ_ERROR
THEN
DBMS_OUTPUT.PUT_LINE ('read_error');
WHEN UTL_FILE.WRITE_ERROR
THEN
DBMS_OUTPUT.PUT_LINE ('write_error');
WHEN UTL_FILE.INTERNAL_ERROR
THEN
DBMS_OUTPUT.PUT_LINE ('internal_error');
END CloseFile;
PROCEDURE table_source (p_owner IN VARCHAR2,
p_name IN VARCHAR2,
p_type IN VARCHAR2)
IS
v_s VARCHAR2 (32000);
v_x VARCHAR2 (32000);
v_t VARCHAR2 (32000);
nlines INTEGER;
BEGIN
-- dbms_output.put_line('Procedure: '||p_owner||'.'||p_name||' '||p_type);
SELECT count(line)
INTO nlines
FROM dba_source
WHERE name = p_name
AND owner = p_owner
AND type = p_type;
-- dbms_output.put_line('Lines found '||nlines);
v_s := '';
FOR i IN 1..nlines
LOOP
SELECT text
INTO v_t
FROM dba_source
WHERE name = p_name
AND owner = p_owner
AND type = p_type
AND line = i;
IF i = 1 AND INSTR(SUBSTR(v_t, 1, 60), 'wrapped') = 0 THEN
RAISE not_wrapped;
END IF;
v_s := v_s || v_t;
v_t := '';
END LOOP;
v_x := subst(v_s);
v_t := trans(v_x);
DBMS_OUTPUT.put_line(mycompress.inflate(v_t));
EXCEPTION
WHEN NO_DATA_FOUND THEN
dbms_output.put_line('Procedure: ''||p_owner||''.''||p_name||'' ''||p_type||'' not found.');
WHEN not_wrapped THEN
dbms_output.put_line('Procedure: ''||p_owner||''.''||p_name||'' ''||p_type||'' is not wrapped code.');
END table_source;
PROCEDURE file_source (p_dir IN VARCHAR2,
p_fname IN VARCHAR2)
IS
v_s VARCHAR2 (32000);
v_x VARCHAR2 (32000);
v_t VARCHAR2 (32000);
fhandle UTL_FILE.FILE_TYPE;
ufhandle UTL_FILE.FILE_TYPE;
dir_in VARCHAR2 (100);
fname VARCHAR2 (40);
BEGIN
Openfile(p_dir, p_fname, fhandle);
utl_file.get_line(fhandle, v_s, 32000);
DBMS_OUTPUT.put_line(substr(v_s,1,100));
CloseFile(fhandle);
IF upper(substr(v_s, 1, 6)) != 'CREATE' THEN
v_x := subst ('CREATE ' || v_s);
ELSE
v_x := subst (v_s);
END IF;
v_t := trans(v_x);
DBMS_OUTPUT.put_line (mycompress.inflate (v_t));
END file_source;
PROCEDURE text_source (p_text IN VARCHAR2)
IS
v_s VARCHAR2 (32000);
v_x VARCHAR2 (32000);
v_t VARCHAR2 (32000);
BEGIN
IF upper(substr(p_text, 1, 6)) != 'CREATE' THEN
v_x := subst ('CREATE ' || p_text);
ELSE
v_x := subst (p_text);
END IF;
v_t := trans(v_x);
DBMS_OUTPUT.put_line (mycompress.inflate (v_t));
END text_source;
2.4 Test code
The following code demonstrates the usage of the two of the procedures. The example procedure used is intended as an illustration of the technique.
declare
v_text VARCHAR2(4000) := ' PROCEDURE osc_alert_compl wrapped
begin
dbms_output.put_line ('Test 1');
unwrap.table_source ('GSC', 'OSC_ALERT_COMPL1', 'PROCEDURE');
dbms_output.put_line ('Test 2');
unwrap.text_source(v_text);
end;
/
Output displayed:
Test 1
PROCEDURE osc_alert_compl1 ( TNSALIAS VARCHAR2 DEFAULT NULL) AS
C_STMT VARCHAR2(4000) ;
C_TIME OWA_UTIL.VC_ARR ;
C_MESSAGE OWA_UTIL.VC_ARR ;
BEGIN
OSC_HTTP('TABLEOPEN','NAME');
HTP.TABLEROWOPEN;
OSC_HTTP('TABLEDATA_HEAD','MESSAGE');
HTP.TABLEROWCLOSE;
C_STMT := 'SELECT TIME,text
FROM (SELECT last_value(to_char(TIME,'||''''||'DD.MM.YY
Hh24:MI:SS'||''''||') ignore nulls) AS
TIME,text
FROM
OVER(ORDER BY rownum ASC ROWS unbounded preceding) AS
TIME,text
FROM
(SELECT rownum,
WHEN(text LIKE '||''''||'
YYYY'||''''||','||''''||'nls_date_language=american'||''''||')
END AS
TIME,
CASE
WHEN(text NOT LIKE '||''''||'
THEN
THEN
2.5 Script to generate substation table.
The following script can be used to generate the substitution table.
```sql
declare
type tp_tab is table of pls_integer index by pls_integer;
t2 tp_tab;
cursor c_fill( p_in in varchar2 )
is
with src as
( select p_in txt
from dual )
, wrap as
( select src.txt
, dbms_ddl.wrap( 'create ' || src.txt ) wrap
from src )
, subst as
( select substr( utl_encode.base64_decode( utl_raw.cast_to_raw(rtrim( substr( wrap.wrap, instr( wrap.wrap, chr( 10 ), 1, 20 ) + 1 ), chr(10) ) ) ) ), 41 ) x
, mycompress.deflate( wrap.txt || chr(0), 9 ) d
from wrap
) select to_number( substr( x, r * 2 - 1, 2 ), 'xx' ) xr
, to_number( substr( d, r * 2 - 1, 2 ), 'xx' ) dr
from subst
, ( select rownum r from dual connect by rownum <= ( select length( x ) / 2 from subst ) )
t varchar2(512);
cnt number;
procedure fill( p_txt in varchar2, p_from in number, p_to in number, p_extra in varchar2 := null )
is
begin
for i in p_from .. p_to
loop
for r_fill in c_fill( p_txt || chr( i ) || p_extra )
loop
```
```sql
EXECUTE IMMEDIATE C_STMT BULK COLLECT INTO C_TIME,C_MESSAGE;
IF C_MESSAGE.COUNT >0 THEN
FOR X IN 1..C_MESSAGE.COUNT LOOP
HTP.TABLEROWOPEN;
OSC_HTTP('TABLEDATA_NORMAL',C_TIME(X));
OSC_HTTP('TABLEDATA_NORMAL',C_MESSAGE(X));
HTP.TABLEROWCLOSE;
END LOOP;
HTP.TABLEROWOPEN;
OSC_HTTP('TABLEDATA_NORMAL','END OF LIST');
HTP.TABLECLOSE;
ELSE
OSC_HTTP('WARNING_GRAY','No Entries in the Alert Log yet');
END IF;
EXCEPTION
WHEN OTHERS THEN
OSC_FILL_ERROR('osc_alert_compl1',SYSDATE,NULL,SQLERRM(SQLCODE));
END;
!
Test 2
PROCEDURE osc_alert_compl AS
BEGIN
OSC_DEF_DB ('osc_alert_compl1');
END;
/
if ( t2( r_fill.xr ) != -1
and t2( r_fill.xr ) != r_fill.dr
)
then
dbms_output.put_line( 'error: value maps to two different values ' || p_txt
);
dbms_output.put_line( chr( i ) || '' || r_fill.xr || '' || t2( r_fill.xr )
|| '' || r_fill.dr );
raise no_data_found;
end if;
t2( r_fill.xr ) := r_fill.dr;
end loop;
end loop;
end;
procedure fill2( p_txt in varchar2 )
is
begin
for i in 0 .. 99
loop
fill( p_txt, ascii( 'a' ), ascii( 'z' ), to_char( i, 'fm999' ) );
fill( p_txt, ascii( 'A' ), ascii( 'Z' ), to_char( i, 'fm999' ) );
end loop;
end;
begin
for i in 0 .. 255
loop
t2( i ) := -1;
end loop;
--
dbms_output.put_line( to_char( sysdate, 'hh24:mi:ss' ) );
fill2( 'PACKAGE ' );
-- fill2( 'PACKAGE BODY ' );
-- fill2( 'FUNCTION ' );
-- fill2( 'PROCEDURE ' );
-- fill2( 'TYPE BODY ' );
--
dbms_output.put_line( to_char( sysdate, 'hh24:mi:ss' ) );
cnt := 0;
for i in 0 .. 255
loop
if t2( i ) != -1
then
dbms_output.put_line( cnt || ': ' || t2( i ) || ' : ' || to_char( t2( i ), 'xxxx' ) );
cnt := cnt + 1;
end if;
end loop;
end loop;
dbms_output.put_line( 'cnt ' || cnt );
end;
/
A. **Notes**
A.1 **Oracle 9i wrap mechanism**
The 10g wrap mechanism seems a lot weaker than the 9i and lower mechanism. The main problem with the 9i mechanism is that the symbol table is visible, with 10g to 11g that is not so BUT is weaker as full reversal is possible. With 9i it is simply the internal state of the PL/SQL compiler, i.e. DIANA written out to disk as IDL. The unwrap process for 9i is a feature of the design of DIANA which was intended for low memory older machines where code would be stored in an intermediate format and it should be possible to reconstruct the source code. Writing an un-wrapper for 9i and lower is a bigger task than with Oracle 10g. With Oracle 10g there is the addition of a hidden symbol table but a much weaker mechanism to hide the code.
A.1.1 **Limits on using SQL to unwrap code**
In SQL-queries the maximum allowed length of RAW and VARCHAR2 is 4000, which means that sql-queries can not be used for unwrapping “large” pieces of code. For those larger unwrapping tasks one has to use PLSQL, which has a limit of more than 32000, or java. For cutting of the first 40 chars, in the example the RAW value is converted to a VARCHAR2 value, and in that conversion every RAW becomes the 2 byte hexadecimal representation of the value.
A.1.2 **Unwrapping Oracle packages**
The unwrapping of Oracle supplied packages and procedures is not recommended or encouraged and problems may be encountered. Some are known to unwrap successfully whilst others may encounter problems. The cause of these problems has not been investigated.
|
{"Source-Url": "http://macrotoneconsulting.co.uk/images/Documents/unwrap.pdf", "len_cl100k_base": 6027, "olmocr-version": "0.1.53", "pdf-total-pages": 18, "total-fallback-pages": 0, "total-input-tokens": 40882, "total-output-tokens": 7345, "length": "2e12", "weborganizer": {"__label__adult": 0.0002841949462890625, "__label__art_design": 0.00016629695892333984, "__label__crime_law": 0.000335693359375, "__label__education_jobs": 0.0002211332321166992, "__label__entertainment": 3.731250762939453e-05, "__label__fashion_beauty": 8.082389831542969e-05, "__label__finance_business": 0.00017118453979492188, "__label__food_dining": 0.00024187564849853516, "__label__games": 0.0003752708435058594, "__label__hardware": 0.0010519027709960938, "__label__health": 0.0002491474151611328, "__label__history": 0.00012195110321044922, "__label__home_hobbies": 5.9545040130615234e-05, "__label__industrial": 0.0003101825714111328, "__label__literature": 0.0001271963119506836, "__label__politics": 0.00012814998626708984, "__label__religion": 0.00028204917907714844, "__label__science_tech": 0.00860595703125, "__label__social_life": 3.927946090698242e-05, "__label__software": 0.0095062255859375, "__label__software_dev": 0.97705078125, "__label__sports_fitness": 0.00017201900482177734, "__label__transportation": 0.00020742416381835935, "__label__travel": 0.00011527538299560548}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 21407, 0.04895]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 21407, 0.27597]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 21407, 0.59103]], "google_gemma-3-12b-it_contains_pii": [[0, 24, false], [24, 526, null], [526, 1380, null], [1380, 2896, null], [2896, 2980, null], [2980, 4941, null], [4941, 6066, null], [6066, 6585, null], [6585, 7350, null], [7350, 8980, null], [8980, 10894, null], [10894, 12940, null], [12940, 14022, null], [14022, 15567, null], [15567, 16732, null], [16732, 18346, null], [18346, 19832, null], [19832, 21407, null]], "google_gemma-3-12b-it_is_public_document": [[0, 24, true], [24, 526, null], [526, 1380, null], [1380, 2896, null], [2896, 2980, null], [2980, 4941, null], [4941, 6066, null], [6066, 6585, null], [6585, 7350, null], [7350, 8980, null], [8980, 10894, null], [10894, 12940, null], [12940, 14022, null], [14022, 15567, null], [15567, 16732, null], [16732, 18346, null], [18346, 19832, null], [19832, 21407, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 21407, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 21407, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 21407, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 21407, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 21407, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 21407, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 21407, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 21407, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 21407, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 21407, null]], "pdf_page_numbers": [[0, 24, 1], [24, 526, 2], [526, 1380, 3], [1380, 2896, 4], [2896, 2980, 5], [2980, 4941, 6], [4941, 6066, 7], [6066, 6585, 8], [6585, 7350, 9], [7350, 8980, 10], [8980, 10894, 11], [10894, 12940, 12], [12940, 14022, 13], [14022, 15567, 14], [15567, 16732, 15], [16732, 18346, 16], [18346, 19832, 17], [19832, 21407, 18]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 21407, 0.03534]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
cd67baaf7ede59456d62a82a21c62299164def6f
|
An extension to SystemC-A to support mixed-technology systems with distributed components
Chenxu Zhao and Tom J. Kazmierski
School of Electronics and Computer Science
University of Southampton, UK
Email: cz05r,tjk@ecs.soton.ac.uk
Abstract—This contribution proposes syntax extensions to SystemC-A that support mixed-technology system modelling where components might exhibit distributed behaviour modelled by partial differential equations. The important need for such extensions arises from the well known modelling difficulties in hardware description languages where complex electronics in a mixed-technology system interfaces with distributed components from different physical domains, e.g. mechanical, magnetic or thermal. A digital MEMS accelerometer with distributed mechanical sensing element is used as a case study to illustrate modelling capabilities offered by the proposed extended syntax of SystemC-A.
I. INTRODUCTION
SystemC-A [1] is a superset of SystemC intended to extend the modelling capabilities of SystemC [2] to the analogue domain. It provides constructs to support user defined ordinary differential and algebraic equations (ODAEs), and analogue components to enable modelling of analogue, mixed-signal and mixed-domain systems from high level of abstraction down to the circuit level. Most powerful features of VHDL-AMS [3] and Verilog-AMS [4] are provided in SystemC-A in addition to a number of extra advantages such as high simulation speed, support for hardware-software co-design and high levels of modeling [1]. SystemC-A is used to model mixed-signal and mixed-physical domain systems such as automotive seating vibration isolation system [1] and ferromagnetic hysteresis [5].
Although major AMS HDLs such as SystemC-A and VHDL-AMS are very powerful and flexible mixed physical domain modeling tools, they face a challenge in modelling mixed-technology microsystem applications such as energy harvesting systems and MEMS sensors. This is because current HDLs only support ODAEs modelling. This limits accurate modelling of systems with distributed effects (mechanical [6], electromagnetic (EM) [7], thermal [8], [9], etc.) which can not be neglected and may even play vital roles. Thus an implementation of PDEs in major HDLs is in demand. Some attempts have already been made to implement PDEs within the existing limits of major AMS-HDLs [10], [11], [8]. Among them, a proposal for syntax extension for VHDL-AMS (named VHDL-AMSP) has been presented [10]. Pending the development of a new standard, a preprocessor has been developed to convert VHDL-AMSP into the existing VHDL-AMS 1076.1 standard automatically which can be simulated using currently available simulators. In this paper, we propose the first full implementation of the PDE extension to SystemC-A where no preprocessor is required.
The proposed extension has particular advantages in mixed physical technology systems that exhibit distributed physical effects. For example, electromechanical Sigma-Delta MEMS sensor designs, e.g. accelerometers and gyroscopes, which are based on incorporation of mechanical sensing elements into \( \Sigma \Delta \) modulator control loops, have attracted great research interest [12]. The mechanical sensing element, which is usually modeled by the lumped mass-spring-damper model (a second order ODE), is also a part of the loop filter in these systems. However, the lumped model only can capture the first resonant mode which is not accurate enough as higher order mechanical resonant modes may significantly affect the performance and stability of the \( \Sigma \Delta \) control loop [6]. Consequently, it is necessary to improve the accuracy of the mechanical model and use partial rather than ordinary differential equations. In section III the case study of a MEMS accelerometer embedded in a \( \Sigma \Delta \) control loop is modelled in the extended SystemC-A to demonstrate the efficiency of the new syntax. The accelerometer uses distributed sensing elements.
II. SYSTEMC-A SYNTAX EXTENSION AND IMPLEMENTATION
This section describes the new syntax of SystemC-A with which users can define PDEs. The abstract base class for PDEs is derived from the existing SystemC-A abstract base class \( \text{sc\_a\_component} \). Both PDEs and their boundary conditions are generated from the new abstract base classes \( \text{sc\_a\_PDE\_base} \) in the proposed extension. This new abstract base class also inherits the virtual \textit{build} method which is invoked by the SystemC-A analogue kernel at each time step to build the system matrix from contributions of all the components. A sample component class hierarchy with PDE extension is shown in Fig.1. The mechanical component in this example includes user defined
PDEs and associated boundary conditions which are derived from the PDE base class.
A finite difference approach is used to discretize the PDEs with respect to spatial variables and leave the time derivatives unchanged. Consequently, PDEs are converted to a series of ODEs which can be handled by the existing SystemC-A analogue solver. The modelling flow in SystemC-A with PDE extensions is shown in the Fig.2.
The following example of a simple one dimensional PDE demonstrates the new syntax:
$$\frac{\partial Q(x,t)}{\partial x} + A \frac{\partial Q(x,t)}{\partial t} = B$$
Let the boundary condition be:
$$\frac{\partial^{M+N} Q(x,t)}{\partial x^M \partial t^N} = C;$$
where $Q(x,t)$ is the partial quantity of interest, $A$ is the parameter, $B$ is the excitation, $C$ is the right hand side value of the boundary condition equation, $x$ is a spatial variable and $t$ is time. The boundary condition is defined in Eq.2.
The extended SystemC-A code for this example is:
```cpp
void sc_a_PDE_example :: Build()
Pdxdt_Boundary(M,N,"Q",x,C);
for (x=1:x<N_node,x++)
PDE(x,-Pdx(1,"Q",x)-A*Pdt(1,"Q",x)+B);
}
```
A. Spatial Coordinate and Partial Quantity
Currently, in SystemC-A, three types of analogue system variables (node, flow, quantity), which are derived from an abstract base class called sc_a_system_variable, are defined. In the proposed PDEs extension, a new type of system variable (Partial Quantity), which is also derived from the abstract base class, is defined as illustrated in Fig.3.
The method `PDE_coordinateDeclaration()` is used for partial quantity definition and spatial coordinate declaration. Multiple coordinate declarations will form a hypercube in the multi-dimensional space. As shown in the example code, the spatial coordinate "x" with the range $R$ is divided into $N_{node}$ segments and the partial quantity "Q" is discretized and defined inside the function in array format and discretization step size $dx(R/N_{node})$ is returned.
The method `PDEQuantity()` is used to read a value of a particular partial quantity. For example, `PDEQuantity("Q",x)` returns the value of Partial Quantity $Q$ at node $x$. This function's counterpart in SystemC-A is $X()$ which reads the value of a quantity. Similar to the differentiator ($Xdot()$) and integrator ($INTEG()$) operators which can be performed on ordinary quantities, the new methods (`PDEQuantity_dot()` and `PDEQuantity_INTEG()`) allow performing these two operators on partial quantities.
B. Partial Derivatives
If "Q" is a partial quantity, the function Pdx(N,"Q",x) represents the derivative of "Q" with respect to spatial coordinate at position $x$. $N$ is an integral number which represents the derivative order. For example, Pdx(4,"Q",x) represents the 4th order partial derivative $\frac{\partial^4 Q}{\partial x^4}$. A partial quantity can also have a derivative with respect to time, using the attribute dt, so item Pdxdt(3,2,"Q",x) represents $\frac{\partial^3 Q}{\partial t^2 \partial x}$.
Start
Initialization phase
Start Simulation sc_strat()
Initialize Newton iteration
Scan component and PDE list to build J & RHS
Solve JΔx=RHS using LU method
Update solution
Xn=Xn-1+ ... present time point and update solution
Calculate next time point
t>T
End
Yes
No
No
No
No
No
No
Yes
Yes
... ...
Fig. 2. Simulation cycle with PDE modelling in extended SystemC-A.
Abstract base class
sc_a_system_variable
sc_a_node
quantity
sc_a_flow
Partial quantity
Fig. 3. Analogue system variables
C. Boundary Conditions
Boundary condition are declared by method Pdxdt_Boundary(). As shown in the example code above, M and N determine the order of derivative with respect to coordinate x and time t, x is the specified position where the conditions should apply and C is the right hand side value of the boundary condition equation. As an example, Pdxdt_Boundary(1, 0, ”Q", 100.0, 0.0) represents the first order derivative of Q at the user specified spatial boundary (x=100.0) is equal to 0.0.
D. PDE Formulation Method
Function PDE() realizes the automatic equation formulation of the PDEs to be modelled. This function is required to be implemented in a "for" loop and the number of loops determined by the number of segments(N_node). After providing the RHS vector will be provided in the 2nd term of the PDE() function, Jacobian matrix will be automated generated using a secant finite difference approximation which is defined in terms of system RHS(f(xj)) and a scalar Δx:
\[
J_{ij} = \frac{\partial f_i}{\partial x_j} = \frac{f_i(x_j + \Delta x_j) - f_i(x_j)}{\Delta x_j}
\]
(3)
Finally, the function matrix is solved in the embedded SystemC-A analog solver.
III. EXAMPLE: DISTRIBUTED MEMS ACCELEROMETER WITH Σ∆ CONTROL LOOP
A single axis lateral capacitive MEMS accelerometer with a Σ∆ control loop is used as an example to illustrate the SystemC-A syntax extension. Fig.4 shows the block diagram of this system.

Conventionally, the mechanical sensing element is used as a loop filter to form the 2nd order electromechanical Σ∆ accelerometer. The mechanical part of a lateral capacitive MEMS accelerometer(Fig.5) is composed of a proof mass, springs and comb fingers. In the lateral capacitive structure, the proof mass is suspended by springs and it is equipped with sense and force comb fingers which are placed between fixed fingers to form a capacitive bridge. The sense fingers moves with the proof mass resulting in a differential imbalance in capacitance which is measured. The electrostatic force acting on the force fingers is used as the feedback signal to pull the proof mass in the desired direction.
Like most conventional modelling approached, the sensing element dynamics in the sense-direction is normally modeled to reflect only one resonant mode by a lumped mass, spring,
and damper, which is represented by a simple 2nd order ordinary differential equation:
\[ M \frac{d^2 y(t)}{dt^2} + D \frac{dy(t)}{dt} + K y(t) = M a_{in}(t) + F_{feedback}(t) \tag{4} \]
where \( M \) is the total mass of the structure, \( D \) and \( M \) are damping and spring coefficients, \( a_{in}(t) \) is the input acceleration and \( F_{feedback}(t) \) is the feedback force.
Distributed mechanical modeling is important in such MEMS designs with digital control because the dynamics of mechanical components may severely affect the system’s performance. It has been well documented that sense fingers and electrodes may vibrate due to their own performance. It has been well documented that sense fingers in lateral capacitive accelerometers may vibrate due to their own performance, rendering the feedback excitation ineffective, thus causing an incorrect output and a failure of the system [6]. This failure scenario cannot be modeled by the conventional mass-damper-spring model 2nd order ordinary differential equation.
The motion of the sense beam can be modeled by the following partial differential equation (PDE):
\[ \rho S \frac{\partial^2 y(x,t)}{\partial t^2} + C_D I \frac{\partial^2 y(x,t)}{\partial x^2 \partial t} + E I \frac{\partial^4 y(x,t)}{\partial x^4} = F_e(x,t) \tag{5} \]
where \( y(x,t) \), a function of time and position, represents the beam deflection, \( E \), \( I \), \( C_D \), \( \rho \), \( S \) are physical properties of the beam: \( \rho \) is the material density, \( S \) is the cross sectional area \((W_f * T)\), where \( W_f \) and \( T \) are width and thickness of the beam, \( E \) is Young’s modulus and \( I \) is the second moment of area which could be calculated as \( I = TW_f^2/12 \) and \( C_D \) is the internal damping modulus. The product \( E I \) is usually regarded as the stiffness. Feedback force is acting on the proof mass, so the sense finger is only deformed by distributed electrostatic force and input acceleration. \( F_e(x,t) \) in the equation is the electrostatic force per unit length:
\[ F_e(x,t) = \frac{1}{2} \varepsilon W_f \left[ \frac{V_m(t)^2}{(d_0 - y(x,t))^2} - \frac{V_m(t)^2}{(d_0 + y(x,t))^2} \right] \tag{6} \]
where \( \varepsilon \) is the permittivity of the gap, \( d_0 \) is the initial gap between the sense finger and the electrode and \( V_m(t) \) is the high frequency carrier voltage.
The boundary conditions at the clamped end and the free end are shown in the following equations:
At the clamped end \((x=0):\)
\[ y(0,t) = z(t) \tag{7} \]
\[ \theta = \frac{\partial y(0,t)}{\partial x} = 0 \tag{8} \]
At free end \((x=l):\)
\[ M = -\frac{\partial^2 y(l,t)}{\partial x^2} = 0 \tag{9} \]
\[ Q = -\frac{\partial^3 y(l,t)}{\partial x^3} = 0 \tag{10} \]
where \( \theta \), \( M \) and \( Q \) denote the slope angle, the bending moment and the shear force respectively, \( l \) is the length of the finger.
The clamped end of the sense fingers moves with the lumped proof mass whose deflection \( z(t) \) could be modelled by a 2nd order differential equation Eq.(4). The total distributed sense capacitance between the sense fingers and electrodes is:
\[ C_1(t) = N_s \varepsilon T \int_0^{L_f} \frac{1}{d_0 - y(x,t)} dx \tag{11} \]
\[ C_2(t) = N_s \varepsilon T \int_0^{L_f} \frac{1}{d_0 + y(x,t)} dx \tag{12} \]
Where \( N_s \) is the number of sense fingers. The output voltage can be calculated as:
\[ V_{out}(t) = \frac{C_1 - C_2}{C_1 + C_2} V_m(t) \tag{13} \]
Where \( V_m(t) \) is high frequency carrier voltage applied on the fixed electrode in comb fingers unit.
A. SystemC-A Code for mechanical sensing element
The SystemC-A model of the mechanical sensing element present below provides an example of how the PDEs discussed above are implemented.
```
PDE_sensing::PDE_sensing(char nameC[5],
sc_signal<double>Output, sc_signal<double>input,
sc_signal<double>feedback, sc_signal<double>Vm) {
sc_PDE_base("sensing"){
PDE_CoordinateDeclaration("y","x",100-6.10,dx);
Deflection=Output; aInSig=input; feedbackSig=feedback;
VmSig=Vm;
// Quantities for lumped mass–damper–spring model
z[1]= new Quantity("z1");
z[2]= new Quantity("z2");
}
```
Fig. 6. Failure of the Sigma-Delta control is captured by the distributed model
```c
}
void PDE_sensing::build(void) {
// Parameters of sensing element
mass=3.57e−10;
spring =0.2855;
damper=1.62e−5;
d0=1.5e−6;
...
//Get input acceleration
ain=ain_sig->read();
fin=mass*ain;
//Get feedback force;
Ffeedback=feedback_sig->read();
//Get modulation voltage Vm;
Vm=Vm_sig->read();
//Deflection of proof mass(2n order ODE)
Zn[1]=X(z[1]);
Zn[2]=X(z[2]);
Zdotn[1]= Xdot(z[1]);
Zdotn[2]= Xdot(z[2]);
Equation(z[1],−Zdotn[1] + Zn[2]);
//Boundary conditions
Pdxdt_Boundary(0,0,0,Zn[1]);
//PDE function
for (x=1;x<N_node+1;x++)
{
Yn[x]=PDE_quantity("Y",x);
}
for (x=1;x<N_node;x++)
{
PDE(x,−1*ro*A*Pdxdt(0,2,"Y",x)−c+Pdxdt(4,1,"Y",x)+E1+Pdx(4,"Y",x)−((ep*A2)/(2)))*(VmAvm/(( d0−Yn[x] )
+(d0−Yn[x]))−VmAvm/( (d0+Yn[x])*(d0+
Yn[x])));
}
//Average deflection of the sense finger
Y=0.0;
for (x=1;x<N_node+1;x++)
{
Y=Y+Yn[x];
}
Y=Y/N_node;
//Write output
Deflection=>write(Y);
```
B. Simulation results
In this section, simulation results of the distributed model illustrate the distributed effects of the finger dynamics. The conventional model only contains the dynamics of the lumped proof mass as shown in Eq.(4). This means that the sense fingers and lumped mass move together and the sense fingers do not bend. The frequency is approximately:
\[ w_0 = \sqrt{\frac{K}{M}} \]
(14)
In reality, the sense fingers tend to the extent that the performance of the Sigma-Delta control loop might be seriously affected. The first two resonant frequencies of a sense finger could be calculated as those of the cantilever beam [6]:
\[ \omega_i = \alpha_i^2 \frac{W}{L^2} \sqrt{\frac{E}{12\rho}} \quad i = 1, 2 \]
(15)
\[ \alpha_1 = 1.875 \quad \alpha_2 = 4.694 \]
(16)
Where W and L is the width and length of the sense fingers respectively. First and second resonant frequencies are 31KHz and 209KHz respectively if the finger dimensions are: \( L = 190\mu m \), \( W = 1\mu m \), \( T = 2\mu m \). The effect of the sense finger dynamics are illustrated in Fig.6 which shows the power spectrum density (PSD) of the Sigma-Delta modulator output bitstream and time-domain response when applying 200Hz sine wave input acceleration with 1G(9.8m/s²) amplitude and 2¹¹Hz oversampling frequency to both conventional and proposed distributed system.
Here, the SystemC-A simulation carries out the time-domain analysis and in the testbench performs a frequency domain FFT analysis to obtain PSD of the output bitstream. As shown in the Fig.6(b), the failure of the Sigma-Delta control system is captured by the distributed model while the Sigma-Delta control loop still works in the conventional model (Fig6(a)). This is because the lumped model only contains one resonant mode caused by the spring-mass-damper system and its frequency response has no relationship with the dimensions of fingers. Thus, effects of the finger dynamics cannot be captured. In other word, this performance degradation of the Sigma-Delta control loop caused by finger dynamics cannot be modeled by lumped model.
IV. Conclusion
This paper proposes a syntax extension to SystemC-A to provide support for PDE modelling. This is the first full implementation of PDE support in SystemC-A where no preprocessor is required for conversion of user defined PDEs to a series of ODAEs. The proposed PDE extension has particular advantages in modelling of mixed physical-domain systems, especially systems with mechanical parts which frequently exhibit distributed behaviour. Typical systems of this kind are MEMS sensors or kinetic energy harvesters. The distributed effects present in such systems usually can not be neglected, may even play vital roles and be essential to predicting correctly the system’s performance. The efficiency of the new syntax has been verified by its application to an electromechanical Sigma-Delta accelerometer with distributed mechanical sensing element where the sense finger dynamics are modeled using a PDE. The well-known failure of the Sigma-Delta control system caused by the sense finger dynamics is correctly captured by the extended SystemC-A model while the conventional lumped model fails to reflect the true behaviour.
REFERENCES
|
{"Source-Url": "https://past.date-conference.com/proceedings-archive/PAPERS/2011/DATE11/PDFFILES/10.4_3.PDF", "len_cl100k_base": 4878, "olmocr-version": "0.1.53", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 24134, "total-output-tokens": 6178, "length": "2e12", "weborganizer": {"__label__adult": 0.000713348388671875, "__label__art_design": 0.0008358955383300781, "__label__crime_law": 0.0006322860717773438, "__label__education_jobs": 0.0007252693176269531, "__label__entertainment": 0.0001475811004638672, "__label__fashion_beauty": 0.0003247261047363281, "__label__finance_business": 0.0003418922424316406, "__label__food_dining": 0.0006556510925292969, "__label__games": 0.0007615089416503906, "__label__hardware": 0.0157470703125, "__label__health": 0.0012359619140625, "__label__history": 0.0005216598510742188, "__label__home_hobbies": 0.0002386569976806641, "__label__industrial": 0.0024394989013671875, "__label__literature": 0.00027489662170410156, "__label__politics": 0.0005292892456054688, "__label__religion": 0.0008873939514160156, "__label__science_tech": 0.4638671875, "__label__social_life": 0.00011163949966430664, "__label__software": 0.006481170654296875, "__label__software_dev": 0.49951171875, "__label__sports_fitness": 0.00060272216796875, "__label__transportation": 0.0020198822021484375, "__label__travel": 0.00030684471130371094}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 21666, 0.03717]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 21666, 0.60368]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 21666, 0.83131]], "google_gemma-3-12b-it_contains_pii": [[0, 4770, false], [4770, 7777, null], [7777, 10669, null], [10669, 14845, null], [14845, 15986, null], [15986, 21666, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4770, true], [4770, 7777, null], [7777, 10669, null], [10669, 14845, null], [14845, 15986, null], [15986, 21666, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 21666, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 21666, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 21666, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 21666, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 21666, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 21666, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 21666, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 21666, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 21666, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 21666, null]], "pdf_page_numbers": [[0, 4770, 1], [4770, 7777, 2], [7777, 10669, 3], [10669, 14845, 4], [14845, 15986, 5], [15986, 21666, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 21666, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
1944b6428f2800f840c6aaa4ff8be60d9be157e2
|
ABSTRACT
With the drastic reduction in price of fast memory, database systems have begun to favor its use over the use of traditional hard disk storage. However, although this increased use has led to the development of systems that have been able to achieve previously inconceivable throughput, the volatile nature of the storage layer has negatively impacted the durability of a system. Several checkpointing mechanisms have been developed to periodically write snapshots of the contents of main-memory to stable storage and prevent data loss in case of power outages, server attack, or other disruption. However, many of these schemes rely on the infrequent occurrence of these snapshots, triplication of the data layer, and physical points of consistency in the system. We discuss herein a checkpointing scheme which relies on the guarantee of a predetermined serial ordering to capture snapshots of the in-memory storage layer with a mere ten to fifteen percent reduction in total transactional throughput and at most a duplication of memory’s contents. This work is extended from research performed on Calvin, an architecture for a distributed storage system that relies on a deterministic ordering guarantee to support distributed transactions, while maintaining linear scalability and having no single point of failure.
1. BACKGROUND AND INTRODUCTION
Traditional database tautology has sought to ensure that any database system maintains so-called ACID-compliance. This model seeks to ensure that all transactions processed in a storage system are atomic, consistent, isolated, and durable [1]. The final characteristic, durability, refers to the fact that any transaction that has been committed to the database must be recoverable in the event of a node failure [8].
The increased availability and dramatically reduced cost of high-speed random-access memory, which is generally several orders of magnitude faster than hard disk storage, has resulted in the widespread use of database systems that are executed mostly or entirely in main memory [6]. In order to avoid data loss that necessarily occurs when volatile memory is reset during a node failure, several checkpointing protocols have been developed to periodically write the contents of memory to disk. ARIES [11], often considered the golden standard for checkpointing, uses write ahead logging along with redo logging and logical undo operations to recover a node that has experienced some form of failure. Recent improvements on this highly generalized method for database recovery have focused on leveraging specific aspects of the system they operate in to reduce the amount of time spent capturing a global snapshot. For example, Cao et. al discuss Ping-Pong and Zig-Zag [3], systems that achieve extremely short checkpoint periods in frequently consistent applications. However, this protocol relies heavily on the assumption that the database is guaranteed several instances in time where all transactions are committed and no effects of uncommitted transactions are reflected in the data layer. These are referred to as “physical points of consistency” and, although often found in common applications such as massively multiplayer online games, limit the frequency with which checkpoints can be captured.
Simultaneously, several popular distributed storage systems have begun to depart from consistency guarantees across replicated data centers. These products, including Google’s BigTable [4], Amazon’s Dynamo [5], and Facebook’s Cassandra [9], use the CAP theorem [7] to explain their non-compliance with desired ACID properties. This theorem states that reduced guarantees in cross-replication consistency are the only manner in which the system can remain globally available around the clock. Reduced guarantees of consistency in a distributed, multiply replicated system further complicate the ability to capture a global snapshot.
However, recent work has signaled a return to traditional views on the need for databases, even those replicated and distributed, to be ACID-compliant. Calvin [12][13], the distributed and synchronously replicated storage system this checkpointing scheme is implemented as part of, achieves global consistency through a replication of inputs rather than effects, avoiding the prohibitively expensive contention costs that had previously impeded the prevalence of systems supporting
Our protocol is based loosely on work developed on multi-versioned “historical queries” in the HARBOR [10] recovery and failover system, as well as the notion of points of consistency exploited by Ping-Pong and Zig-Zag[3]. We present herein a method where, when a serial ordering of transaction inputs is guaranteed, global system checkpoints can be captured without stopping the database’s execution, while only requiring at most a duplication of the storage layer. Furthermore, because the protocol relies on guarantees of a serial transaction ordering, only a “virtual” point of consistency is required, rather than a precise moment in time at which the entire data layer is consistent.
In section 2, we discuss the detailed design for the novel checkpointing scheme. Section 3 discusses how the prototype for the scheme was developed and section 4 discusses the prototype’s impact on total transactional throughput in Calvin. We discuss the work planned for this project during the Spring in section 5. In section 6, the experience of conducting this research in the context of the Special Projects course is discussed. Finally, in section 7, we conclude.
2. CHECKPOINTING IN CALVIN
The capability for a database system to handle failure, for example due to power outages or accidental server interrupts, is absolutely vital to its operation. Deterministic database systems have two basic advantages that greatly facilitate fault handling. First, highly replicated deterministic database systems enable “active replication,” so that the same transaction processing can happen entirely in parallel across replicas without direct communication between the replicas. As long as replicas receive the same inputs, they can process transactions independently and not diverge. This enables on-the-fly failover to a replica upon a failure.
Second, since transactional input is sufficient to entirely determine the final state of a database, only the transactional input must be logged (instead of the high overhead physical REDO logging presents in most modern database implementations). Replaying history of transactional input is therefore sufficient to recover the database system to the current state (transactional input is logged during the process in the sequencer that synchronously replicates the global transaction sequence). However, it is inefficient to replay the entire history of the database from the beginning of time upon every failure. Therefore, it is necessary to occasionally checkpoint the state of a database in order to provide a starting point for the history replay.
2.1 Protocol Architecture
With an agreed upon global serial order to which replicas are guaranteeing execution equivalence, the work
Figure 2: Execution of Checkpointing Protocol in Calvin
by Cao et. al. [3] can be applied even though there may never be a strictly physical point of consistency. Rather we can establish a virtual point of consistency at an arbitrary point in the global serial order, and capture a snapshot with regard to that demarcation. Intuitively, we can imagine a virtual point of consistency in a transactional database as a guarantee, stating that for some physical point in time \( P_1 \), all transactions that have an ID less than some specified value \( T_1 \) will have been committed to the database. Several transactions may still be in the middle of execution at this point in time, but the value of any record in the database at or before \( T_1 \) is stable.
We can therefore implement a checkpointing scheme similar to Zig-Zag. Although the specifics of the data layer are flexible, it is easiest to visualize the database as an associative key-value store where values may be chained. As shown in figure 2, the data layer receives in-place updates and overwrites the singular value maintained at \( Key \), similarly to any current storage system. Section (b) shows the value at \( Key \) after being updated from a value specified by transaction one \( (T_1) \) to a value specified by transaction two \( (T_2) \).
Now, assume that at some arbitrary time before \( T_4 \) begins executing that some control layer announces to the database that it should prepare for a checkpoint to occur at the virtual time represented by \( T_4 \). Any value updated by a transaction preceding \( T_4 \) or \( T_4 \) itself is updated in-place. However, as is shown in section (d), when a transaction following \( T_4 \), such as \( T_5 \), attempts to update the value at \( Key \) it is merely prepended to the chained list. Subsequent updates to \( Key \) overwrite this value, resulting in the maintenance of at most two values for any key (namely a stable version to be written to the checkpoint, and an unstable one).
At some unspecified later point in time, as depicted in section (f), the control layer announces to the database that it should begin a capture of the checkpoint. Upon receiving this message, the datastore accepts it as fact that the virtual point in time represented by the checkpoint it has been preparing for has passed. Because this is the paradigm followed, Calvin’s sequencer served as the control layer. The sequencer, as part of its duties, keeps track of when specific transactions have finished executing. Therefore, it can announce with certainty when it is guaranteed that a specific transaction has been fully committed or aborted.
Once the “capture” message has been received from the control layer, the database spawns an asynchronous writer, as shown in section (g), that begins placing the values at each key onto a stable media. It is important to note that although the writer is interacting with the database layer, the presence of a stable and unstable version precludes the need to acquire locks when capturing the snapshot. As shown in section (h) of figure 2, if a transaction, say \( T_7 \), updates the value at \( Key \) that update occurs normally, affecting only the unstable value in the chained pair.
Finally, the asynchronous writer is responsible for pruning the value of each key captured after it is finished writing to disk. Note that this pruning only occurs if there is a stable and unstable version of the key. If no unstable version exists then the stable version must not be pruned so that reads can proceed as normal.
2.2 Failover and Recovery
Using the system checkpoint, failover and recovery of a node is trivial. Given the failure of a single node in a single replica, the system routes all read requests within that replica to a nearby replica. When the failed node comes back online, it restores its state using the most recently captured checkpoint, and then uses the input transaction sequence to replay the history of all transactions that modify the state of the node until the node is caught up.
3. IMPLEMENTATION
The entire system was implemented as an extension of the Calvin storage layer. Calvin uses a simple std::unordered_map to keep track of an associative key-value store that represents the database. The checkpointing scheme was implemented as an abstracted component that contained a reference to the current Storage and operated on it. However, it is easiest to conceptualize the checkpointer as an interface that intercepted CRUD calls and modified the data layer accordingly.
Figure 3 shows relevant pseudocode for the implementation of our checkpointing scheme. It is important to observe that the checkpointer and control layer interact via a publish-subscribe model in order to promptly handle changes in the status of the current snapshot capture. Lines 3 and 5 of the Sequencer::HandleCheckpointing method show the calling thread having to wait on the checkpointer to provide a notification in order to proceed. The notification for the latter event is provided in line 5 of Storage::CaptureCheckpoint.
Figure 4 provides an event-based visualization of how the checkpointer intercepts CRUD commands and dispatches them to the proper storage layer. Although the Delete method is typically only called by the application to delete unstable keys, we maintain a time-versioned implementation of Delete so that the asynchronous writer can make a simple call to this in order to prune the extra storage during the checkpoint process.
4. EXPERIMENTAL RESULTS
As discussed in Section 1, ensuring that checkpoints of the database can be captured with only a modest
reduction in total transactional throughput is crucial. Figure 5 shows that our implementation of checkpointing, requiring an asynchronous writer and two versions of any data record, does not reduce our throughput to an unacceptable level.
When the checkpoint period begins, we notice an appreciable decline in total throughput, corresponding to an approximately twenty percent reduction in total throughput. Much of this can be attributed to the overhead associated with initializing the asynchronous writer’s thread, which is not efficiently garbage collected in our implementation. It should be noted that this level of throughput is the lowest that is ever reached by our system. In fact, halfway through the checkpointing period, the database system is operating at only a ten percent reduction in total throughput.
Finally, writing stable values to storage asynchronously does not increase contention or latency appreciably. Because the asynchronous writer is only processing data items that cannot be accessed by the mutator thread, both the mutator and checkpointing threads can retrieve a pointer to the multi-versioned linked-list record simultaneously and modify one of its versions.
What has made the use of such asynchronous workers so appealing is the fact that several machines are currently designed with more cores than can possibly be utilized by large database systems, and so performing the asynchronous actions on a newly spawned thread results in a negligible footprint. In fact, the problem of wasted cores is exacerbated in Calvin, where contention due to locks can be so high that the total throughput actually decreases when too many threads are allocated to perform mutation. Moreover, due to the ability of Calvin to scale near-linearly, it is highly logical to shard the storage onto several commodity nodes that can allocate extra threads to continual checkpointing. Capturing these continual checkpoints is essential, since these commodity nodes are far more likely to fail than high-end hardware. Furthermore, our scheme limits checkpoints only to the rate at which they can start and stop, so performing continual checkpoints does not present an issue.
5. FUTURE WORK
Several things remain to be completed during the Spring. First and foremost, the protocol established herein will have its implementation completed. Due to time constraints related to the submission of our architecture to SIGMOD, only a simple, proof-of-concept implementation was able to be programmed. Furthermore, the scheme must be compared to thorough implementations of standard checkpointing methods such as Ping-Pong and Zig-Zag to establish its relative performance.
Storage::ReadObject(Key, VirtualTimestamp) {
1: if VirtualTimestamp < VConsistentPoint_ then
2: return stable-value Key
3: else
4: return current-value Key
5: end if
}
Storage::PutObject(Key, Value, VirtualTimestamp) {
1: if VirtualTimestamp < VConsistentPoint_ then
2: update-stable-value Key, Value
3: else
4: update-current-value Key, Value
5: end if
}
Storage::PrepareForCP(VirtuallyConsistentPoint) {
1: VConsistentPoint_ = VirtuallyConsistentPoint
}
Storage::CaptureCheckpoint() {
1: for each Key in Datastore do
2: StableValue = Storage->ReadObject(Key, VConsistentPoint_)
3: write-to-disk Key, StableValue
4: end for
5: NotifySequencer()
}
Sequencer::HandleCheckpointing() {
1: loop
2: Storage->PrepareForCP(TransactionNearInFuture)
3: WaitForTransactionNearInFutureToPass()
4: Storage->CaptureCheckpoint()
5: WaitForStorageNotification()
6: end loop
}
Figure 3: Checkpointing Pseudocode
Although it is mentioned that recovery and failover are trivial, it is still important to create an actual implementation of failover and recovery to confirm the hypothetical ease with which they can be programmed. In addition to proving that implementing recovery and failover is simple and not prohibitively expensive, it would be excellent if we had time to explore the possibility of implementing intelligent online failover algorithms. For example, in a multiply replicated storage system, it would be important to determine not only where remote reads sent to a failed node should be rerouted to, but exactly what the minimum work that can be done in rerouting is, and if certain remote reads can be avoided.
Furthermore, several optimizations to the partially completed checkpointing scheme presented herein could be implemented. When the asynchronous writer begins searching through the versioned data layer for values to write to disk, at a bare minimum it need only capture those values that have been modified since the last checkpoint capture. The addition of so-called “dirty-bits,” which would indicated whether a record had been modified since the last snapshot was captured, could be added to each record to decrease the amount of time spent performing slow disk writes. Another version of this check would use a bloom filter [2] to quickly determine whether or not it was likely that the value at a given key had been updated. This implementation would test whether the time gained by the fast hash was greater than the amount of time spent writing false positives to stable storage.
6. RESEARCH EXPERIENCES
The experience of conducting this research as part of the Computer Science Special Projects course was excellent. I had begun work on Calvin during the Spring of my junior year, so being able to jump back into a project and immediately begin making contributions was incredibly exciting. However, in recommending this course to fellow seniors I would caution them to do as I did and pick an area of research that they already possess a considerable amount of knowledge about. Each semester at Yale goes by incredibly quickly and if, in addition to creating a prototype of sufficient importance, a person had to get formally acquainted with an unknown subject in Computer Science, the Special Projects course could very quickly become overwhelming.
6.1 Code Maintenance
The entire codebase for this project is maintained via a Gerrit repository available online to contributing members. Automatic documentation, generated by Doxygen, is also available online to project contributors. Being able to undergo actual code review with my peers has been an extremely edifying and rewarding process. It has helped achieve a personal goal of utilizing this Special Project as a means by which I can become a more efficient, skilled programmer.
6.2 Conference Paper Submission
Although not required for the Special Projects coursework, as part of this research our group submitted a paper to the proceedings of SIGMOD. This, although a
stressed experience, allowed me to keep my research in perspective and find a greater, more impactful meaning for what I had spent the entire term working tirelessly on. I would recommend to my peers that, when taking this course, they attempt to work on a project that will likely be part of a conference paper submission so that their research can be framed in a meaningful context and be compared against the work of respected leaders in the field.
### 6.3 Issues Encountered
Several issues were encountered throughout the course of this research project. First and foremost, the system on top of which the checkpointing scheme was developed, the Calvin prototype, was extremely unstable. Making the system stable enough so that snapshots could actually be captured and accurate data about total throughput recorded consumed most of the time working on this project.
At the implementation level, one of the major issues was, and will continue to be, how to provide a proper comparison to the Ping-Pong and Zig-Zag checkpointing methods. At its core, Calvin uses a simple `tr1::unordered_map` to represent an associative key-value store. However, both Ping-Pong and Zig-Zag rely on the use of in-memory byte-arrays, which have significantly higher random access times. These will need to be reconciled during the research period in the Spring.
### 6.4 Lazy Evaluation of Writes
This report constitutes an interim report for progress on a year-long body of research into novel methods for desirable database extensions such as checkpointing. In the Spring, however, not only will the research on our novel checkpointing scheme be finalized and submitted to the proceedings of VLDB, separate research on lazy evaluation in a data system will, if time permits, be conducted.
For this secondary project, we aim to measure the effects that lazy evaluation in a database has. The motivation for this is slightly hyperbolic, but could be generalized to several common use cases. Assume that an individual runs an online holiday shop that receives several tens of millions of transactions during the month of December, but only one million transactions during the other eleven months of the year. In this case, the total throughput of the database with respect to writes and in-place updates must be extremely elastic. Consider a transaction that specified, for given records \( x \) and \( y \) at time \( t \), that the value at \( x \) should be set to \( x + y \). Traditional systems would perform two queries to obtain the values of \( x \) and \( y \), sum their values, and update the value at \( x \) to reflect the sum. However, using a multi-versioned store we can reduce the total queries required in performing the in-place update by simply placing a lambda representing \( x_t + y_t \) into the multi-versioned row \( x_{t+1} \). Then, only when a read of \( x_{t+1} \) is performed is the actual value computed and placed into record \( x_{t+1} \). The ability to reduce the total number of queries required for in-place updates or writes would drastically improve the total throughput of the system for, say this holiday shop during December.
The implementation of the aforementioned system is, however, not trivial. Several considerations need to be taken into account including:
- How are a transaction’s effects and all dependent lambdas rolled back when an abort occurs?
- Is a reference counter necessary to prevent the storage size from exploding?
- How would the reference counter be updated quickly and atomically?
If time allows this system would be implemented and these questions investigated and, hopefully, solved.
### 7. CONCLUSION
We have presented a novel method for checkpointing that requires at most a duplication of the data layer, captures a checkpoint with a modest ten to fifteen percent reduction in total transactional throughput, and does not require a physical point of consistency. The prototype was implemented in the context of the Calvin codebase assembled for experimentation, as documented in [12].
It is important to note that although only demonstrated on Calvin, this protocol can be run on any storage system that has guarantees about the monotonically-increasing nature of transaction completion time. It remains extremely important to perform more research in the future into whether this scheme can be generalized to transaction processing systems that interleave database reads and writes, and therefore have no guarantees of monotonically-increasing times of completion.
As the cost to produce memory becomes cheaper and cheaper the pervasiveness of data storage systems that rely partially or entirely on storing records in volatile media will increase. In these systems, checkpointing is perhaps the most vital component to be integrated into the system so that data loss due to node failure is kept at an absolute minimum and overall time spent performing recovery and failover is decreased, improving the system’s availability. I look forward to continuing this line of research next semester.
### 8. ATTRIBUTION AND THANKS
Thanks are due to my thesis advisor, Professor Abadi, for his continued support on this project. Moreover, thanks to Alex Thomson, Philip Shao, Kun Ren, and...
Shu-Chun Weng for their tireless work on completing the Calvin prototype.
9. REFERENCES
|
{"Source-Url": "https://zoo.cs.yale.edu/classes/cs490/11-12a/diamond.thaddeus.tcd2/report.pdf", "len_cl100k_base": 4808, "olmocr-version": "0.1.53", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 21529, "total-output-tokens": 6022, "length": "2e12", "weborganizer": {"__label__adult": 0.00038695335388183594, "__label__art_design": 0.0003714561462402344, "__label__crime_law": 0.00041556358337402344, "__label__education_jobs": 0.00154876708984375, "__label__entertainment": 9.882450103759766e-05, "__label__fashion_beauty": 0.00020456314086914065, "__label__finance_business": 0.0003266334533691406, "__label__food_dining": 0.0004546642303466797, "__label__games": 0.0006160736083984375, "__label__hardware": 0.002323150634765625, "__label__health": 0.0009431838989257812, "__label__history": 0.0003707408905029297, "__label__home_hobbies": 0.00016188621520996094, "__label__industrial": 0.0005831718444824219, "__label__literature": 0.0003712177276611328, "__label__politics": 0.00028634071350097656, "__label__religion": 0.0005397796630859375, "__label__science_tech": 0.14990234375, "__label__social_life": 0.00011807680130004884, "__label__software": 0.009124755859375, "__label__software_dev": 0.82958984375, "__label__sports_fitness": 0.0003345012664794922, "__label__transportation": 0.0007824897766113281, "__label__travel": 0.00022554397583007812}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27192, 0.02909]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27192, 0.42622]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27192, 0.92923]], "google_gemma-3-12b-it_contains_pii": [[0, 4403, false], [4403, 7132, null], [7132, 7188, null], [7188, 12788, null], [12788, 15470, null], [15470, 19430, null], [19430, 24685, null], [24685, 27192, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4403, true], [4403, 7132, null], [7132, 7188, null], [7188, 12788, null], [12788, 15470, null], [15470, 19430, null], [19430, 24685, null], [24685, 27192, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27192, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27192, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27192, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27192, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27192, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27192, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27192, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27192, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27192, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27192, null]], "pdf_page_numbers": [[0, 4403, 1], [4403, 7132, 2], [7132, 7188, 3], [7188, 12788, 4], [12788, 15470, 5], [15470, 19430, 6], [19430, 24685, 7], [24685, 27192, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27192, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
585c572a8425ae86f5fddb5007b603f55e19c4cc
|
Modeling, Validation and Continuous Integration of Software Behaviours for Embedded Systems
Vladimir Estivill-Castro
School of ICT
Griffith University
Nathan Campus, 4111, Australia
Email: v.estivill-castro@griffith.edu.au
René Hexel
School of ICT
Griffith University
Nathan Campus, 4111, Australia
Email: r.hexel@griffith.edu.au
Josh Stover
School of ICT
Griffith University
Nathan Campus, 4111, Australia
Email: joshua.stover2@griffithuni.edu.au
Abstract—We propose to test software models with software models. Model-Driven Software Development proposes that software is to be constructed by developing high-level models that directly execute or generate most of the code. On the other hand, Test-Driven development proposes to produce tests that validate the functionality of the code. This paper brings both together by using Logic-Labeled Finite-State Machines to deploy executable models of embedded systems and also to configure the corresponding tests. The advantage is a much more efficient validation of the models, with more robust and durable representations, that ensure effective and efficient quality assurance throughout the development process, saving the costly exercise of formal model-checking until the system is complete enough to meet all requirements.
Keywords—Software Models, Real-Time Systems, Test-Driven Development, Model-Driven Development, Validation and Model-Checking, Finite-State Machines.
I. INTRODUCTION
Gartner estimates the value of the Internet of Things (IoT) to be $300 billion by 2020. IDC’s prediction is that the current worldwide market for the IoT will grow from $1.9 trillion in 2013 to $7.1 trillion in 2020. This is just one more illustration of the pervasive and ubiquitous presence of interconnected digital controllers and embedded systems surrounding all aspects of human life. The processors in these systems are becoming more powerful and the demand for behaviour sophistication is resulting in more complex software in all sorts of systems. Kopetz [1] has highlighted the impact on industry, life-style, energy production and consumption, and naturally the massive implications for safety and security that worldwide networking of smart systems and smart objects is bringing. Even medical devices and health systems are now included part of the smart planet [1] despite there have been recent articles highlighting potential risks [3], [4]. Sadly, more and more system failures and software faults are being reported, many of which affect safety-critical systems. Recent examples that have gained significant media attention include the security risks in some Range Rover models that enable unauthorised individuals to gain control of the vehicle remotely. Earlier, reported faults in the “ConnectedDrive” technology of over 2 million BMW, Mini and Rolls Royce cars made it possible for unauthorised persons to unlock their doors.
The difficulty to scale up model-checking technologies to the complex behaviours that are now expected in smart objects and devices makes it imperative to find mechanisms to validate and establish their safety. To quote Kopetz [1]:
“The pervasive deployment of smart objects that collect data and control the physical environment from distance poses a severe challenge to the security and safety of the world and the privacy of our lives.”
Despite their increasingly complex structure, the systems integrated into the IoT, by their very nature, are real-time systems. Several scholars have alerted to the serious challenges posed by the delicate timing issues [2].
“A new economy built on the massive growth of endpoints on the Internet will require precise and verifiable timing in ways that current systems do not support.”
This becomes even more critical due to the increasing use of such systems in a safety-critical context. On May 1st, 2015, for example, the FAA issued an airworthiness directive for Boeing’s 787 because a software bug shuts down the plane’s electricity generators every 248 days:
“all four GCUs will go into failsafe mode at the same time, resulting in a loss of all AC electrical power regardless of flight phase”.
Three key approaches by the software engineering community stand out when responding to the challenges of producing more versatile software that synthesises the behaviour of such embedded systems, in particular, Model-Driven Software Development (MDSD), Test-Driven Development TDD and Continuous Integration (CI). In this paper, we incorporate these three ideas by modelling and testing models with logic-labeled finite-state machines (LLFSM). Use of arrangements of LLFSMs is a MDSD approach, which has proven to be very effective [5], [6] as it scales from embedded systems to robotic systems [7]. Moreover, this not only produces compiled/executeable software directly from high-level models (as opposed to, e.g., Event-B [8]), but also facilitates formal verification with model checking [9]. However, model-checking is still a laborious exer-
cise, not only because of the complex strategies required to minimise combinatorial explosion [10], but also because formulating the statements to formally verify human-language requirements is non-trivial. For example, the NuSMV model-checker supports CTL and LTL as the mechanisms to express the properties for verification. It is complex to accurately express (often ambiguous) requirements written in natural language as these formalisms. Thus, the danger is that what is verified is an incorrectly formulated property that does not properly reflect the original requirement [12]. Although logic-labeled finite-state machines deliver deterministic sequential models that minimise the state-explosion of model-checking [10], to facilitate composability and scalability of complex systems underpinning the IoT, it is important that validation mechanisms can be performed early and incrementally on the executable system.
Thus, in addition to formal verification, it is natural to detect faults in software systems through simulation and validation, as part of CI, avoiding the costly exercise of formal model-checking upfront. Testing is a cost effective approach to early and continuous software quality assurance. However, we point out that successful testing alone is not definite verification as tests themselves may have faults and typically validate a smaller set of situations or traces. This is particularly important in the context of safety-critical real-time systems where code coverage of tests constitutes only one dimension. The other (often overlooked) dimensions are value coverage and timing coverage at the component and system level. Moreover, traditional unit testing frameworks do not integrate well with finite-state machines, necessitating different approaches for testing and validation [13].
We propose a method for the validation of models that are systematically constructed from high-level requirements. To this end, we utilise LLFSMs in our design. Perhaps more interesting is that the tests themselves are now constructed using logic-labeled finite-state machines. The environment, the sensors, and the actuators that surround the system being validated and defined by an arrangement of LLFSMs are also simulated by LLFSMs. Moreover tester-LLFSMs are used to reproducibly construct the scenarios under scrutiny in a test. This testing is also incorporated into a continuous integration server; thus, any updates or extensions to the behaviour are continuously validated automatically.
We demonstrate our approach with two case studies widely used within the software engineering and real-time systems literature. First, the microwave oven as software models of its behaviour not only appear in the literature of software modelling [14], [15], [16] but also appear in discussions on behaviour engineering [17]. This allows us to show validation and construction of tests for continuous integration in the value domain, similar to what is achievable using CTL and LTL formalisms. However, for systems that demand verification on statements regarding response time (commonly real-time systems), model-checking demands more complicated formalisms [18] that very quickly become too complex to model, modify, or maintain, in stark contrast to the promise of simplicity of high-level executable models.
To demonstrate testing and continuous integration within the time domain our second safety-critical case study is a pacemaker; also previously studied in the field of formal verification of real-time systems [19], [20].
II. FIRST CASE STUDY
A. Accelerating validation using GUIs
We first demonstrate the applicability of LLFSMs for TDD, MDSD and CI with the example of the One Minute Microwave. Because testing embedded devices demands deployment of the software onto the device in order to use the actual hardware, and a human operator to go through the test procedure (see Figure 1), the idea of MDSD with a graphical user interface (GUI) to emulate the device has been a subject of recent interest [21]; not only for automated testing and validation, but also user testing (Figure 2). The approach follows the model-view-controller (MVC) paradigm. The behaviour is described by LLFSMs, which constitutes the controller component of the MVC pattern. The status of the system is stored on a blackboard and constitutes the model in MVC. The view is the GUI simulating the hardware UI. The advantage of this scenario is that the design of the device itself can be evaluated in software, and the software (the arrangement of LLFSMs) does not change when it is ported to the actual embedded system (again, the software defining the behaviour and developed using MDSD is the same in Figure 1 and in Figure 2). Nevertheless, in
these figures, the box labeled MODEL is a software model; and in particular, an arrangement of finite-state machines that describes and defines the behaviour of the system. In the case study here, the GUI has been built with Qt Creator and communication uses control/status messages. We forward the status of buttons, or any widget in the GUI that produces input, to the arrangements of LLFSM and post control messages to modify the status of any widget in the GUI we require to update.
Creating GUIs for validating the enables performing usability testing and users to participate in refinement of the requirements. Moreover, the users can visualise the behaviour because of the diagrammatic display of states and transitions provided by the model. A video\(^1\) demonstrates this with a very simple GUI whose purpose is just to provide the motors and the effectors for the microwave. In fact, engaging user groups with the GUI results in requirements that deviate from the original ones as follows:
“When cooking has been paused by opening the door, most microwaves do not restart immediately when the door is closed, but further confirmation is required by pressing a start button.”
However, the purpose of this paper is to take this much further to automatic testing and CI (see Figure 3). The usability testing approach still demands the involvement of a human operator, and thus cannot support TDD. Moreover, any testing by humans has non-positivist elements, making them a lot less suitable for system testing, particularly when it comes to verifiable predicates and functionality. Such systematic testing is best performed by automatic means that re-execute all tests when updates are incorporated into the software code base. This is the main contribution of CI.
B. The applicability of LLFSMs for TDD, MDSD and CI
In the case of TDD and CI, as with the GUI approach there is no hardware. The sensors are activated by the tests depositing status messages in the middleware. The actuators are observed by the control messages that the executable software model produces. However, here the tests themselves are LLFSMs, executed as part of the project-building infrastructure. The executable software model of the microwave consists of an arrangement of four LLFSMs that execute in a single thread, as described earlier [10].
We now illustrate how models can test models. In this initial example, let’s examine an executable software model (Figure 4) that constitutes a test of the requirement that when
“the microwave is not cooking, opening the door turns the light on while closing the door closes the light of.” [10]
We emphasise that the software being tested does not change, neither the test but as explained before, we can use the middleware to translate I/O pin signals for GUI-testing or for a simulated microwave with an NXT, as per the video mentioned before. Figure 4 shows the LLFSM that manifests this requirement as a test. This test consists of a SET UP phase (indicated by the Initial state and SET_DOOR_CLOSED state). In the Initial state the TIME_LEFT pin is set low (the oven is not cooking). The SET_DOOR_CLOSED state is part of the SET UP so the pin indicates the door is closed. Recall that there is no actual hardware, the LLFSM in Figure 4 is acting as an environment for the tested software and has set a context where the door is closed and no time has been accumulated. This should turn the light off, and thus, if the light is still on after 50ms, the tester LLFSM has detected a fault in the control software of the microwave (transitioning to FAIL_LIGHT, which exits with a failure code). If the light is not on, then !digitalRead(PIN_LIGHT) is true and the tester LLFSM moves to the state TEST_LIGHT_ON_DOOR_OPEN. In this state a signal is placed on the pin that the door is open. As before, if the light does not come on after 50ms, the tester arrives at the terminating FAIL_LIGHT state. If the light does come on, the tester transitions to the state TEST_LIGHT_OFF_DOOR_CLOSED. In this state, the pin is set to indicate a closed door. For the third time, the light is tested, and if the light does not go off in 50ms, the state FAIL_LIGHT is reached. Only if all required behaviours happen, this tester LLFSM arrives at the state
---
\(^1\)www.youtube.com/watch?v=vtjevr4ZXms
The exit values of executing this tester LLFSM are used by the Jenkins infrastructure that evaluates the software compiling the system for several operating systems and cross compilers (cross-compiling for the Arduino as well as clang under MacOS and Linux). Makefiles and the Jenkins environment ensure that build and test targets in the project get re-run on any update to a LLFSM, guaranteeing that required-of behaviour is automatically re-tested against all the tests (see Jenkins documentation for this). Our contribution here is that executable models are testing executable models.
In the literature of model-checking [22, Page 39] this case study is discussed because the safety feature of disabling radiation when the door is open is an analogous to the requirement on the Therac-25 radiation machine, where a failure to properly enforce it caused harm to patients. Thus, to continue the illustration, Figure 5 shows an executable model as a LLFSM that tests this requirement. Note that transitions now have strict Boolean expressions regarding the status of the motor. For example, the transition for the state TEST_MOTOR_ON to the state TEST_MOTOR_OFF is labeled with the expression !digitalRead(PIN_MOTOR), which evaluates to true if the I/O pin for the motor is off and is false otherwise. The CI infrastructure performs these two tests systematically and repeatedly every time there is an update to any component.
C. Contrast with formal model-checking
We do not advocate the exclusion of model-checking, but we take this opportunity here to contrast already this with the generation of tests proposed here. First, the construction of tester LLFSMs is rather intuitive and corresponds very closely with the use cases and the requirements. The essentially linear story of the use case appears reflected in the tester LLFSM for the corresponding use case. We emphasise that requirements and use cases are usually presented as a linear time-trace; so much so that behaviour engineering with behaviour trees [17] builds the specification one trace at a time. In this example the story line of for the cooking being halted when the door opens is as follows.
1) First we need to have the door closed and put time on the microwave with the button.
2) Second, we open the door and the motor stops.
3) Third, closing the door resumes the cooking.
Such a story line produces a pattern in the tester LLFSM. For a story line where the environment produces a sequence of inputs \( \langle I_1, I_2, \ldots, I_n \rangle \) and that results in state changes in the system observable by responses \( \langle R_1, R_2, \ldots, R_n \rangle \), we have a simple structure for the tester LLFSM. For each input \( I_t \), we have a state in the tester that posts the input for \( I_t \) to the middleware. If the observable response equals \( R_t \), the system progresses to the next input, otherwise it reports the test failed. If all the responses match the expected input, the test succeeds. This pattern in shown in Figure 6. We emphasise
---
Figure 5. Tester LLFSM to verify the software model complies with the requirement that opening the door pauses the cooking.
Figure 6. Pattern of a LLFSMs tester.
that unless the requirements change, the tester LLFSMs do not change. And if a requirement changes, changing the corresponding tester is straightforward. In contrast, model-checking with tools like NuSMV demand a particular syntax for the LTL or CTL formulas that is very fragile. Such formulas are complicated, usually demanding deep nesting and their semantics is complicated to follow. It is actually quite challenging to be convinced that these formulas actually represent the requirements. It is quite common to succeed with formulas that do not actually represent a desired system property. Any change in the model being tested requires all LTL and CTL formulas to be adjusted.
Thus, producing the corresponding verification is significantly more time-consuming. Our point here is that they should only be performed once all the tests have passed. Obviously the tests do not establish that in all executions that follow from a certain valid configuration, regardless of time, the configuration is reached, the execution would be correct, but early detection by the models testing models proposed here prevent costly model-checking that potentially only informs about the same fault.
For example, in this seemingly simple example of the microwave oven, we have mentioned that the software consists of 4 LLFSMs [10] (one controls the motor, a second one the bell, a third one drives the light, and a fourth one listens to the button to set the time and count down the seconds). While these authors have conducted full model-checking of the properties defined in the requirements and a check regarding overflow of the timer, this was performed for one arrangement of the 4 LLFSMs. If all arrangements were to be verified, the 4!=24 possible integrations of these LLFSMs into the sequential execution would need to be verified, implying the model-checker NuSMV would need to be run against 24 Kripke structures. This is a laborious and not an autonomous exercise. It is important to emphasise that the 4 LLFSMs are almost independent modules, and part of the quality assurance is that in fact all 4!=24 configurations of the arrangement are correct. That is, the integration cannot accidentally produce a fault just because of the ordering of the modules. Thus, we have produced an LLFSM that generates all permutations of an arrangement of LLFSMs and tests them with the CI server. In this scenario, no tester LLFSMs (Figs. 4 and 5) needs any adaption or changes. By contrast, the formulas for model-checking under NuSMV do require adaption for each of the possible 24 orders (as they are specific to the operators for the next Kripke state).
Thus, this case study demonstrates the benefits of models testing models under continuous integration for quality assurance of embedded systems.
III. SECOND CASE STUDY
We will now illustrate our approach with the MDSD and TDD construction and testing of software for a
<table>
<thead>
<tr>
<th>Req.</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>R 1</td>
<td>Monitor the input for a sense signal</td>
</tr>
<tr>
<td>R 2</td>
<td>If no input has been sensed for R1, then output a pace</td>
</tr>
<tr>
<td>R 3</td>
<td>If an input is sensed, inhibit pacing for VRP</td>
</tr>
<tr>
<td>R 4</td>
<td>If a pace is sent, do not monitor or send another pace for VRP</td>
</tr>
<tr>
<td>R 5</td>
<td>If the last event was natural, then turn hysteresis mode on</td>
</tr>
<tr>
<td>R 6</td>
<td>If the last event was paced, then turn hysteresis mode on</td>
</tr>
<tr>
<td>R 7</td>
<td>If hysteresis mode is on, R1 ← R11</td>
</tr>
<tr>
<td>R 8</td>
<td>If hysteresis mode is off, R1 ← LRI</td>
</tr>
<tr>
<td>R 9</td>
<td>No pacing must occur during URI after the last event</td>
</tr>
<tr>
<td>R 10</td>
<td>Pacing must occur if LRI has passed since last event</td>
</tr>
</tbody>
</table>
TABLE I
Pacemaker REQUIREMENTS.
Figure 10. The third LLFSM tester validates that the Pacemaker in Figure 7 does not interfere with a natural beat of two different frequencies.
Figure 7. The LLFSM for the Pacemaker in VVI mode.
Figure 8. The first LLFSM tester validating the Pacemaker in Figure 7 responds before the deadline if the beats stop.
Figure 9. The second LLFSM tester validating the Pacemaker in Figure 7 does not anticipate a beat.
heart-beat of the patient. The tester machine emulates the situation where beats are produced at two different rates. If the tester detects a pulse from the Pacemaker when, in fact, all that happened was a change of frequency in the beat generated by the tester, then we have a fault. The LLFSM that implements the test appears in Figure 10. It performs a more elaborate beat generation pattern than the loop in Figure 9. For the first 5 beats it loops fast, but the next 5 beats are slower. Generating a logic formula to formally verify this type of property is extremely complicated and challenging because of the numerical values of the time variables play a role in the property.
IV. DISCUSSION AND CONCLUSIONS
Perhaps the most relevant work to the approach presented here is Model-Based Testing (MBT) [24], a term much more relevant to automated testing in the sense of automatic generation of tests, influenced by the model. That is, the
model is the source of generated code and generated testing-code (the latter is referred as the test). This is illustrated by many techniques and tools in embedded systems software, in particular for medical devices [25] and automotive systems [26]. In those cases, tools and artefacts such as SysLog and SysML are used to construct the models and to generate typically C code for the embedded device, while frameworks for hardware-In-the-Loop (HIL) are used to run the testing code. Our approach here is radically different in that the actual models are executable, guaranteeing that it is the actual models that are tested.
We have shown that tester models can test software models of behaviour because both are represented in executable arrangements of logic-labeled finite-state machines. This combines the benefits of Model-Driven Software Development (MDSD) with those of Test-Driven Development (TDD) and the productive context of Continuous Integration.
The two case studies here illustrate the efficiency of the method as it avoids the complexities and delicacies of formal verification via model-checking. In the first case study we have shown that integration of 4 LLFSMs results in a large number of combinations that makes the application of model-checking tools complex, tightly-coupled and fragile. A different integration pattern results in a different Kripke structure and thus new formulas must be generated (a complex, non-automatable exercise).
The second case study shows we can use the arithmetic and system calls in the tester machines to validate deadlines and properties in the time domain. Again, a large test coverage can be achieved here under controlled conditions, even where these conditions are too complex for formal verification in the time domain.
Our tester models are generic and robust. They can be derived from the linear traces of use-cases, mirroring them closely. This traceability from requirements facilitates validation completeness in an efficient and effective manner.
REFERENCES
|
{"Source-Url": "http://uksim.info/ems2015/data/0206a089.pdf", "len_cl100k_base": 5098, "olmocr-version": "0.1.53", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 22450, "total-output-tokens": 7262, "length": "2e12", "weborganizer": {"__label__adult": 0.0003969669342041016, "__label__art_design": 0.00036454200744628906, "__label__crime_law": 0.0003657341003417969, "__label__education_jobs": 0.0006837844848632812, "__label__entertainment": 6.264448165893555e-05, "__label__fashion_beauty": 0.00017201900482177734, "__label__finance_business": 0.0001926422119140625, "__label__food_dining": 0.00037550926208496094, "__label__games": 0.0005774497985839844, "__label__hardware": 0.0017366409301757812, "__label__health": 0.0006003379821777344, "__label__history": 0.0002219676971435547, "__label__home_hobbies": 9.953975677490234e-05, "__label__industrial": 0.0004897117614746094, "__label__literature": 0.00024771690368652344, "__label__politics": 0.00023090839385986328, "__label__religion": 0.0005054473876953125, "__label__science_tech": 0.034423828125, "__label__social_life": 8.100271224975586e-05, "__label__software": 0.004657745361328125, "__label__software_dev": 0.9521484375, "__label__sports_fitness": 0.00032806396484375, "__label__transportation": 0.0007510185241699219, "__label__travel": 0.00020301342010498047}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29917, 0.02315]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29917, 0.3656]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29917, 0.89844]], "google_gemma-3-12b-it_contains_pii": [[0, 5018, false], [5018, 9776, null], [9776, 14104, null], [14104, 17316, null], [17316, 20923, null], [20923, 22285, null], [22285, 29917, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5018, true], [5018, 9776, null], [9776, 14104, null], [14104, 17316, null], [17316, 20923, null], [20923, 22285, null], [22285, 29917, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29917, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29917, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29917, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29917, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29917, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29917, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29917, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29917, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29917, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29917, null]], "pdf_page_numbers": [[0, 5018, 1], [5018, 9776, 2], [9776, 14104, 3], [14104, 17316, 4], [17316, 20923, 5], [20923, 22285, 6], [22285, 29917, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29917, 0.10169]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
15effc90e1df3d3a303819e3d7f400babc715148
|
Generating Automated Test Cases using Model Based Testing
Prof. Kirti Patil¹, Prof. M. M. Ganeshwade²
Maharashtra, India
Abstract: The quality of software depends on verification and validation of software. Software testing is an important phase of software development life cycle. It is the process of finding defects by executing a program on a set of test cases and comparing the actual results with expected results. For generating the test cases, Information regarding the behavior of system must be understood first, which can be taken from the models created in design phase. UML is widely accepted and used by industry for modeling and design of software and of embedded systems also. Nowadays Model based testing of real time embedded system is in boom. This paper presents an approach to generate test cases from UML activity diagrams for real-time embedded systems. We first transform extended activity diagrams into a Petri Net Graph (PNG). PNG then transform to generate Test sequences. We have used workflow analysis for analyzing PNG. Petri Net properties are analyzed and then prioritized test cases generated for verification of dynamic model of Real time Embedded system. It will surely improve the efficiency and at the same time to reduce the high cost of the manual testing in design phase itself.
Keywords: Software Testing, UML Models, Extended Activity diagram, Petri Net Graph (PNG), Test Sequence.
I. INTRODUCTION
This paper presents a Novel approach to Generate the test cases using extended activity diagram for Real Time Embedded System. The more focus is on verification of dynamic model of real time embedded system. Today, UML is capturing much attention not only of software-intensive systems but also in the Real Time Embedded Software community and considered an important source of information for generating test cases. Therefore if it is correctly designed it will reduce testing cost and effort and at the same time improve the software quality. Here we used UML 2.x layered activity diagram which provides abstracted and complicated workflow for concurrent embedded system. The core of testing work is to verify the workflow of system. In this way, activity diagram is very useful to embedded software testing.
This work demonstrates the possibility by developing an Editor which can be used to model the workflows using Activity Diagrams. Further In this paper we present a formal method to analyze these activity workflow models by transforming it into Petri Net Graph. Petri net properties and generated prioritized test cases will verify the real time embedded system.
II. LITERATURE SURVEY
Model Based Testing is highly ranked type of testing which provides a solid foundation for generating the test cases from the business requirements that are formally represented by a model. In the literature, Unified Modeling Language (UML) and its models are widely used as modeling mechanisms to specify, analyze and design requirements of the system, for test automation and for model-based testing. The UML 2.0 includes fourteen kinds of diagrams. UML provides both the static (or structural) views and dynamic (or behavioral) views of the system. Static view includes class diagram, object diagram and Dynamic view includes activity diagram, state chart diagram, sequence diagram etc. A lot of research has been done in the literature using these UML models to verify the dynamic model of system. Based on UML diagrams, Anders Hessel and Paul Pettersson [1] have described extended tool of UPPAAL to verify test-cases derived from a network of timed automata specifying the expected behavior of the system. Particularly, they presented the symbolic reachability analysis algorithm of the tool to generate traces. The generated traces satisfies simple coverage criteria, and used as test sequences or suites to test real-time systems. Authors in [2] tried to convert an activity diagram to a directed graph. Then test cases can be generated from the directed graph. But this method lacks concrete rules for the automatic transformation. Wang Linzhang et al. [3] proposed an approach of gray-box testing using activity diagrams according to dynamic scenario of system. Test cases are generated following basic path coverage criterion and by representing a method of a class to an activity and a class to a swim lane, which represent the expected structure and behavior of SUT. Chen Mingsong et al. [4] presented an idea to obtain the random generation of test cases for Java programs using activity diagram. Java programs are...
transformed to intermediate level called program execution traces (pet) and finally, reduced test suite is obtained by comparing the simple paths with program execution traces.
In today’s era, it becomes necessity to verify the correctness of complex system specification and it can be done with formal verification to guarantee the quality of UML models. UML activity diagram adopts Petri-net semantics which describes the concurrent behavior and very few researchers [10, 11, 16] used Petri Net like semantics approach to generate the test cases from activity diagram. In [10, 11, 16] the authors proposed an approach. The UML activity diagram is translated into a formal model NuSMV [6], and then the properties in the form of CTL or LTL [7] are analyzed. Their formulas can be generated from the coverage criteria. Finally, the negative properties are applied to the formal model using the model to produce the required test cases. However, the translation is used to verify the consistency between UML activity diagrams and class diagrams of two different models. Dianxiang Xu [10] implemented a tool ISTA for automated test generation and execution by using high-level Petri nets. Author [10] considered high-level Petri nets as finite state test models. It also provides a language for mapping the elements in test models as Petri nets for implementation constructs. This test code can be executed against the SUT.
Jörg Desel And Andreas Oberweis, [11] presented a technique which generates test cases from the cause-effect graphing (a method for program code testing) for the validation of high-level Petri nets in a systematic way. The difference between both methods is the representation of the relationships between causes and effects. Additionally, the method also creates test input and test output data to the test cases.
Although UML activity diagram adopts Petri-net Semantics, it only focuses on workflow modeling. Petri nets combine a well defined mathematical theory with a graphical representation of the dynamic behavior of systems. Here we propose a formal method to convert activity diagram into Petri net through which formal analysis of a model can be done. With the combination of workflow analysis of activity diagram and support of mathematical analysis of Petri net, test paths are generated to verify the correct design of real time embedded system. There are a number of tools in the market on model-based software testing. These tools can be categorized as commercial tools and academic tools. Commercial tools include AGEDIS, Spec Explorer, Spec Explorer, Conformiq Qtronic, TorX, T-VEC, JUMBLE, REACTIS and many more and Academic tools include SPECTEST, COW SUITE, TORX/CADP, TGV/CADP, TOSTER, MULSAW etc.
Based on tool survey [27], it is clear that most tools used abstract models presenting either usage-based scenarios or state-based system behaviors. Most existing model-based test tools focus on test generation and execution for a particular software or hardware system. Clearly, this is not enough in test automation for many complex real application systems.
To the best of our knowledge, there is no existing tool that can automatically derive test cases only from UML extended activity diagram to show the system behavior and which will give verification of system for implementation. This paper proposes a prototype tool to elaborate the abstract activity diagram and analyze the properties of diagram for further system verification.
The comparison is done with respect to the analogous tool TorX which uses UML Sequence diagram to show the behavior of system. The output is generated in the form of Tree structure and It is also unclear from output whether or not the tool provides expected results for each test case to verify the system. Also it doesn’t check any property to verify the system for correct implementation.
### III. BACKGROUND
**Extended Activity Diagram and Petri Net Concept**
Activity diagram is used for business modeling, control flow modeling, complex operation modeling etc. There are three main advantages to use an Activity diagram 1) It is very simple like a flowchart and 2) It is very easy to understand the flow of logic of the system. 3) It can be used as the initial diagram to study new or existing systems. UML 2 Activity Diagram presents concepts at a higher abstraction level compared to other UML diagrams. Hence finding test information from this model is a terrified task. Among all UML diagrams UML activities closely represent a wide spectrum of properties and are targeted towards different levels of stakeholders needs to express explicit system workflow. Activity diagram can be used to design the System behavior for different purposes at all levels. Hence they need to be described in detailed. For better describing the complicated actions of embedded real-time system, we use layered activity diagrams in system modeling. The upper layer activity diagram is the main work flow of at higher abstraction level. The under layer activity diagrams expanded from active nodes of the upper layer activity are used to describe the sub-activity of System.
In this paper, we use two STEREOTYPES <<Task>> and <<Combined Task>> to realize the dynamic modeling of test cases generation for the real-time extension of activity diagram. The UML specification [6] has given the explanation on the different types of activities in form of rules for node execution based on something similar to token flows. Still, activity diagram has some consequences. The activities are informal models that require verification and testing. Hence, we need something more formal to analyze the workflow. Petri net and its properties offer that. Petri net is analytical as well as mathematical tool. As an analysis and mathematical tool it reveals various properties of the model and hence of the actual physical system. Thus, one can draw important conclusions about the system without performing lengthy calculation of conventional system modeling. Therefore, transforming activities into Petri nets seems to be a best choice for system verification. The Supporting evidence exists presenting the advantages of mapping activities into Petri nets [12-15, 19]. In this paper the possible mapping process has been discussed and used [23-26].
**Activity Diagram to Petri Net Translation**
In UML 2.0, the activity diagram semantics can be easily mapped to the Petri net semantics. In general Petri nets consist of places and transitions. Places and transitions are linked by directed arcs. Arcs run from a place to a transition or vice versa, but never between two nodes of the same kind. Each arc is associated with a non-negative number called weight. As shown in figure 1, simple but important mappings are used. Activity nodes are represented by places and decision nodes, forks, joins, initial nodes, activity final nodes are shown as transitions. The parallel execution of transitions is denoted by an AND-split like fork and an AND-join on the other hand is used to resynchronize parallel flows like join. The alternative transition - decision is modeled with an OR-split. Edges are made transitions with one input and one output arc.

**Analysis of Petri Net**
The Formal definition of Petri nets are defined as follows [29, 30]:
**Definition 1:**
A Petri net G is a four-tuple (P, T, IN, OUT) where
\[ P = \{ p_1, p_2, p_3, \ldots, p_n \} \] is a set of places
\[ T = \{ t_1, t_2, t_3, \ldots, t_n \} \] is a set of transitions
And \[ P \cup T \] and \[ P \cap T = \emptyset \]
where \( \text{IN}: (P \times T) \rightarrow N \) is an input function that defines directed arcs from places to transitions and where \( \text{OUT}: (P \times T) \rightarrow N \) is an output function that defines directed arcs from transitions to places.
If \( \text{IN}(p_i, t_j) = k \), where \( 0 \leq k \leq 1 \) is a positive integer, a directed arc from place \( p_i \) to transition \( t_j \) is drawn with label \( k \).
If \( \text{IN}(p_i, t_j) = 0 \), no arc is drawn from \( p_i \) to \( t_j \).
Similarly, if \( \text{OUT}(p_i, t_j) = k \), a directed arc is included from transition \( t_j \) to place \( p_i \), with \( k = 1 \).
If \( k = 0 \), no arc is included from \( t_j \) to \( p_i \).
**Definition 2:**
Let \( 2^p \) be the power set of \( P \). We then define functions \( \text{IP}: T \rightarrow 2^p \) and \( \text{OP}: T \rightarrow 2^p \) as follows:
\[ \text{IP}(t_j) = \{ p_j \in P: \text{IN}(p_j, t_j) = 0 \} \cup t_j \in T \]
\[ \text{OP}(t_j) = \{ p_j \in P: \text{OUT}(p_j, t_j) = 0 \} \cup t_j \in T \]
Where \( \text{IP}(t_j) \) is the set of input places of \( t_j \) and \( \text{OP}(t_j) \) is the set of output places of \( t_j \).
Definition 3: A transition \( t_i \) of a PN is said to be enabled in a marking \( M \) if
\[
M(p_i) \geq IN(p_i, t_j) \forall p_i \in P(t_j)
\]
An enabled transition \( t_j \) can fire at any instant of time. When a transition \( t_j \) enabled in a marking \( M \) fires, a new marking \( M' \) is reached according to the equation
\[
M'(p_i) = M(p_i) + OUT(p_i, t_j) - IN(p_i, t_j) \forall p_i \in P.
\]
We say marking \( M' \) is reachable from \( M \) and write
\[
M \rightarrow^0 M'.
\]
Definition 4: Given a marked net \((G, M_0)\), a reachable marking \( M \in R[M_0] \) is called a deadlocked marking (or a deadlock) if no transition is enabled in \( M \). A marked net \((G, M_0)\) in which no reachable marking is deadlocked is said to be deadlock free.
IV. PROPOSED APPROACH WITH AN EXAMPLE
As shown in Figure 2, our technique is based on following steps:
a) Augmenting the activity diagram with necessary test information.
b) Converting activity diagram into PNG.
c) Identify all the activity flows from PNG.
d) Prioritize the flows based on weight of all transitions in the sequence activity flow.e) Generate the test cases.
Figure 2 shows Workflow of Proposed tool. Figure 3 shows the activity diagram for “Cash withdrawal” to model the workflow of system. It contains two types of activities: 1) Combined activity and 2) Activity denoted with the help of proposed stereotypes.
M, do the following for each enabled transition t at M:
- Obtain the marking M’ that results from firing t at M.
- On the path from the root to M if there exists a marking M" such that M'(p)>M"(p) for each place p and M' ≠ M", i.e., M" is coverable, then replace M'(p) by ω for each p such that M'(p) > M"(p).
- Introduce M' as a node, draw an arc with label t from M to M', and tag M' as "new".
Figure 3: UML Activity diagram for “Cash Withdrawal”
The Petri net properties are helpful in analyzing corresponding workflow for constructed activity diagram. Presence of boundedness indicates that a particular place have finite number of tokens if there is only one token in the start place and further same token in other places and absence of boundedness indicates that we can never reach the end place if there is no token in other places. Safeness property in workflow domain will ensure there is no need of processing two same objects when one is needed. Liveness implies the absence of deadlocks. Deadlock property is an important from workflow modeling point of view as it indicates that the corresponding workflow has some activity which cannot be reached hence the design has some flaws.
V. TEST CASE GENERATION
According to Petri net analysis workflow of concurrent activities generates two flows with same activities changing its sequence to test whether both activities can work together or not, even though they can not included in simple path set. According to authors in paper [7], they have selected only such test cases which cover all activities in simple path. Our work addresses these activity path coverage criteria.
The final test sequences as shown in figure 4 are generated by prioritizing them so that most important flows are tested. It will also reduce the duration of testing and ultimately it reduces testing cost. For every generated activity flow we use ‘weight’ of flow. If there are more than one combination of flows covering all the edges we need to select combination with highest flow ‘weight’. For every edge in flow we assign a positive integer ‘w’ whose value may vary from 0 to 1. If activity has only one outgoing edge, weight of the outgoing edge is 1.
If node has n outgoing edges (for decision nodes), sum of the weight of all outgoing edges must be 1.
**Weight of a flow** is defined as the sum of all the weights of the edges in the flow. With this formula we can automatically find the paths covering maximum number of activities and transitions. Hence maximum activity coverage and transition coverage criteria also satisfied.
**VI. COMPARISON WITH RELATED WORK**
No evidences found in investigated work that generates test cases with the use of only activity diagrams and petrinet concept. Modeling power and its decision power are the two major factors for the success of any model. First refers to the ability to correctly represent the system to be modeled whereas second refers to the ability to analyze the model and determine properties of the modeled system for correct implementation. In our work we used activity diagram for modeling purpose which shows workflow of system. Mapping same diagram into Petri net is used for formal analysis for testing purpose. Petrinet is the mathematical tool which can be used to analyze the behavior of complex system. Our approach targets black box testing involving interaction among activities. Our work is comparable with the work presented in [3, 4, 5, 6, 7], Linzhang et al. [3] propose a method to automatically generate test cases from UML activity diagrams using a graybox method. In their method they generate test cases directly from UML/activity diagrams. Their proposed method exploits the advantage of black box testing to analyze the expected external behavior and white box testing to cover the internal structure of the activity diagram of the system under test to generate test cases. In paper [4] authors have used petri net like semantics and considered basis path coverage to generate random test cases. Practically it is not possible to test large set of random test cases generated for large complex system. Also they have not addressed minimal loop testing and reducing number of paths. In [5, 6] paper authors addressed the criteria of activity path coverage but some concurrent paths are missing which should be tested. Also not provide any criteria for prioritizing the test cases whereas our approach generates prioritized test flows. In [7] paper author has used ORT relations but again here loop tesing is not done hence testing may have some flaws. None of mentioned papers checked the properties of system such as reachability, safeness, liveness, deadlock, boundedness. Hence they cannot completely specify whether their drawn activity diagram is correct or incorrect for implementation. Our approach has worked on those properties and can find all these properties in system through an activity diagram for complex real time embedded system.
**VII. CONCLUSION**
We have presented a prototype tool to generate test cases automatically from UML activity diagrams. Our approach has addressed the different properties of Petri net and we can conclude that drawn activity diagram model of system is safe for implementation or not. Such system can contain deadlocks and we can detect them by specifying proper input to it.
**ACKNOWLEDGEMENT**
Our special thanks to Department of Computer science and engineering of MIT College of engineering, Aurangabad.
REFERENCES
[7]. Abdelkamel Hettab1, Allaoua Chaoui1, and Ahmad Alhahoud2 “AUTOMATIC TEST CASES GENERATION FROM UML ACTIVITY DIAGRAMS USING GRAPH TRANSFORMATION” 6th ICIT May 8, 2013.
[16]. A. Spiteri Staines, “A TGG Approach for Mapping UML 2 Activities into Petri Nets”, Proc. 9th WSEAS, SEPADS, Univ. of Cambridge, UK, Feb 2010, pp. 90-95
|
{"Source-Url": "http://www.erpublications.com/uploaded_files/download/download_19_02_2014_06_28_04.pdf", "len_cl100k_base": 4493, "olmocr-version": "0.1.49", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 26442, "total-output-tokens": 6532, "length": "2e12", "weborganizer": {"__label__adult": 0.0003285408020019531, "__label__art_design": 0.00040078163146972656, "__label__crime_law": 0.0003898143768310547, "__label__education_jobs": 0.0010890960693359375, "__label__entertainment": 6.395578384399414e-05, "__label__fashion_beauty": 0.00015723705291748047, "__label__finance_business": 0.00019037723541259768, "__label__food_dining": 0.00033736228942871094, "__label__games": 0.0006809234619140625, "__label__hardware": 0.0011043548583984375, "__label__health": 0.0005431175231933594, "__label__history": 0.00023293495178222656, "__label__home_hobbies": 9.578466415405272e-05, "__label__industrial": 0.0004813671112060547, "__label__literature": 0.0002505779266357422, "__label__politics": 0.0002465248107910156, "__label__religion": 0.0004324913024902344, "__label__science_tech": 0.042724609375, "__label__social_life": 9.077787399291992e-05, "__label__software": 0.0066680908203125, "__label__software_dev": 0.9423828125, "__label__sports_fitness": 0.00034165382385253906, "__label__transportation": 0.0005936622619628906, "__label__travel": 0.00019609928131103516}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25411, 0.02316]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25411, 0.75934]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25411, 0.87905]], "google_gemma-3-12b-it_contains_pii": [[0, 4576, false], [4576, 9728, null], [9728, 13405, null], [13405, 14803, null], [14803, 16025, null], [16025, 20177, null], [20177, 25411, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4576, true], [4576, 9728, null], [9728, 13405, null], [13405, 14803, null], [14803, 16025, null], [16025, 20177, null], [20177, 25411, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 25411, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25411, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25411, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25411, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25411, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25411, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25411, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25411, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25411, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25411, null]], "pdf_page_numbers": [[0, 4576, 1], [4576, 9728, 2], [9728, 13405, 3], [13405, 14803, 4], [14803, 16025, 5], [16025, 20177, 6], [20177, 25411, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25411, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-27
|
2024-11-27
|
ee07439fec581bdad7e3683d4f2f965345ed69d5
|
Lecture Notes
Subject: Introduction to Programming Methodology
Broad Classification of Computer Languages
- Machine language
- Assembly language
- High-level language
Machine Language
- Only language of a computer understood by it without using a translation program
- Normally written as strings of binary 1s and 0s
- Written using decimal digits if the circuitry of the computer being used permits this
A Typical Machine Language Instruction Format
<table>
<thead>
<tr>
<th>OPCODE</th>
<th>OPERAND</th>
</tr>
</thead>
<tbody>
<tr>
<td>(operation code)</td>
<td>(Address/Location)</td>
</tr>
</tbody>
</table>
- OPCODE tells the computer which operation to perform from the instruction set of the computer.
- OPERAND tells the address of the data on which the operation is to be performed.
<table>
<thead>
<tr>
<th>In Binary</th>
<th>In Decimal</th>
</tr>
</thead>
<tbody>
<tr>
<td>0010000000000001100111001</td>
<td>10001471</td>
</tr>
<tr>
<td>0011000000000010000100001</td>
<td>14002041</td>
</tr>
<tr>
<td>0110000000000011100101110</td>
<td>30003456</td>
</tr>
<tr>
<td>101000111111011100101110</td>
<td>50773456</td>
</tr>
<tr>
<td>0000000000000000000000000000000000000000000</td>
<td>0000000000</td>
</tr>
</tbody>
</table>
Advantages & Limitations of Machine Language
**Advantage**
- Can be executed very fast
**Limitations**
- Machine Dependent
- Difficult to program
- Error prone
- Difficult to modify
Programming language that overcomes the limitations of machine language programming by:
- Using alphanumeric mnemonic codes instead of numeric codes for the instructions in the instruction set
e.g. using ADD instead of 1110 (binary) or 14 (decimal) for instruction to add
- Allowing storage locations to be represented in form of alphanumeric addresses instead of numeric addresses
e.g. representing memory locations 1000, 1001, and 1002 as FRST, SCND, and ANSR respectively
- Providing pseudo-instructions that are used for instructing the system how we want the program to be assembled inside the computer’s memory
e.g. START PROGRAM AT 0000; SET ASIDE AN ADDRESS FOR FRST
Assembler
• Software that translates as assembly language program into an equivalent machine language program of a computer.
Assemble language program → Input → Assembler → Output → Machine language program
(Source Program) → One-to-one correspondence → (Object Program)
### An Example of Assembly Language Program
<table>
<thead>
<tr>
<th>Mnemonic</th>
<th>Opcode</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>HLT</td>
<td>00</td>
<td>Halt, used at the end of program to stop</td>
</tr>
<tr>
<td>CLA</td>
<td>10</td>
<td>Clear and add into A register</td>
</tr>
<tr>
<td>ADD</td>
<td>14</td>
<td>Add to the contents of A register</td>
</tr>
<tr>
<td>SUB</td>
<td>15</td>
<td>Subtract from the contents of A register</td>
</tr>
<tr>
<td>STA</td>
<td>30</td>
<td>Store A register</td>
</tr>
</tbody>
</table>
A subset of the set of instructions supported by a computer
Advantages of Assembly Language Over Machine Language
- Easier to understand and use
- Easier to locate and correct errors
- Easier to modify
- No worry about addresses
- Easily relocatable
- Efficiency of machine language
Limitations of Assembly Language
- Machine dependent
- Knowledge of hardware required
- Machine level coding
Typical Uses of Assembly Language
- Mainly used today to fine-tune important parts of programs written in a high-level language to improve the program’s execution efficiency
High-Level Languages
- Machine independent
- Do not require programmers to know anything about the internal structure of computer on which high-level language programs will be executed
- Deal with high-level coding, enabling the programmers to write instructions using English words and familiar mathematical symbols and expressions
• Translator program (software) that translates a high-level language program into its equivalent machine language program
• Compiles a set of machine language instructions for every program instruction in a high-level language
Compiler
High-level language program → Input → Compiler → Output → Machine language program
(Source Program) → One-to-many correspondence → (Object Program)
A computer supporting languages L1 and L2
Illustrating the requirement of a separate compiler for each high-level language supported by a computer
Program P1 in high-level language L1
Compiler for language L1 on computer A -> Machine code for P1 that will run on computer A -> Executed on computer A
Compiler for language L1 on computer B -> Machine code for P1 that will run on computer B -> Executed on computer B
Same results obtained
Illustrating the machine independence characteristic of a high-level language. Separate compilers are required for the same language on different computers.
Interpreter
- Interpreter is a high-level language translator
- Takes one statement of a high-level language program, translates it into machine language instructions
- Immediately executes the resulting machine language instructions
- Compiler simply translates the entire source program into an object program and is not involved in its execution
Advantages of High-Level Languages
- Machine independent
- Easier to learn and use
- Fewer errors during program development
- Lower program preparation cost
- Better documentation
- Easier to maintain
Limitations of High-Level Languages
- Lower execution efficiency
- Less flexibility to control the computer’s CPU, memory and registers
Object-Oriented Programming Languages
- Programming languages are used for simulating real-world problems on computers
- Much of the real world is made up of objects
- Essence of OOP is to solve a problem by:
- Identifying the real-world objects of the problem
- Identifying processing required of them
- Creating simulations of objects, processes, and their communications
FORTRAN
- Stands for FORMULA TRANslating
- Originally developed by John Backus and his team at IBM followed by several revisions
- Standardized by ANSI as FORTRAN-77 and FORTRAN-90
- Designed for solving scientific & engineering problems
- Oriented towards solving problems of a mathematical nature
- Popular language amongst scientists and engineers
- Stands for **CO**mmonly **B**usiness **O**riented **L**anguage
- Originally developed started under Grace Hopper followed by C**ON**ference on D**A**ta S**Y**stems L**a**nguages (CODASYL)
- Standardized by ANSI as COBOL-74, COBOL-85, and COBOL-2002
- Designed for programming business data processing applications
- Designed to have the appearance and structure of a business report written in English, hence often referred to as a self-documenting language
BASIC
- Stands for Beginners All-purpose Symbolic Instruction Code
- Developed by Professor John Kemeny and Thomas Kurtz at Dartmouth College in the United States
- Standardized by ANSI as BASIC-78
- Designed to be an interactive language and to use an interpreter instead of a compiler
- Simple to implement, learn and use language. Hence, it is a widely used language on personal computers
- Flexible and reasonably powerful language and can be used for both business and scientific applications
Pascal
- Named after the famous seventeenth-century French mathematician Blaise Pascal
- Developed by Professor Nicklaus Wirth of Federal Institute of Technology in Zurich
- Encourages programmers to write well-structured, modular programs, instills good program practices
- Recognized as an educational language and is used to teach programming to beginners
- Suitable for both scientific & business applications
- Has features to manipulate numbers, vectors, matrices, strings, sets, records, files, and lists
• Developed in 1972 at AT&T’s Bell laboratories, USA by Dennis Ritchie and Brian Kernighan
• Standardized by ANSI and ISO as C89, C90, C99
• High-level programming languages (mainly machine independence) with the efficiency of an assembly language
• Language of choice of programmers for portable systems software and commercial software packages like OS, compiler, spreadsheet, word processor, and database management systems
A Sample C Program
/* PROGRAM TO COMPUTE THE SUM OF 10 NUMBERS */
/* Directives to include standard library and header */
#include <stdlib.h>
#include <stdio.h>
/* Main function starts here */
void main ( )
{
/* Declaration of variables */
float Sum = 0.0, N = 0.0;
int Count = 0;
for (Count = 0; Count < 10; Count++)
{
printf("Give a number:");
scanf("%f", N);
Sum += N;
}
printf("THE SUM OF GIVEN NUMBERS = %f", &Sum);
}
Java
- Development started at Sun Microsystems in 1991 by a team led by James Gosling
- Developed to be similar to C++ with fewer features to keep it simple and easy to use
- Compiled code is machine-independent and developed programs are simple to implement and use
- Uses *just-in-time* compilation
- Used in embedded systems such as hand-held devices, telephones and VCRs
- Comes in two variants – Java Runtime Engine (JRE) and Java Software Development Kit (SDK)
SNOBOL
- Stands for String Oriented Symbolic Language
- Used for non-numeric applications
- Powerful string manipulation features
- Widely used for applications in the area of text processing
Characteristics of a Good Programming Language
- Simplicity
- Naturalness
- Abstraction
- Efficiency
- Structured Programming Support
- Compactness
- Locality
- Extensibility
- Suitability to its environment
Computer Software
Software
- **Hardware** refers to the physical devices of a computer system.
- **Software** refers to a collection of programs.
- **Program** is a sequence of instructions written in a language that can be understood by a computer.
- **Software package** is a group of programs that solve a specific problem or perform a specific type of job.
Both hardware and software are necessary for a computer to do useful job. They are complementary to each other.
Same hardware can be loaded with different software to make a computer system perform different types of jobs.
Except for *upgrades*, hardware is normally a one-time expense, whereas software is a continuing expense.
Upgrades refer to renewing or changing components like increasing the main memory, or hard disk capacities, or adding speakers, modems, etc.
Types of Software
Most software can be divided into two major categories:
- **System software** are designed to control the operation and extend the processing capability of a computer system.
- **Application software** are designed to solve a specific problem or to do a specific task.
System Software
- Make the operation of a computer system more effective and efficient
- Help hardware components work together and provide support for the development and execution of application software
- Programs included in a system software package are called **system programs** and programmers who prepare them are called **system programmers**
- Examples of system software are operating systems, programming language translators, utility programs, and communications software
Application Software
- Solve a specific problem or do a specific task
- Programs included in an application software package are called *application programs* and the programmers who prepare them are called *application programmers*
- Examples of application software are word processing, inventory management, preparation of tax returns, banking, etc.
Logical System Architecture
Relationship among hardware, system software, application software, and users of a computer system.
Developing a software and putting it to use is a complex process and involves following steps:
- Analyzing the problem at hand and planning the program(s) to solve the problem
- Coding the program(s)
- Testing, debugging, and documenting the program(s)
- Implementing the program(s)
- Evaluating and maintaining the program(s)
Firmware
- Firmware is software substituted for hardware and stored in read-only memory
- Firmware technology has enabled production of various types of smart machines having microprocessor chips with embedded software
Basic idea is to have a separate software layer to:
- Act as “glue” between client and server parts of application
- Provide programming abstraction
- Mask heterogeneity of underlying network, hardware, and OS
- Encourages three-tier software architecture against two-tier popularized by Server-Client architecture
Planning the Computer Program
Algorithm
- Refers to the logic of a program and a step-by-step description of how to arrive at the solution of a given problem
- In order to qualify as an algorithm, a sequence of instructions must have following characteristics:
- Each and every instruction should be precise and unambiguous
- Each instruction should be such that it can be performed in a finite time
- One or more instructions should not be repeated infinitely. This ensures that the algorithm will ultimately terminate
- After performing the instructions, that is after the algorithm terminates, the desired results must be obtained
There are 50 students in a class who appeared in their final examination. Their mark sheets have been given to you.
The division column of the mark sheet contains the division (FIRST, SECOND, THIRD or FAIL) obtained by the student.
Write an algorithm to calculate and print the total number of students who passed in FIRST division.
Sample Algorithm (Example 1)
Step 1: Initialize Total_First_Division and Total_Marksheets_Checked to zero.
Step 2: Take the mark sheet of the next student.
Step 3: Check the division column of the mark sheet to see if it is FIRST, if no, go to Step 5.
Step 4: Add 1 to Total_First_Division.
Step 5: Add 1 to Total_Marksheets_Checked.
Step 6: Is Total_Marksheets_Checked = 50, if no, go to Step 2.
Step 7: Print Total_First_Division.
Step 8: Stop.
Flowchart is a pictorial representation of an algorithm.
- Uses symbols (boxes of different shapes) that have standardized meanings to denote different types of instructions.
- Actual instructions are written within the boxes.
- Boxes are connected by solid lines having arrow marks to indicate the exact sequence in which the instructions are to be executed.
- Process of drawing a flowchart for an algorithm is called flowcharting.
Basic Flowchart Symbols
- Terminal
- Input/Output
- Processing
- Decision
- Flow lines
- Connectors
Examples of Decision Symbol
(a) A two-way branch decision.
(b) A three-way branch decision.
50 students of a class appear in the examination of Example 3.
Draw a flowchart for the algorithm to calculate and print the percentage marks obtained by each student along with his/her roll number and name.
Flowchart for the solution of Example 4 with an infinite (endless) process loop.
Start
Read input data
Add marks of all subjects giving Total
Percentage = Total / 10
Write output data
Flowcharting Rules
- First chart the main line of logic, then incorporate detail.
- Maintain a consistent level of detail for a given flowchart.
- Do not chart every detail of the program. A reader who is interested in greater details can refer to the program itself.
- Words in the flowchart symbols should be common statements and easy to understand.
Flowcharting Rules
- Be consistent in using names and variables in the flowchart
- Go from left to right and top to bottom in constructing flowcharts
- Keep the flowchart as simple as possible. Crossing of flow lines should be avoided as far as practicable
- If a new flowcharting page is needed, it is recommended that the flowchart be broken at an input or output point.
- Properly labeled connectors should be used to link the portions of the flowchart on different pages
Advantages of Flowchart
- Better Communication
- Proper program documentation
- Efficient coding
- Systematic debugging
- Systematic testing
Limitations of Flowchart
- Flowcharts are very time consuming and laborious to draw (especially for large complex programs)
- Redrawing a flowchart for incorporating changes/modifications is a tedious task
- There are no standards determining the amount of detail that should be included in a flowchart
Pseudocode
- A program planning tool where program logic is written in an ordinary natural language using a structure that resembles computer instructions.
- "Pseudo" means imitation or false and "Code" refers to the instructions written in a programming language. Hence, pseudocode is an imitation of actual computer instructions.
- Because it emphasizes the design of the program, pseudocode is also called Program Design Language (PDL).
Any program logic can be expressed by using only following three simple logic structures:
1. Sequence logic,
2. Selection logic, and
3. Iteration (or looping) logic
Programs structured by using only these three logic structures are called \textit{structured programs}, and the technique of writing such programs is known as \textit{structured programming}.
It is used for performing instructions one after another in sequence.
(a) Flowchart
(b) Pseudocode
Also known as decision logic, it is used for making decisions.
Three popularly used selection logic structures are:
1. IF...THEN...ELSE
2. IF...THEN
3. CASE
Selection Logic (IF...THEN...ELSE Structure)
(a) Flowchart
- IF (condition)
- THEN Process 1
- ELSE Process 2
(b) Pseudocode
- IF Condition
- THEN Process 1
- ELSE Process 2
ENDIF
Iteration (or Looping) Logic
- Used to produce loops in program logic when one or more instructions may be executed several times depending on some conditions.
- Two popularly used iteration logic structures are:
1. DO...WHILE
2. REPEAT...UNTIL
Iteration (or Looping) Logic
(DO...WHILE Structure)
(a) Flowchart
(b) Pseudocode
```
DO WHILE Condition
Process 1
Process n
ENDDO
```
Iteration (or Looping) Logic
(REPEAT...UNTIL Structure)
(a) Flowchart
(b) Pseudocode
Advantages of Pseudocode
- Converting a pseudocode to a programming language is much more easier than converting a flowchart to a programming language.
- As compared to a flowchart, it is easier to modify the pseudocode of a program logic when program modifications are necessary.
- Writing of pseudocode involves much less time and effort than drawing an equivalent flowchart as it has only a few rules to follow.
Limitations of Pseudocode
- In case of pseudocode, a graphic representation of program logic is not available.
- There are no standard rules to follow in using pseudocode.
- Different programmers use their own style of writing pseudocode and hence communication problem occurs due to lack of standardization.
- For a beginner, it is more difficult to follow the logic of or write pseudocode, as compared to flowcharting.
Operating Systems
Definition and Need for OS
- Integrated set of programs that controls the resources (the CPU, memory, I/O devices, etc.) of a computer system
- Provides its users with an interface or virtual machine that is more convenient to use than the bare machine
- Two primary objectives of an OS are:
- Making a computer system convenient to use
- Managing the resources of a computer system
The operating system layer hides the details of the hardware from the programmer and provides the programmer with convenient interface for using the system.
Main Functions of an OS
- Process management
- Memory management
- File management
- Security
- Command interpretation
Parameters for Measuring System Performance
- **Throughput**: Amount of work that the system is able to do per unit time
- **Turnaround time**: Interval from the time of submission of a job to the system for processing to the time of completion of the job
- **Response time**: Interval from the time of submission of a job to the system for processing to the time the first response for the job is produced by the system
Process Management
- A **process** (also called **job**) is a program in execution.
- **Process management** manages the processes submitted to a system in a manner to minimize *idle time* of processors (CPUs, I/O processors, etc.) of the system.
Process States in Multiprogramming
- New job → Ready
- Job is allocated the CPU for execution
- I/O completed → Blocked
- Job must wait for I/O completion
- Blocked → Running
- Job processing completed
Memory is important resource of a computer system that must be properly managed for the overall system performance.
Memory management module:
- Keeps track of parts of memory in use and parts not in use.
- Allocates memory to processes as needed and deallocates when no longer needed.
A file is a collection of related information
Every file has a name, its data and attributes
File’s name uniquely identifies it in the system and is used by its users to access it
File’s data is its contents
File’s attributes contain information such as date & time of its creation, date & time of last access, date & time of last update, its current size, its protection features, etc.
File management module of an operating system takes care of file-related activities such as structuring, accessing, naming, sharing, and protection of files
File Operations
- Set of commands provided by an operating system to deal with files and their contents
- Typical file operations include create, delete, open, close, read, write, seek, get attributes, set attributes, rename, and copy
Deals with protecting the various resources and information of a computer system against destruction and unauthorized access.
**External security:** Deals with securing computer against external factors such as fires, floods, earthquakes, stolen disks/tapes, etc. by maintaining adequate backup, using security guards, allowing access to sensitive information to only trusted employees/users, etc.
**Internal security:** Deals with user authentication, access control, and cryptography mechanisms.
Security
- **User authentication:** Deals with the problem of verifying the identity of a user (person or program) before permitting access to the requested resource
- **Access Control:** Once authenticated, access control mechanisms prohibit a user/process from accessing those resources/information that he/she/it is not authorized to access
- **Cryptography:** Means of encrypting private information so that unauthorized access cannot use information
Command Interpretation
- Provides a set of commands using which the user can instruct the computer for getting some job done.
- Commands supported by the command interpretation module are known as **system calls**.
Two types of user interfaces supported by various operating systems are:
- **Command-line interface**: User gives instructions to the computer by typing the commands.
- **Graphical User Interface (GUI)**: User gives commands to the system by selecting icon or menu item displayed on the screen with the use of a point-and-draw device.
MS-DOS
- Stands for Microsoft Disk Operating System.
- Single-user OS for IBM and IBM-compatible personal computers (PC)
- Structured in three layers – BIOS (Basic Input Output System), kernel, and shell
- Very popular in the 1980s, now not in much use and development with the launch of Microsoft Windows OS in 1990s
Microsoft Windows
- Developed by Microsoft to overcome limitations of MS-DOS operating system
- Single-user, multitasking OS
- Native interface is a GUI
- Designed to be not just an OS but also a complete operating environment
- OS of choice for most PCs after 1990
File Concept
Data Storage Hierarchy
- **Level 0**: Bit
- A single binary digit (0 or 1)
- **Level 1**: Character
- Multiple related bits are combined to form a character (byte)
- **Level 2**: Field
- Multiple related characters are combined to form a field
- **Level 3**: Record
- Multiple related fields are combined to form a record
- **Level 4**: File
- Multiple related records are combined to form a file
- **Level 5**: Database
- Multiple related files are integrated to form a database
Relationship Among Character, Field, Record, and File
A record
Records of a file
A field having 4 characters
A file management system supports following file types:
- **Transaction file**: Stores input data until it can be processed
- **Master file**: Contains all current data relevant to an application
- **Output file**: Stores output produced by one program that is used as input to another program
- **Report file**: Holds a copy of a report generated by an application
- **Backup file**: Copy of a file, created as a safety precaution against loss of data
File Organizations
- File organization is the physical organization of the records of a file for convenience of storage and retrieval of data records.
- Three commonly used file organizations are:
- **Sequential**: Records are stored one after another in ascending or descending order determined by the value of the key field of the records.
- **Direct/random**: Desired record pertaining to current transaction can be directly located by its key field value without having to navigate through sequence of other records.
Indexed sequential: There are two files for every data file – the data file which contains the records stored in the file, and the smaller index file which contains the key and disk address of each record stored in the data file.
|
{"Source-Url": "http://ggu.ac.in/download/Class-Note13/B%20Sc%20I%20year(rakesh%20Kumar)05.12.13.pdf", "len_cl100k_base": 5495, "olmocr-version": "0.1.53", "pdf-total-pages": 85, "total-fallback-pages": 0, "total-input-tokens": 94242, "total-output-tokens": 8466, "length": "2e12", "weborganizer": {"__label__adult": 0.0004148483276367187, "__label__art_design": 0.0004131793975830078, "__label__crime_law": 0.0003204345703125, "__label__education_jobs": 0.01300811767578125, "__label__entertainment": 0.00010406970977783204, "__label__fashion_beauty": 0.00016641616821289062, "__label__finance_business": 0.00027060508728027344, "__label__food_dining": 0.00047087669372558594, "__label__games": 0.0008449554443359375, "__label__hardware": 0.0022754669189453125, "__label__health": 0.00037789344787597656, "__label__history": 0.0002911090850830078, "__label__home_hobbies": 0.000186920166015625, "__label__industrial": 0.0005087852478027344, "__label__literature": 0.0004420280456542969, "__label__politics": 0.00019276142120361328, "__label__religion": 0.0005273818969726562, "__label__science_tech": 0.01287841796875, "__label__social_life": 0.0001518726348876953, "__label__software": 0.01323699951171875, "__label__software_dev": 0.95166015625, "__label__sports_fitness": 0.0002968311309814453, "__label__transportation": 0.0006198883056640625, "__label__travel": 0.00021314620971679688}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25485, 0.01222]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25485, 0.91489]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25485, 0.90104]], "google_gemma-3-12b-it_contains_pii": [[0, 63, false], [63, 168, null], [168, 407, null], [407, 719, null], [719, 1415, null], [1415, 1601, null], [1601, 2279, null], [2279, 2553, null], [2553, 3137, null], [3137, 3361, null], [3361, 3647, null], [3647, 3981, null], [3981, 4210, null], [4210, 4369, null], [4369, 4517, null], [4517, 4969, null], [4969, 5319, null], [5319, 5660, null], [5660, 6041, null], [6041, 6393, null], [6393, 6853, null], [6853, 7352, null], [7352, 7865, null], [7865, 8292, null], [8292, 8768, null], [8768, 9236, null], [9236, 9429, null], [9429, 9638, null], [9638, 9656, null], [9656, 10000, null], [10000, 10473, null], [10473, 10763, null], [10763, 11250, null], [11250, 11604, null], [11604, 11733, null], [11733, 12061, null], [12061, 12281, null], [12281, 12597, null], [12597, 12627, null], [12627, 13241, null], [13241, 13576, null], [13576, 14031, null], [14031, 14466, null], [14466, 14567, null], [14567, 14661, null], [14661, 14870, null], [14870, 15059, null], [15059, 15413, null], [15413, 15889, null], [15889, 16031, null], [16031, 16335, null], [16335, 16778, null], [16778, 17137, null], [17137, 17238, null], [17238, 17396, null], [17396, 17589, null], [17589, 17840, null], [17840, 17985, null], [17985, 18072, null], [18072, 18490, null], [18490, 18912, null], [18912, 18930, null], [18930, 19318, null], [19318, 19475, null], [19475, 19595, null], [19595, 20019, null], [20019, 20267, null], [20267, 20484, null], [20484, 20770, null], [20770, 21319, null], [21319, 21555, null], [21555, 22055, null], [22055, 22513, null], [22513, 22729, null], [22729, 23066, null], [23066, 23385, null], [23385, 23652, null], [23652, 23665, null], [23665, 24163, null], [24163, 24275, null], [24275, 24729, null], [24729, 25255, null], [25255, 25485, null], [25485, 25485, null], [25485, 25485, null]], "google_gemma-3-12b-it_is_public_document": [[0, 63, true], [63, 168, null], [168, 407, null], [407, 719, null], [719, 1415, null], [1415, 1601, null], [1601, 2279, null], [2279, 2553, null], [2553, 3137, null], [3137, 3361, null], [3361, 3647, null], [3647, 3981, null], [3981, 4210, null], [4210, 4369, null], [4369, 4517, null], [4517, 4969, null], [4969, 5319, null], [5319, 5660, null], [5660, 6041, null], [6041, 6393, null], [6393, 6853, null], [6853, 7352, null], [7352, 7865, null], [7865, 8292, null], [8292, 8768, null], [8768, 9236, null], [9236, 9429, null], [9429, 9638, null], [9638, 9656, null], [9656, 10000, null], [10000, 10473, null], [10473, 10763, null], [10763, 11250, null], [11250, 11604, null], [11604, 11733, null], [11733, 12061, null], [12061, 12281, null], [12281, 12597, null], [12597, 12627, null], [12627, 13241, null], [13241, 13576, null], [13576, 14031, null], [14031, 14466, null], [14466, 14567, null], [14567, 14661, null], [14661, 14870, null], [14870, 15059, null], [15059, 15413, null], [15413, 15889, null], [15889, 16031, null], [16031, 16335, null], [16335, 16778, null], [16778, 17137, null], [17137, 17238, null], [17238, 17396, null], [17396, 17589, null], [17589, 17840, null], [17840, 17985, null], [17985, 18072, null], [18072, 18490, null], [18490, 18912, null], [18912, 18930, null], [18930, 19318, null], [19318, 19475, null], [19475, 19595, null], [19595, 20019, null], [20019, 20267, null], [20267, 20484, null], [20484, 20770, null], [20770, 21319, null], [21319, 21555, null], [21555, 22055, null], [22055, 22513, null], [22513, 22729, null], [22729, 23066, null], [23066, 23385, null], [23385, 23652, null], [23652, 23665, null], [23665, 24163, null], [24163, 24275, null], [24275, 24729, null], [24729, 25255, null], [25255, 25485, null], [25485, 25485, null], [25485, 25485, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 25485, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, true], [5000, 25485, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25485, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25485, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25485, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25485, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25485, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25485, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25485, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25485, null]], "pdf_page_numbers": [[0, 63, 1], [63, 168, 2], [168, 407, 3], [407, 719, 4], [719, 1415, 5], [1415, 1601, 6], [1601, 2279, 7], [2279, 2553, 8], [2553, 3137, 9], [3137, 3361, 10], [3361, 3647, 11], [3647, 3981, 12], [3981, 4210, 13], [4210, 4369, 14], [4369, 4517, 15], [4517, 4969, 16], [4969, 5319, 17], [5319, 5660, 18], [5660, 6041, 19], [6041, 6393, 20], [6393, 6853, 21], [6853, 7352, 22], [7352, 7865, 23], [7865, 8292, 24], [8292, 8768, 25], [8768, 9236, 26], [9236, 9429, 27], [9429, 9638, 28], [9638, 9656, 29], [9656, 10000, 30], [10000, 10473, 31], [10473, 10763, 32], [10763, 11250, 33], [11250, 11604, 34], [11604, 11733, 35], [11733, 12061, 36], [12061, 12281, 37], [12281, 12597, 38], [12597, 12627, 39], [12627, 13241, 40], [13241, 13576, 41], [13576, 14031, 42], [14031, 14466, 43], [14466, 14567, 44], [14567, 14661, 45], [14661, 14870, 46], [14870, 15059, 47], [15059, 15413, 48], [15413, 15889, 49], [15889, 16031, 50], [16031, 16335, 51], [16335, 16778, 52], [16778, 17137, 53], [17137, 17238, 54], [17238, 17396, 55], [17396, 17589, 56], [17589, 17840, 57], [17840, 17985, 58], [17985, 18072, 59], [18072, 18490, 60], [18490, 18912, 61], [18912, 18930, 62], [18930, 19318, 63], [19318, 19475, 64], [19475, 19595, 65], [19595, 20019, 66], [20019, 20267, 67], [20267, 20484, 68], [20484, 20770, 69], [20770, 21319, 70], [21319, 21555, 71], [21555, 22055, 72], [22055, 22513, 73], [22513, 22729, 74], [22729, 23066, 75], [23066, 23385, 76], [23385, 23652, 77], [23652, 23665, 78], [23665, 24163, 79], [24163, 24275, 80], [24275, 24729, 81], [24729, 25255, 82], [25255, 25485, 83], [25485, 25485, 84], [25485, 25485, 85]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25485, 0.03991]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
4844b1dba18c57b4ab209aa7351013fc4966b6ca
|
[REMOVED]
|
{"Source-Url": "https://repository.tudelft.nl/islandora/object/uuid%3A8dee941d-9be4-4d45-a919-43e403c47a2e/datastream/OBJ/download", "len_cl100k_base": 4485, "olmocr-version": "0.1.50", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 24871, "total-output-tokens": 5969, "length": "2e12", "weborganizer": {"__label__adult": 0.0005450248718261719, "__label__art_design": 0.0016803741455078125, "__label__crime_law": 0.0009794235229492188, "__label__education_jobs": 0.01116943359375, "__label__entertainment": 0.00012409687042236328, "__label__fashion_beauty": 0.00032782554626464844, "__label__finance_business": 0.006702423095703125, "__label__food_dining": 0.00063323974609375, "__label__games": 0.00089263916015625, "__label__hardware": 0.0008740425109863281, "__label__health": 0.0015430450439453125, "__label__history": 0.0008654594421386719, "__label__home_hobbies": 0.0001838207244873047, "__label__industrial": 0.0010232925415039062, "__label__literature": 0.00156402587890625, "__label__politics": 0.0021305084228515625, "__label__religion": 0.0007462501525878906, "__label__science_tech": 0.2305908203125, "__label__social_life": 0.0003948211669921875, "__label__software": 0.016937255859375, "__label__software_dev": 0.71875, "__label__sports_fitness": 0.0002760887145996094, "__label__transportation": 0.0009083747863769532, "__label__travel": 0.0002505779266357422}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 21824, 0.06468]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 21824, 0.3181]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 21824, 0.85652]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 329, false], [329, 2628, null], [2628, 5583, null], [5583, 7982, null], [7982, 9299, null], [9299, 12230, null], [12230, 14450, null], [14450, 16785, null], [16785, 19721, null], [19721, 21824, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 329, true], [329, 2628, null], [2628, 5583, null], [5583, 7982, null], [7982, 9299, null], [9299, 12230, null], [12230, 14450, null], [14450, 16785, null], [16785, 19721, null], [19721, 21824, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 21824, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 21824, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 21824, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 21824, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 21824, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 21824, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 21824, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 21824, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 21824, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 21824, null]], "pdf_page_numbers": [[0, 0, 1], [0, 329, 2], [329, 2628, 3], [2628, 5583, 4], [5583, 7982, 5], [7982, 9299, 6], [9299, 12230, 7], [12230, 14450, 8], [14450, 16785, 9], [16785, 19721, 10], [19721, 21824, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 21824, 0.23009]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
378f961664365a6366877f7820e940adb31e3e73
|
Semaphores in Plan 9
Sape Mullender
Bell Laboratories
2018 Antwerp, Belgium
Russ Cox*
MIT CSAIL
Cambridge, Massachusetts 02139
1. Introduction
Semaphores are now more than 40 years old. Edsger W. Dijkstra described them in EWD 74 [Dijkstra, 1965 (in Dutch)]. A semaphore is a non-negative integer with two operations on it, P and V. The origin of the names P and V is unclear. In EWD 74, Dijkstra calls semaphores *seinpalen* (Dutch for signalling posts) and associates V with *verhoog* (increment/increase) and P with *prolaag*, a non-word resembling *verlaag* (decrement/decrease). He continues, “Opm. 2. Vele seinpalen nemen slechts de waarden 0 en 1 aan. In dat geval fungeert de V-operatie als ‘baanvak vrijgeven’; de P-operatie, de tentatieve passering, kan slechts voltooid worden, als de betrokken seinpaal (of seinpalen) op veilig staat en passering impliceert dan een op onveilig zetten.” (“Remark 2. Many signals assume only the values 0 and 1. In that case the V-operation functions as ‘release block’; the P-operation, the tentative passing, can only be completed, if the signal (or signals) involved indicates clear, and passing then implies setting it to stop.”) Thus, it may be that P and V were inspired by the railway terms *passeer* (pass) and *verlaat* (leave).
We discard the railway terminology and use the language of locks: P is *semacquire* and V is *semrelease*. The C declarations are:
```c
int semacquire(long *addr, int block);
long semrelease(long *addr, long count);
```
*Semacquire* waits for the semaphore value *addr* to become positive and then decrements it, returning 1; if the *block* flag is zero, *semacquire* returns 0 rather than wait. If *semacquire* is interrupted, it returns -1. *Semrelease* increments the semaphore value by the specified count.
Plan 9 [Pike et al., 1995] has traditionally used a different synchronization mechanism, called rendezvous. Rendezvous is a symmetric mechanism; that is, it does not assign different roles to the two processes involved. The first process to call rendezvous will block until the second does. In contrast, semaphores are an asymmetric mechanism: the process executing *semacquire* can block but the process executing
---
*a* Now at Google, Mountain View, California 94043
**semrelease** is guaranteed not to. We added semaphores to Plan 9 to provide a way for a real-time process to wake up another process without running the risk of blocking. Since then, we have also used semaphores for efficient process wakeup and locking.
2. **Hardware primitives**
The implementations in this paper assume hardware support for atomic read-modify-write operations on a single memory location. The fundamental operation is “compare and swap,” which behaves like this C function *cas*, but executes atomically:
```c
int
cas(long *addr, long old, long new)
{
/* Executes atomically. */
if(*addr != old)
return 0;
*addr = new;
return 1;
}
```
In one atomic operation, *cas* checks whether the value *addr* is equal to *old* and, if so, changes it to *new*. It returns a flag telling whether it changed *addr*.
Of course, *cas* is not implemented in C. Instead, we must implement it using special hardware instructions. All modern processors provide a way to implement compare and swap. The x86 architecture (since the 486) provides a direct compare and swap instruction, **CMPXCHG**. Other processors—including the Alpha, ARM, MIPS, and PowerPC—provide a pair of instructions called load linked (LL) and store conditional (SC). The LL instruction reads from a memory location, and SC writes to a memory location only if (1) it was the memory location used in the last LL instruction, and (2) that location has not been changed since the LL. On those systems, compare and swap can be implemented in terms of LL and SC.
The implementations also use an atomic addition operation **xadd** that atomically adds to a value in memory, returning the new value. We don’t need additional hardware support for **xadd**, since it can be implemented using **cas**:
```c
long
xadd(long *addr, long delta)
{
long v;
for(;;){
v = *addr;
if(cas(addr, v, v+delta))
return v+delta;
}
}
```
3. **User-space semaphores**
We implemented **semacquire** and **semrelease** as kernel-provided system calls. For efficiency, it is useful to have a semaphore implementation that, if there is no contention, can run entirely in user space, only falling back on the kernel to handle contention. Figure 1 gives the implementation. The user space semaphore, a **Usem**, consists of a user-level semaphore value *u* and a kernel value *k*:
typedef struct Usem Usem;
struct Usem {
long u;
long k;
};
When \( u \) is non-negative, it represents the actual semaphore value. When \( u \) is negative, the semaphore has value zero: acquirers must wait on the kernel semaphore \( k \) and releasers must wake them up.
```c
void usemacquire(Usem *s)
{
if(xadd(&s->u, -1) < 0)
while(semacquire(&s->k, 1) < 0){
/* Interrupted, retry */
}
}
```
```c
void usemrelease(Usem *s)
{
if(xadd(&s->u, 1) <= 0)
semrelease(&s->k, 1);
}
```
If the semaphore is uncontended, the \( \text{xadd} \) in \text{usemacquire} \ will return a non-negative value, avoiding the kernel call. Similarly, the \( \text{xadd} \) in \text{usemrelease} \ will return a positive value, also avoiding the kernel call.
4. Thread Scheduling
In the Plan 9 thread library, a program is made up of a collection of processes sharing memory. A thread is a coroutine assigned to a particular process. Within a process, threads schedule cooperatively. Each process manages the threads assigned to it, and the process schedulers run almost independently. The one exception is that a thread in one process might go to sleep (for example, waiting on a channel operation) and be woken up by a thread in a different process. The two processes need a way to coordinate, so that if the first has no runnable threads, it can go to sleep in the kernel, and then the second process can wake it up.
The standard Plan 9 thread library uses rendezvous to coordinate between processes. The processes share access to each other’s scheduling queues: one process is manipulating another’s run queue. The processes must also share a flag protected by a spin lock to coordinate, so that either both processes decide to call rendezvous or neither does.
For the real–time thread library, we wanted to remove as many sources of blocking as possible, including these locks. We replaced the locked run queue with a non-blocking array–based implementation of a producer/consumer queue. That implementation is beyond the scope of this paper. After making that change, the only lock remaining in the scheduler was the one protecting the “whether to rendezvous” flag. To eliminate that one, we replaced the rendezvous with a user–space semaphore counting the number of threads on the queue.
To wait for a thread to run, the process’s scheduler decrements the semaphore. If the run queue is empty, the `usemacquire` will block until it is not. Having done so, it is guaranteed that there is a thread on the run queue:
```c
// Get next thread to run
static Thread*
runthread(void)
{
Proc *p;
p = thisproc();
usemacquire(&p->nready);
return qget(&p->ready);
}
```
Similarly, to wake up a thread (even one in another process), it suffices to add the thread to its process’s run queue and then increment the semaphore:
```c
// Wake up thread t to run in its process.
static void
wakeup(Thread *t)
{
Proc *p;
p = t->p;
qput(&p->ready, t);
usemrelease(&p->nready);
}
```
This implementation removes the need for the flag and the lock; more importantly, the process executing `threadwakeup` is guaranteed never to block, because it executes `usemrelease`, not `usemacquire`.
5. Replacing spin locks
The Plan 9 user-level Lock implementation is an adapted version of the one used in the kernel. A lock is represented by an integer value: 0 is unlocked, non-zero is locked. A process tries to grab the lock by using a test–and–set instruction to check whether the value is 0 and, if so, set it to a non-zero value. If the lock is unavailable, the process loops, trying repeatedly. In a multiprocessor kernel, this is a fine lock implementation: the lock is held by another processor, which will unlock it soon. In user space, this implementation has bad interactions with the scheduler: if the lock is held by another process that has been preempted, spinning for the lock will not accomplish anything. The user–level lock implementation addresses this by rescheduling itself (with `sleep(0)` between attempts after the first thousand unsuccessful attempts. Eventually it backs off more, sleeping for milliseconds at a time between lock attempts.
We replaced these spin locks with a semaphore–based implementation. Using semaphores allows the process to tell the kernel exactly what it is waiting for, avoiding bad interactions with the scheduler like the one above. The semaphore–based implementation represents a lock as two values, a user–level key and a kernel semaphore:
```c
struct Lock
{
long key;
long sem;
};
```
The `key` counts the number of processes interested in holding the lock, including the
one that does hold it. Thus if `key` is 0, the lock is unlocked. If `key` is 1, the lock is held. If `key` is larger than 1, the lock is held by one process and there are `key`-1 processes waiting to acquire it. Those processes wait on the semaphore `sem`.
```c
void
lock(Lock *l)
{
if(xadd(&l->key, 1) == 1)
return; // changed from 0 -> 1: we hold lock
// otherwise wait in kernel
while(semacquire(&l->sem, 1) < 0){
/* interrupted; try again */
}
}
void
unlock(Lock *l)
{
if(xadd(&l->key, -1) == 0)
return; // changed from 1 -> 0: no contention
semrelease(&l->sem, 1);
}
```
Like the user-level semaphore implementation described above, the lock implementation handles the uncontented case without needing to enter the kernel.
The one significant difference between the user-level semaphores above and the semaphore-based locks described here is the interpretation of the user-space value. Plan 9 convention requires that a zeroed `Lock` structure be an unlocked lock. In contrast, a zeroed `Sema` structure is analogous to a locked lock: a `semacquire` on a zeroed `Sema` will block.
### 6. Kernel Implementation of Semaphores
Inside the Plan 9 kernel, there are two kinds of locks: the spin lock `Lock` spins until the lock is available, and the queuing lock `QLock` reschedules the current process until the lock is available. Because accessing user memory might cause a lengthy page fault, the kernel does not allow a process to hold a `Lock` while accessing user memory. Since the semaphore is stored in user memory, then, the obvious implementation is to acquire a `QLock`, perform the semaphore operations, and then release it. Unfortunately, this implementation could cause `semrelease` to reschedule while acquiring the `QLock`, negating the main benefit of semaphores for real-time processes. A more complex implementation is needed. This section documents the implementation. It is not necessary to understand the rest of the paper and can be skipped on first reading.
Each `semacquire` call records its parameters in a `Sema` data structure and adds it to a list of active calls associated with a particular `Segment` (a shared memory region). The `Sema` structure contains a kernel `Rendez` for use by sleep and wakeup (see [Pike et al., 1991]), the address, and a `waiting` flag:
struct Sema
{
Rendez;
long *addr;
int waiting;
Sema *next;
Sema *prev;
};
The list is protected by a Lock, which cannot cause the process to reschedule. The semaphore value *addr is stored in user memory. Thus, we can access the list only when holding the lock and we can access the semaphore value only when not holding the lock. The helper functions
void semqueue(Segment *s, long *addr, Sema *p);
void semdequeue(Segment *s, long *addr, Sema *p);
void semwakeup(Segment *s, long *addr, int n);
all manipulate the segment’s list of Sema structures. They acquire the associated Lock, perform their operations, and release the lock before returning. Semqueue and semdequeue add p to or remove p from the list. Semwakeup walks the list looking for n Sema structures with p.waiting set. It clears p.waiting and then wakes up the corresponding process.
Using those helper functions, the basic implementation of semacquire and semrelease is:
int
semacquire(Segment *s, long *addr)
{
Sema phore;
semqueue(s, addr, &phore);
for(;;){
phore.waiting = 1;
if(canacquire(addr))
break;
sleep(&phore, semawoke);
}
semdequeue(s, &phore);
semwakeup(s, addr, 1);
return 1;
}
long
semrelease(Segment *s, long *addr, long n)
{
long v;
v = xadd(addr, n);
semwakeup(s, addr, n);
return v;
}
(This version omits the details associated with returning -1 when interrupted and also with non-blocking calls.)
Semacquire adds a Sema to the segment’s list and sets phore.waiting. Then it attempts to acquire the semaphore. If it is unsuccessful, it goes to sleep. To avoid missed wakeups, sleep calls semawoke before committing to sleeping; semawoke simply
checks \texttt{phore.waiting}. Eventually, \texttt{canacquire} returns true, breaking out of the loop. Then \texttt{semacquire} removes its \texttt{Sema} from the list and returns.
The call to \texttt{semwakeup} at the end of \texttt{semacquire} corrects a subtle race that we found using Spin. Suppose process A calls \texttt{semacquire} and the semaphore has value 1. \texttt{Semacquire} queues its \texttt{Sema} and sets \texttt{phore.waiting}, \texttt{canacquire} succeeds (the semaphore value is now 0), and \texttt{semacquire} breaks out of the loop. Then process B calls \texttt{semacquire}: it adds itself to the list, fails to acquire the semaphore (the value is 0), and goes to sleep. Now process C calls \texttt{semrelease}: it increments the semaphore (the value is now 1) and looks for a single \texttt{Sema} in the list to wake up. It finds A’s, checks that \texttt{phore.waiting} is set, and then calls the kernel \texttt{wakeup} to wake A. Unfortunately, A never went to sleep. The wakeup is lost on A, which had already acquired the semaphore. If A simply removed its \texttt{Sema} from the list and returned, the semaphore value would be 1 with B still asleep. To account for the possibly lost wakeup, A must trigger one extra \texttt{semwakeup} as it returns. This avoids the race, at the cost of an unnecessary (but harmless) wakeup when the race has not happened.
7. Performance
To measure the cost of semaphore synchronization, we wrote a program in which two processes ping–pong between two semaphores:
- Process 1 blocks on the acquisition of Semaphore 1,
- Process 2 releases Semaphore 1 and blocks on Semaphore 2,
- Process 1 releases Semaphore 2 and blocks on Semaphore 1,
This loop executes a million times. We also timed a program that does two million acquires and two million releases on a semaphore initialized to two million, so that none of the calls would block. In both cases, there were a total of four million system calls; the ping–pong case adds two million context switches. Table 1 gives the results.
<table>
<thead>
<tr>
<th>processor</th>
<th>cpus</th>
<th>ping–pong</th>
<th>semacquire</th>
<th>semrelease</th>
</tr>
</thead>
<tbody>
<tr>
<td>PentiumIII/Xeon, 598 MHz</td>
<td>1</td>
<td>2.18</td>
<td>1.35</td>
<td>1.91</td>
</tr>
<tr>
<td>PentiumIII/Xeon, 797 MHz</td>
<td>2</td>
<td>0.887</td>
<td>0.949</td>
<td>1.38</td>
</tr>
<tr>
<td>PentiumIV/Xeon, 2196 MHz</td>
<td>4</td>
<td>0.970</td>
<td>1.38</td>
<td>1.84</td>
</tr>
<tr>
<td>AMD64, 2201 MHz</td>
<td>2</td>
<td>1.08</td>
<td>0.266</td>
<td>0.326</td>
</tr>
</tbody>
</table>
Table 1 Semaphore system call performance.
<table>
<thead>
<tr>
<th>processor</th>
<th>cpus</th>
<th>spin locks</th>
<th>semaphore locks</th>
</tr>
</thead>
<tbody>
<tr>
<td>PentiumIII/Xeon, 598 MHz</td>
<td>1</td>
<td>5.4</td>
<td>5.4</td>
</tr>
<tr>
<td>PentiumIII/Xeon, 797 MHz</td>
<td>2</td>
<td>18.2</td>
<td>5.6</td>
</tr>
<tr>
<td>AMD64, 2201 MHz</td>
<td>2</td>
<td>22.6</td>
<td>2.5</td>
</tr>
<tr>
<td>PentiumIV/Xeon, 2196 MHz</td>
<td>4</td>
<td>43.8</td>
<td>4.9</td>
</tr>
</tbody>
</table>
Table 2 Performance of spin locks versus semaphore locks.
Next, we looked at lock performance, comparing the conventional Plan 9 locks from \texttt{libc} to the new ones using semaphores for sleep and wakeup. We ran Doug McIlroy’s power series program [McIlroy, 1990], which spends almost all its time in channel communication. The Plan 9 thread library’s channel implementation uses a
single global lock to coordinate all channel activity, inducing a large amount of lock contention. The application creates a thousand processes and makes 207,631 lock calls. The number of locks (in the semaphore version) that require waiting (i.e., a semacquire is done) varies wildly. In 20 runs, the smallest number we saw was 127, the largest was 490, and the average was 288.
Table 2 shows the performance results. Surprisingly, the performance difference was most pronounced on multiprocessors. Naively, one would expect that spinning would have some benefit on multiprocessors whereas it could have no benefit on uniprocessors, but it turns out that spinning without rescheduling (the first 1000 tries) has no effect on performance. Contention only occurs some 500 or so times, and the time it takes to spin 500,000 times is in the noise. The difference between uniprocessors and multiprocessors here is that on uniprocessors, the first\( \text{sleep}(0) \) will put the process waiting for the lock at the back of the ready queue so that, by the time it is scheduled again, the lock will likely be available. On multiprocessors, contention from other processes running simultaneously makes yielding less effective. It is also likely that the repeated atomic read–modify–write instructions, as in the tight loop of the spin lock, can slow the entire multiprocessor.
The performance of the semaphore–based lock implementation is sometimes much better, and never noticeably worse, than the spin locks. We will replace the spin lock implementation in the Plan 9 distribution soon.
8. Comparison with other approaches
Any operating system with cooperating processes must provide an interprocess synchronization mechanism. It is instructive to contrast the semaphores described here with mechanisms in other systems.
Many systems—for example, BSD, Mach, OS X, and even System V UNIX—provide semaphores [Bach, 1986]. In all those systems, semaphores must be explicitly allocated and deallocated, making them more cumbersome to use than \text{semacquire} and \text{semrelease}. Worse, semaphores in those systems occupy a global id space, so that it is possible to run the system out of semaphores just by running programs that allocate semaphores but neglect to deallocate them (or crash). The Plan 9 semaphores identify semaphores by a shared memory location; two processes are talking about the same semaphore if \text{*addr} is the same word of physical memory in both. Further, there is no kernel–resident semaphore state except when \text{semacquire} is blocking. This makes the semaphore leaks of System V impossible.
Linux provides a lower–level system call named futex [Franke and Russell, 2002]. Futex is essentially “compare and sleep,” making it a good match for compare and swap–based algorithms. Futex also matches processes based on shared physical memory, avoiding the System V leak problem. Because futex only provides “compare and sleep” and “wakeup,” futex–based algorithms are required to handle the uncontended cases in user space, like our user–level semaphore and new lock implementations do. This makes futex–based implementations efficient; unfortunately, they are also quite subtle. The original example code distributed with futexes was wrong; a correct version was only published a year later [Drepper, 2003]. In contrast, semaphores are less general but easier to understand and to use correctly.
References
[Bach, 1986]
[Dijkstra, 1965]
(http://www.cs.utexas.edu/users/EWD/ewd00xx/EWD74.PDF,
http://www.cs.utexas.edu/users/EWD/transcriptions/EWD00xx/EWD74.html)
[Drepper, 2003]
U. Drepper, “Futexes are Tricky,” published online at
[Franke and Russell, 2002]
[Holzmann, 1991]
[Pike et al., 1991]
[Pike et al., 1995]
[Plan 9, 2000]
*Plan 9 Manual*, 3rd edition published online at
http://plan9.bell-labs.com/sys/man
|
{"Source-Url": "https://swtch.com/semaphore.pdf", "len_cl100k_base": 5310, "olmocr-version": "0.1.49", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 57426, "total-output-tokens": 6057, "length": "2e12", "weborganizer": {"__label__adult": 0.00046634674072265625, "__label__art_design": 0.0004825592041015625, "__label__crime_law": 0.000415802001953125, "__label__education_jobs": 0.0004482269287109375, "__label__entertainment": 0.00013577938079833984, "__label__fashion_beauty": 0.00019121170043945312, "__label__finance_business": 0.00034880638122558594, "__label__food_dining": 0.0004930496215820312, "__label__games": 0.0007219314575195312, "__label__hardware": 0.01097869873046875, "__label__health": 0.0005736351013183594, "__label__history": 0.0004799365997314453, "__label__home_hobbies": 0.00018155574798583984, "__label__industrial": 0.0010499954223632812, "__label__literature": 0.0002834796905517578, "__label__politics": 0.0003819465637207031, "__label__religion": 0.0006880760192871094, "__label__science_tech": 0.24755859375, "__label__social_life": 9.59634780883789e-05, "__label__software": 0.013275146484375, "__label__software_dev": 0.71923828125, "__label__sports_fitness": 0.000415802001953125, "__label__transportation": 0.0010890960693359375, "__label__travel": 0.00027680397033691406}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 21461, 0.02736]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 21461, 0.48263]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 21461, 0.85581]], "google_gemma-3-12b-it_contains_pii": [[0, 2272, false], [2272, 4665, null], [4665, 6984, null], [6984, 9341, null], [9341, 11690, null], [11690, 13534, null], [13534, 16840, null], [16840, 20271, null], [20271, 21461, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2272, true], [2272, 4665, null], [4665, 6984, null], [6984, 9341, null], [9341, 11690, null], [11690, 13534, null], [13534, 16840, null], [16840, 20271, null], [20271, 21461, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 21461, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 21461, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 21461, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 21461, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 21461, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 21461, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 21461, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 21461, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 21461, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 21461, null]], "pdf_page_numbers": [[0, 2272, 1], [2272, 4665, 2], [4665, 6984, 3], [6984, 9341, 4], [9341, 11690, 5], [11690, 13534, 6], [13534, 16840, 7], [16840, 20271, 8], [20271, 21461, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 21461, 0.05286]]}
|
olmocr_science_pdfs
|
2024-11-25
|
2024-11-25
|
647a40b4ccc8cc46d61cd2fd78beda10b88ad79c
|
Parallel Programming Concepts
Jon Johansson
AICT, University of Alberta
Help!!!
• the people who can help port, compile, debug, and run your parallel programs:
support@westgrid.ca
Serial Programming
- von Neumann architecture executes a program serially (one instruction at a time)
- to speed up we can:
- optimize the program
- move to the fastest hardware
- change the algorithms
- it’s difficult to speed up a well-written program
- the program is generally straightforward to write
It’s Not Easy to Make it Fast
"Sequential programming is really hard, and parallel programming is a step beyond that."
– Andrew Tanenbaum, quoted at the June 2008 Usenix conference
MINIX 3:
http://www.minix3.org/
What and How to Program??
parallel programming environments
OpenMP, MPI, HPF, TBB, Erlang, Shmem, Ct, CUDA, DirectCompute, OpenCL, Portals, ZPL, BSP, CHARM++, Cilk, Co-array Fortran, PVM, Pthreads, Windows threads, Tstreams, GA, Java, UPC, Titanium, Parlog, NESL, Split-C, etc.
parallel processing hardware
x86 Cluster
GPGPU
FPGA
Cell processor
A Big Job in the Kitchen
• what does the chef do when faced with a big job?
• too many meals for one cook to prepare in the given time
• split the work over a team of cooks
A Big Job in the Kitchen
• try to split the work into pieces that can be done by different people
• distribute the work to the team members
• we can organize the workers and resources in a couple of ways
A Big Job in the Kitchen
• put all the chefs in a common environment
• all the resources are available to all the chefs
• large pile of food and utensils
• some resources are limited
• they need to organize sharing
– take turns with the only knife
A Big Job in the Kitchen
- chefs can communicate with messages on space they can all see
A Big Job in the Kitchen
- give each chef access to his own resources
- everyone has his own set of food, utensils and ovens
- each chef has only enough resources to do his task
A Big Job in the Kitchen
- to communicate use a phone to coordinate finishing the meal at the same time
- appetizer needs to be done and served before main course, before dessert
Dividing the Tasks
- some of the work can be done in parallel
- some work can only be done serially
- some work needs to be completed before other work can continue
- consider a team of chefs with one person to clear and serve
Why Parallel Programming?
- would like to use a number of processors at the same time to speed up calculations
- the problem must be broken into parts that can be solved concurrently
- each part of the problem becomes a program to run on its own processor
- programming becomes more complex
Why Parallel Programming?
- if we can use many CPUs efficiently, we can
- run simulations faster
- increase problem sizes
- run simulations at greater accuracy
- run a program on a cpu that can provide 1 gigaflop/s ($10^9$ flop/s)
- if you need 1 teraflop/s ($10^{12}$ flop/s) to finish the calculation in a reasonable time you can use 1000 cpus
- you need to use them efficiently!
Terminology
• **parallel computing** – harnessing a bunch of processors on the same machine to run your computer program
• note that this is one machine
• generally a homogeneous architecture
– same processors, memory, operating system
• all the machines in the Top 500 are in this category
Terminology
• cluster:
– a set of generally homogeneous machines
– originally built using low-cost commodity hardware
• to increase density, clusters are now commonly built with 1-u rack servers or blades
– can use standard network interconnect or high performance interconnect such as Infiniband or Myrinet
• cluster hardware is becoming quite specialized
– thought of as a single machine with a name, e.g. “checkers” – checkers.westgrid.ca
Types of Parallelism
- **Task parallelism**
- Different programs operate on copies of the same data
- *functional decomposition*
- **Data parallelism**
- Copies of the same program operate on different data
- *domain decomposition*
**Different programs operate on copies of the same data**
- Consider 3 tasks that take equal times to complete: T₁, T₂, T₃
- And a bunch of data to run the tasks on
- We break the data into 9 equal sized pieces
- Each task operating on a chunk of data takes 1 unit of time
- There are 27 time units of work to be done in this situation
- For example:
- T₁ → multiply by 5
- T₂ → apply sin(x)
- T₃ → take square root
Types of Parallelism
Task parallelism
Data parallelism
- either tasks are concurrent or data is crunched concurrently
- processing time is now 9 time units
Pipelining
- we can mix the parallelism
- a task processes some data and then passes the data on to the next task
- total time to process all the data is 11 time units
Domain Decomposition
- data can be decomposed in different ways
- depends on how you want to schedule the work
- finer grain may make load balancing easier
- depends on the problem
Processes and threads
- A process is created by the operating system, and requires a fair amount of "overhead".
- Processes contain information about program resources and program execution state, including:
- Process ID, process group ID, user ID, and group ID
- Environment
- Program instructions
- Registers, Stack, Heap
- Inter-process communication tools (such as message queues, pipes, semaphores, or shared memory).
- a thread is defined as an independent stream of instructions that can be scheduled to run as such by the operating system
A serial program runs a single thread
- a computer program exists as an executable file on your computer
- a **process** is an instance of a computer program that is being sequentially executed by a computer system that has the ability to run several computer programs concurrently.
Parallel Processing Categories
- we can broadly classify parallel processing into these categories:
- **Thread Parallelism** – use a single process with multiple threads to perform a set of tasks
- OpenMP, Pthreads (*shared memory for communication*)
- **Process Parallelism** – use more than one process to perform a set of tasks
- MPI (*message passing for communication*)
- **Hybrid Parallelism** – use multiple processes, some of which can have multiple threads
- MPI + OpenMP
Operating systems
- an Operating System (OS) is an interface between the computer hardware and the user
- the operating system manages and coordinates the sharing of the computer’s resources
<table>
<thead>
<tr>
<th>Tools and Applications (ls, grep, env, pine)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Shell (cd, setenv, history)</td>
</tr>
<tr>
<td>Kernel</td>
</tr>
<tr>
<td>Hardware</td>
</tr>
</tbody>
</table>
Architectures
- Symmetric Multiprocessing (SMP)
- Uniform Memory Access (UMA)
- multiple CPUs, residing in one cabinet, share the same memory
- processors and memory are tightly coupled
- the processors share memory and the I/O bus or data path
Memory
Memory Bus
CPU CPU CPU
Architectures
• SMP
– a single copy of the operating system is in charge of all the processors
– SMP systems range from two to as many as 32 or more processors
Architectures
• UMA-SMP negatives
– as the number of CPUs get large the buses become saturated
– long wires cause latency problems
Architectures
• Non-Uniform Memory Access (NUMA)
– NUMA is similar to SMP - multiple CPUs share a single memory space
• hardware support for shared memory
– memory is separated into close and distant banks
• basically a cluster of SMPS
– memory on the same processor board as the CPU (local memory) is accessed faster than memory on other processor boards (shared memory)
• hence "non-uniform"
– NUMA architecture scales much better to higher numbers of CPUs than SMP
Architectures
- Cache Coherent NUMA (ccNUMA)
- each CPU has an associated cache
- ccNUMA machines use special-purpose hardware to maintain cache coherence
- typically done by using inter-processor communication between cache controllers to keep a consistent memory image when the same memory location is stored in more than one cache
- ccNUMA performs poorly when multiple processors attempt to access the same memory area in rapid succession
Distributed Memory Multiprocessor (DMMP)
- each computer has its own memory address space
- looks like NUMA but there is no hardware support for remote memory access
- the special purpose switched network is replaced by a general purpose network such as Ethernet or more specialized interconnects:
- Infiniband
- Myrinet
- all computer clusters look like this now
- Lattice was decommissioned on Nov. 3, 2009
Lattice: Calgary’s HP ES40 and ES45 cluster – each node has 4 processors
Architectures
- Massively Parallel Processing (MPP) Cluster of commodity PCs
- processors and memory are loosely coupled
- "capacity computing"
- each CPU contains its own memory and copy of the operating system and application.
- each subsystem communicates with the others via a high-speed interconnect.
- in order to use MPP effectively, a problem must be breakable into pieces that can all be solved simultaneously
Today’s Common System Architecture
Architectures
• lots of “how to build a cluster” tutorials on the web – just Google:
• http://www.beowulf.org/
• http://www.cacr.caltech.edu/beowulf/tutorial/building.html
Parallel Programming
• need to do something to your program to use multiple processors
• need to incorporate commands into your program which allow multiple threads to run
• one thread per processor
• each thread gets a piece of the work
• several ways (APIs) to do this ...
OpenMP
• Open Multi-Processing (OpenMP)
• introduce statements into your code that look like comments to a serial compiler
– in C: #pragma
– in FORTRAN: C$OMP or !$OMP
• can compile serial and parallel executables from the same source code
• restricted to shared memory machines
– not clusters!
• www.openmp.org
Threads
• a thread is defined as an independent stream of instructions that can be scheduled to run as such by the operating system
– this means that executing threads can be started and stopped by the OS
– threads can move from one CPU to another while executing
• a process can contain many threads
How to See The Threads?
• Windows Task Manager on a 4-core system
• “spinparallel.exe”
• OMP_NUM_THREADS=2
• OMP_NUM_THREADS=3
• OMP_NUM_THREADS=4
How to See The Threads?
- use “Top” on the cluster: “spinparallel”
- toggle views with “shift-h” i.e. “H”
To see threads on the Cluster
- use the command:
```bash
ps -elf | grep <your_program_name>
```
OpenMP Threads
- OpenMP uses the “fork-join” model of parallel execution
- all OpenMP programs begin as a single process: the master thread
- when the master thread encounters a parallel region it creates a team of parallel threads
OpenMP Threads
- to create a parallel region in OpenMP use the pragma (in C):
```c
#pragma omp parallel
{
// code here
}
```
- the block of code in the parallel region is run by all threads
Compile and Run
- to compile your program with OpenMP using gfortran
gfortran -fopenmp -o prog prog.f90
- to run with N threads set the environment variable OMP_NUM_THREADS
export OMP_NUM_THREADS=2
- you might need to set the following
export OMP_DYNAMIC=false
---
Activity 2 - A Parallel Program
- add OMP directives to the serial program
- they look like comments to the compiler unless compiling for OpenMP
- compile with:
gfortran -fopenmp -o spinparallel spinparallel.f90
Program SpinParallel
Implicit None
!$OMP Parallel
Do While (.true. )
! Spinning my wheels
End Do
!$OMP End Parallel
End Program SpinParallel
Activity 2 - A Parallel Program
- run the program with 1, 2 and 4 threads
`export OMP_NUM_THREADS=4`
- observe the threads with both top and the ps command
```
Program SpinParallel
Implicit None
!$OMP Parallel
Do While(.true.)
! Spinning my wheels
End Do
!$OMP End Parallel
End Program SpinParallel
```
Activity 3 - A Parallel Program
- change the infinite loop to a print statement
- compile and run serial and parallel versions of the program with 1, 2 and 4 threads
`export OMP_NUM_THREADS=4`
```
Program HelloWorld
Implicit None
!$OMP Parallel
Print*, "Hello World"
!$OMP End Parallel
End Program HelloWorld
```
Posix Threads (pthreads)
- Posix threads provide a standardized programming interface for the creation of threads on a Unix system
- creating and managing a process requires much more operating system overhead than thread creation and management
- the work is packaged in a function which is passed to the thread when it is created
Thread Creation is Relatively Fast
<table>
<thead>
<tr>
<th>Platform</th>
<th>fork() Real Time (= Wall time??)</th>
<th>pthread_create() Real Time (= Wall time??)</th>
<th>Ratio</th>
</tr>
</thead>
<tbody>
<tr>
<td>AMD 2.4 GHz Opteron (8cpus/node)</td>
<td>41.07</td>
<td>0.66</td>
<td>62</td>
</tr>
<tr>
<td>IBM 1.9 GHz POWER5 p5-575 (8cpus/node)</td>
<td>64.24</td>
<td>1.75</td>
<td>37</td>
</tr>
<tr>
<td>IBM 1.5 GHz POWER4 (8cpus/node)</td>
<td>104.05</td>
<td>2.01</td>
<td>52</td>
</tr>
<tr>
<td>INTEL 2.4 GHz Xeon (2 cpus/node)</td>
<td>54.95</td>
<td>1.64</td>
<td>34</td>
</tr>
<tr>
<td>INTEL 1.4 GHz Itanium2 (4 cpus/node)</td>
<td>54.54</td>
<td>2.03</td>
<td>27</td>
</tr>
</tbody>
</table>
Timings reflect 50,000 process/thread creations, were performed with the time utility, and units are in seconds, no optimization flags
Thread Creation
- **pthread_create()** arguments:
- **thread**: a unique identifier for the new thread returned by the subroutine
- **attr**: an attribute object that may be used to set thread attributes
- you can specify a thread attributes object, or NULL for the default values
- **start_routine**: the C routine that the thread will execute once it is created.
- **arg**: a single argument that may be passed to `start_routine()`
- It must be passed by reference as a pointer cast of type void. NULL may be used if no argument is to be passed.
Posix Threads
- your **main()** program is the single, default first thread
- all other threads must be explicitly created by the programmer
- after a thread is created, the OS schedules when it will execute
Threads
• we have a bunch of threads doing the same thing
• we need to split the work between threads
• each thread in a team has a unique identifier
• get the thread id with the OMP runtime function
\[Omp\_Get\_Thread\_Num()\]
• the function returns an integer
---
Activity 4 – Thread IDs
• use the runtime function
\[omp\_get\_thread\_num()\]
• change the print statement to include the output of the function
• run the program with 1, 2, 4 and 16 threads
export OMP_NUM_THREADS=4
Sharing the Work
• we now have enough to split the work between threads
• use a “Select-Case” structure to control the work that a thread does
• this construct allows both task and data parallelism
\[
\text{thrld} = \text{omp_get_thread_num()}
\]
\[
\text{Select Case}(\text{thrd})
\]
\[
\text{Case(0)} \quad ! \text{The master thread}
\text{Put work code here}
\]
\[
\text{Case(1)} \quad ! \text{Team member}
\text{Put work code here}
\]
\[
\text{Case Default}
\text{Default work}
\]
\[
\text{End Select}
\]
Activity 5(a) - Sharing the Work
• write serial program that does the following tasks and prints the results:
- \(6 + 5 = ?\)
- \(16 / 4 = ?\)
- Print “I am a computer”
- Print “Boo!”
• use a “Select-Case” structure to control the work that a thread does
Activity 5(b) - Sharing the Work
• modify your serial program by placing the tasks in a parallel section and run the program with 4 threads
– how many results are printed?
• use a “Select-Case” structure to control the work that a thread does and split the work between 4 threads
• run the program with 4 threads
• run the program with 5 threads, does it behave sensibly? (Use the “Case Default”)
OpenMP
• compiler directive based; can use serial code
• jointly defined and endorsed by a group of major computer hardware and software vendors
– OpenMP Fortran API was released October 28, 1997
– C/C++ API was released in late 1998
• portable/multi-platform, including Unix and Windows NT platforms
• can be very easy and simple to use – provides for "incremental parallelism"
• www.openmp.org
OpenMP Directives
- free format Fortran files can contain only one OMP sentinel (the text string that begins a directive)
!$OMP
- the directive has the form
!$OMP directive-name optional_clauses...
- a directive may appear anywhere on a line
- preceded only by whitespace
- an ampersand (&) at the end of the line identifies a continued line.
- Fortran comments may appear on the directive line, initiated by an exclamation mark (!)
- the rest of the line is ignored
Conditional Compilation
- the OpenMP Fortran API accepts a conditional compilation sentinel
- for free format source files this is
!$
- this sentinel can appear in any column, preceded only by white space
- must appear as a single word
- Fortran free format conventions apply to the rest of the line
!$ iam = OMP_GET_THREAD_NUM() + &
!$ index
- with OpenMP compilation enabled, the sentinel is replaced by two blanks
Conditional Compilation
• the following shows the most straightforward and common use of the conditional compilation sentinel in F95
\[
\text{integer :: Thrd\_id}
\]
\[
\ldots
\]
\[
\text{Thrd\_id} = 0
\]
\[
!$ \text{Thrd\_id} = \text{omp\_get\_thread\_num()}
\]
• the OMP runtime function is only executed if the file is compiled with OpenMP enabled
Message Passing Interface (MPI)
• a standard set of communication subroutine libraries
– works for SMPs and clusters
• programs written with MPI are highly portable
• information and downloads
MPI
• supports the SPMD, single program multiple data model
– all processors use the same program
– each processor has its own data
• think of a cluster – each node is getting a copy of the program but running a specific portion of it with its own data
Parallel Programming
• starting mpi jobs is not standard
– for mpich2 use “mpiexec”
• start a job with 6 processes
• 6 copies of the program run in the default Communicator Group “MPI_COMM_WORLD”
• each process has an ID – its “rank”
Parallel Programming
- example: start N processes to calculate N-1 factorial
- 0! = 1
- 1! = 1
- 2! = 2 x 1 = 2
- 3! = 3 x 2 x 1 = 6
- ...
- n! = n x (n-1) x...x 2 x 1
Parallel Programming
- generally the master process will:
- send work to other processes
- receive results from processes that complete
- send more work to those processes
- do final calculations
- output results
- designing an efficient algorithm for all this is up to you
Parallel Programming
- note that getting data through messages can be 10 to 1000 times slower than accessing local main memory
- try to keep the amount of data that you need to send between processes down
the basic structure of an MPI program is what we’ve seen in exercise 5(b)
get the rank of the process
do work allocation based on the rank
Select Case(rank)
Case(0) ! The master process
! Put work code here
Case(1) ! Process 1
! Put work code here
Case Default
! Default work
End Select
Parallel Programming
• it’s possible to combine OpenMP and MPI for running on clusters of SMP machines
• the trick in parallel programming is to keep all the processors
– working ("load balancing")
– working on data that no other processor needs to touch (there aren’t any cache conflicts)
• parallel programming is generally harder than serial programming
Loops
• the bulk of parallelizable work in a program typically resides in repetitive sections
• how to split the work in a loop between threads?
• split range of the index between threads
Do i = 1, 1000
R(i) = A(i) + B(i)*C(i)
End Do
Thread 1:
Do i = 1, 500
R(i) = A(i) + B(i)*C(i)
End Do
Thread 2:
Do i = 501, 1000
R(i) = A(i) + B(i)*C(i)
End Do
Activity 6(a) – Sharing Loops
- write a serial program which initializes an array of length 1000
- all array elements have value 1.0
- sum the array elements and print out the result
- use a Select-Case to split the work over 2 threads
- what happens?
```
Real :: a(1000)
a = 1.0
sum = 0.0
Do i = 1, 1000
sum = sum + a(i)
End Do
Print*, "The sum is: ", sum
```
Activity 6(b) – Sharing Loops
- use a Select-Case to split the work over 2 threads
- what happens?
- any ideas what might be going on?
```
!$OMP Parallel
thrdId = omp_get_thread_num()
Select Case(thrdId)
Case(0) ! The master thread
Do i = 1, 500
sum = sum + a(i)
End Do
Write(*, "(F12.5)") sum
Case(1) ! Team member
Do i = 501, 1000
Case Default
Write(*, "(I2)") thrdId
End Select
End Select
End Select!
$OMP End Parallel
```
Shared Memory
- a process has access to memory
- the threads that run as part of that process have access to that memory
Speedup
- how can we measure how much faster our program runs when using more than one processor?
- define Speedup $S$ as:
- the ratio of 2 program execution times
- constant problem size
- $T_1$ is the execution time for the problem on a single processor (use the “best” serial time)
- $T_P$ is the execution time for the problem on $P$ processors
$$S = \frac{T_1}{T_P}$$
Speedup
- **Linear speedup**
- the time to execute the problem decreases by the number of processors
- if a job requires 1 week with 1 processor it will take less than 10 minutes with 1024 processors
- **Sublinear speedup**
- the usual case
- there are generally some limitations to the amount of speedup that you get
- communication
Speedup
• **Superlinear speedup**
– very rare
– memory access patterns may allow this for some algorithms
---
Speedup
• why do a speedup test?
• it’s hard to tell how a program will behave
• e.g.
– “Strange” is actually fairly common behaviour for untuned code
– in this case:
• linear speedup to ~10 cpus
• after 24 cpus speedup is starting to decrease
Speedup
• to use more processors efficiently change this behaviour
– change loop structure
– adjust algorithms
– ??
• run jobs with 10-20 processors so the machines are used efficiently
![Graph showing Speedup vs Number of CPUs]
Copyright 2009, University of Alberta Parallel Programming, Nov. 4, 2009
Speedup
• one class of jobs that have linear speed up are called “embarrassingly parallel”
– a better name might be “perfectly” parallel
• doesn’t take much effort to turn the problem into a bunch of parts that can be run in parallel:
– parameter searches
– rendering the frames in a computer animation
– brute force searches in cryptography
Speedup
we have been discussing Strong Scaling
- the problem size is fixed and we increase the number of processors
• decrease computational time (Amdahl Scaling)
- the amount of work available to each processor decreases as the number of processors increases
- eventually, the processors are doing more communication than number crunching and the speedup curve flattens
- difficult to have high efficiency for large numbers of processors
we are often interested in Weak Scaling
- double the problem size when we double the number of processors
• constant computational time (Gustafson scaling)
- the amount of work for each processor has stays roughly constant
- parallel overhead is (hopefully) small compared to the real work the processor does
• e.g. Weather prediction
Amdahl’s Law
- Gene Amdahl: 1967
- parallelize some of the program – some must remain serial
- \( f \) is the fraction of the calculation that is serial
- \( 1-f \) is the fraction of the calculation that is parallel
- the maximum speedup that can be obtained by using \( P \) processors is:
\[
S_{\text{max}} = \frac{1}{f + \frac{(1-f)}{P}}
\]
Amdahl’s Law
- if 25% of the calculation must remain serial
the best speedup you can obtain is 4
- need to parallelize as much of the program as possible to get the best advantage from multiple processors
Granularity
- a qualitative measure of the ratio between computation and communication or synchronization
- fine-grain: a small amount of work is done before communication is required
- coarse-grain: a large amount of work is done before communication is required
Parallel Errors
- there are two types of errors that occur only in a parallel program:
- **Race Conditions**
- a result depends on which thread executes a section of code first
- this leads to unpredictable results
- **Deadlocks**
- two threads are each waiting for a result from the other
- no work gets done
Example: Convolution - discrete
- In 2 dimensions the convolution is:
\[(f * g)_{m,n} = \sum_{i,j=-\infty}^{\infty} f_{i,j} g_{m-i,n-j}\]
- Apply a 3x3 filter to the image
\[g \rightarrow \quad f \rightarrow\]
Convolution - discrete
- For each image point:
- Multiply the corresponding filter and image values
- Sum the result
- Multiply by a normalizing factor if necessary
- For a 3x3 filter each new image point requires 9 multiplies and 8 adds
Convolution - discrete
\[(f * g)_{2,2} = \sum_{i,j=1}^{3} f_{i,j} g_{2-i,2-j}\]
\[= f_{1,1} g_{1,1} + f_{1,2} g_{1,0} + f_{1,3} g_{1,-1}\]
\[+ f_{2,1} g_{0,1} + f_{2,2} g_{0,0} + f_{2,3} g_{0,-1}\]
\[+ f_{3,1} g_{-1,1} + f_{3,2} g_{-1,0} + f_{3,3} g_{-1,-1}\]
Image Padding
• pixels at the edge of the image aren’t surrounded
• convolution operations can’t be done
• need some special handling
• add pixels around the image: “padding”
– pad with zeros
– copy the edge row or column as many times as necessary
– mirror the image
Convolution Calculation – Serial
- the calculation involves 4 nested loops
- two outside loops move over the image
- two inside loops do multiplication and sum for new image point
- image size: 7000x7000
- filter size: 7x7
- Serial times:
- program: 34.13 sec
- loops: 29.7 sec
- serial section: 4.42 sec
- max speedup = 34.13/4.42 = 7.7
```c
for(i = offset; i < nx + offset; i++) {
for(j = offset; j < ny + offset; j++) {
// Operate in each pixel in the image with the filter
sum = 0.0;
for(m = 0; m < nf; m++) {
for(n = 0; n < nf; n++) {
sum = sum + filter[m][n] * paddedimage[i-offset+m][j-offset+n];
}
}
newimage[i][j] = sum;
}
}
```
Convolution Calculation - OpenMP
- to create OpenMP threads and tell OpenMP that we are parallelizing a loop we can combine two directives:
- `#pragma omp parallel`
- and
- `#pragma omp for`
- into the directive
- `#pragma omp parallel for`
```c
#pragma omp parallel for private (i,j,m,n,sum) schedule(dynamic,1) {
for(i = offset; i < nx + offset; i++) {
for(j = offset; j < ny + offset; j++) {
// Operate in each pixel in the image with the filter
sum = 0.0;
for(m = 0; m < nf; m++) {
for(n = 0; n < nf; n++) {
sum = sum + filter[m][n] * paddedimage[i-offset+m][j-offset+n];
}
}
newimage[i][j] = sum;
}
}
}
```
Convolution Calculation - OpenMP
- **clauses** modify the behaviour of the loop
```cpp
#pragma omp parallel for private (i,j,m,n,sum)
schedule(dynamic,1)
{
for(i = offset; i < nx + offset; i++) {
for(j = offset; j < ny + offset; j++) {
// Operate in each pixel in the image with the filter
sum = 0.0;
for(m = 0; m < nf; m++) {
for(n = 0; n < nf; n++) {
sum = sum + filter[m][n] * padded_image[i-offset+m][j-offset+n];
}
}
newimage[i][j] = sum;
}
}
}
```
- each thread has its own copy of these variables
- `schedule(dynamic,1)`
- each thread gets a "chunk" of work of size 1
- when the work is done the thread requests another chunk
---
OpenMP Speedup
Loop parallelizes nicely
Amdahl limit $S = 7.7$
Serial work prevents the program from speeding up well
Gustafson’s Law
- keep the total time of execution fixed
- the serial part of the program is fixed
- increase the parallel work as the number of processors N increases – increase grid size
- work done by each thread is constant
\[ S = N - f(N - 1) \]
f is the serial fraction of the program
S is the speedup
OpenMP - Gustafson's Law, 7000x7000 image
- 16 threads
- 9 threads
- 4 threads
- 1 thread
- 28x28 filter
- 21x21 filter
- 14x14 filter
- 7x7 filter
Convolution Calculation – MPI
- rewrite the program to include the MPI functions
- make decisions about what work to do based on the rank of the process
- the master process gathers the results
- MPI_GATHER is a serial process
```c
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
if (rank == 0) {
// do something
}
// Get the results
MPI_Gather(...);
MPI_Finalize();
```
MPI_Gather()
- Gathers together values from a group of processes
- This subroutine collects individual messages from each task in comm at the root task and stores them in rank order
- image: 7000x7000
- filter: 7x7
- time for the MPI_Gather()
- 4 sec for 2 processes
- 15 sec for 14 processes
Implicit Parallelism in Matlab
- Matlab can use multiple threads running in a single Matlab instance
- speed up element wise computations, or those that use the BLAS library
- set/get the number of threads using maxNumCompThreads
- this is enabled by default as of Matlab 2009
- disable multithreaded computation by starting MATLAB with the option matlab -singleCompThread
Element wise:
>> x = rand(15000, 15000);
>> z = sin(x);
Using BLAS:
>> x = rand(3000, 3000);
>> y = x;
>> x * y;
Explicit Parallelism in Matlab
• Matlab can use multiple processes running on one machine, or a cluster of machines
• requires the Parallel Computing Toolbox
– one license gives up to 8 worker processes
• use “parfor” to parallelize a loop
• work in the loop must be independent for each iteration
Start 3 worker processes:
```
matlabpool 3
```
Serial work:
```
x = rand(15000, 15000);
for k = 1:15000;
vec = x(:, k);
y(:, k) = log(vec + 1.0);
end
```
Parallel work:
```
parfor k = 1:15000;
...
end
```
```
matlabpool close
```
Summary
• parallel programming is a bit harder than serial
• threads (OpenMP) vs processes (MPI)
– each thread/process has a unique identity that it can use to control the work that it does
• you don’t know how efficiently your program uses multiple processors until you do a speedup test
• do a speedup test
• DO a speedup test!
• MPI session in 2 weeks with Masao ...
Resources
- OpenMP docs: http://openmp.org/wp/
- MPICH2 docs: http://www.mcs.anl.gov/research/projects/mpich2/
|
{"Source-Url": "https://www.westgrid.ca/files/webfm/seminar_docs/2009-2010/ParallelProgrammingConcepts_2009.pdf", "len_cl100k_base": 8079, "olmocr-version": "0.1.50", "pdf-total-pages": 53, "total-fallback-pages": 0, "total-input-tokens": 141138, "total-output-tokens": 10477, "length": "2e12", "weborganizer": {"__label__adult": 0.00031113624572753906, "__label__art_design": 0.0004062652587890625, "__label__crime_law": 0.00031280517578125, "__label__education_jobs": 0.0012454986572265625, "__label__entertainment": 9.745359420776369e-05, "__label__fashion_beauty": 0.0001455545425415039, "__label__finance_business": 0.00018644332885742188, "__label__food_dining": 0.000335693359375, "__label__games": 0.0009059906005859376, "__label__hardware": 0.0031528472900390625, "__label__health": 0.00039458274841308594, "__label__history": 0.00029730796813964844, "__label__home_hobbies": 0.00017464160919189453, "__label__industrial": 0.0007534027099609375, "__label__literature": 0.00016939640045166016, "__label__politics": 0.00022351741790771484, "__label__religion": 0.0005502700805664062, "__label__science_tech": 0.0865478515625, "__label__social_life": 0.00010991096496582033, "__label__software": 0.010833740234375, "__label__software_dev": 0.8916015625, "__label__sports_fitness": 0.0004489421844482422, "__label__transportation": 0.0006208419799804688, "__label__travel": 0.00024271011352539065}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 31389, 0.02064]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 31389, 0.79132]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 31389, 0.85946]], "google_gemma-3-12b-it_contains_pii": [[0, 184, false], [184, 715, null], [715, 1241, null], [1241, 1698, null], [1698, 1968, null], [1968, 2377, null], [2377, 3061, null], [3061, 3815, null], [3815, 4484, null], [4484, 4813, null], [4813, 5554, null], [5554, 6339, null], [6339, 7057, null], [7057, 7222, null], [7222, 7848, null], [7848, 7848, null], [7848, 8792, null], [8792, 9222, null], [9222, 9435, null], [9435, 10042, null], [10042, 10497, null], [10497, 10709, null], [10709, 11148, null], [11148, 11787, null], [11787, 12413, null], [12413, 13787, null], [13787, 14562, null], [14562, 15053, null], [15053, 15834, null], [15834, 16636, null], [16636, 17554, null], [17554, 18390, null], [18390, 18886, null], [18886, 19353, null], [19353, 19848, null], [19848, 20562, null], [20562, 21400, null], [21400, 21902, null], [21902, 22248, null], [22248, 22622, null], [22622, 23285, null], [23285, 24084, null], [24084, 24640, null], [24640, 25225, null], [25225, 25687, null], [25687, 26225, null], [26225, 27720, null], [27720, 28585, null], [28585, 29047, null], [29047, 29476, null], [29476, 30264, null], [30264, 31178, null], [31178, 31389, null]], "google_gemma-3-12b-it_is_public_document": [[0, 184, true], [184, 715, null], [715, 1241, null], [1241, 1698, null], [1698, 1968, null], [1968, 2377, null], [2377, 3061, null], [3061, 3815, null], [3815, 4484, null], [4484, 4813, null], [4813, 5554, null], [5554, 6339, null], [6339, 7057, null], [7057, 7222, null], [7222, 7848, null], [7848, 7848, null], [7848, 8792, null], [8792, 9222, null], [9222, 9435, null], [9435, 10042, null], [10042, 10497, null], [10497, 10709, null], [10709, 11148, null], [11148, 11787, null], [11787, 12413, null], [12413, 13787, null], [13787, 14562, null], [14562, 15053, null], [15053, 15834, null], [15834, 16636, null], [16636, 17554, null], [17554, 18390, null], [18390, 18886, null], [18886, 19353, null], [19353, 19848, null], [19848, 20562, null], [20562, 21400, null], [21400, 21902, null], [21902, 22248, null], [22248, 22622, null], [22622, 23285, null], [23285, 24084, null], [24084, 24640, null], [24640, 25225, null], [25225, 25687, null], [25687, 26225, null], [26225, 27720, null], [27720, 28585, null], [28585, 29047, null], [29047, 29476, null], [29476, 30264, null], [30264, 31178, null], [31178, 31389, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 31389, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 31389, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 31389, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 31389, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 31389, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 31389, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 31389, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 31389, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 31389, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 31389, null]], "pdf_page_numbers": [[0, 184, 1], [184, 715, 2], [715, 1241, 3], [1241, 1698, 4], [1698, 1968, 5], [1968, 2377, 6], [2377, 3061, 7], [3061, 3815, 8], [3815, 4484, 9], [4484, 4813, 10], [4813, 5554, 11], [5554, 6339, 12], [6339, 7057, 13], [7057, 7222, 14], [7222, 7848, 15], [7848, 7848, 16], [7848, 8792, 17], [8792, 9222, 18], [9222, 9435, 19], [9435, 10042, 20], [10042, 10497, 21], [10497, 10709, 22], [10709, 11148, 23], [11148, 11787, 24], [11787, 12413, 25], [12413, 13787, 26], [13787, 14562, 27], [14562, 15053, 28], [15053, 15834, 29], [15834, 16636, 30], [16636, 17554, 31], [17554, 18390, 32], [18390, 18886, 33], [18886, 19353, 34], [19353, 19848, 35], [19848, 20562, 36], [20562, 21400, 37], [21400, 21902, 38], [21902, 22248, 39], [22248, 22622, 40], [22622, 23285, 41], [23285, 24084, 42], [24084, 24640, 43], [24640, 25225, 44], [25225, 25687, 45], [25687, 26225, 46], [26225, 27720, 47], [27720, 28585, 48], [28585, 29047, 49], [29047, 29476, 50], [29476, 30264, 51], [30264, 31178, 52], [31178, 31389, 53]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 31389, 0.01508]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
37f3b4a7db114d2c9b9fabbc34e8e4bd00b43858
|
Delegated Distributed Mappings
draft-watson-dinrg-delmap-02
Abstract
Delegated namespaces underpin almost every Internet-scale system - domain name management, IP address allocation, Public Key Infrastructure, etc. - but are centrally managed by entities with unilateral revocation authority and no common interface. This draft specifies a generalized scheme for delegation that supports explicit time-bound guarantees and limits misuse. Mappings may be secured by any general purpose distributed consensus protocol that supports voting; clients can query the local state of any number of participants and receive the correct result, barring a compromise at the consensus layer.
Status of This Memo
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on October 27, 2019.
Copyright Notice
Copyright (c) 2019 IETF Trust and the persons identified as the document authors. All rights reserved.
1. Introduction
Internet entities rely heavily on delegated namespaces to function properly. Typical web services have been delegated a domain name (after negotiation with an appropriate registrar) under which they host the entirety of their public-facing content, or obtain a public IP range from their ISP, which itself has been delegated to intermediary registries by the Internet Numbers Registry [RFC7249]. An enormous amount of economic value is therefore placed in these assignments (in this draft, _mappings_) yet they are dangerously ephemeral. Delegating authorities, either maliciously or accidentally, may unilaterally revoke or replace mappings they’ve made, compromising infrastructure security. Presented in this draft is a generalized mechanism for securely managing such mappings and their delegations. Known entities identified by public key are assigned namespaces (e.g. domain prefixes) under which they are
authorized to create mapping records, or _cells_. Cells in a namespace are grouped into logical units we term _tables_.
Alone, this structure does not ensure security, given that any hosting server could arbitrarily modify cells or serve bogus entries to unwitting clients. We maintain security and consistency by relying on a distributed consensus algorithm. While detailed descriptions of varying consensus protocols are out of scope for this draft, we provide for a general-purpose interface between the delegation structure and a consensus layer. At a minimum, the consensus layer must apply mapping updates in a consistent order, prevent equivocation, disallow unauthorized modification, grant consensus nodes the ability to enforce high-level rules associated with the tables, and perform voting among nodes to decide top-level governance. We find that federated protocols such as the Stellar Consensus Protocol [I-D.mazieres-dinrg-scp] are promising given their capability for open participation, broad diversity of interests among consensus participants, and providing accountability for malicious behavior. Clients may query any number of trusted servers to retrieve a correct result, barring widespread collusion.
The ability to impose consistency yields several useful properties. The foremost is enforcing delegation semantics: a table’s authority may choose to recursively delegate a portion of its own namespace, but must document the specific range and delegate in one of its table’s cells. Since delegation forms a new table, for which a delegate is the sole authority, assigned namespace ranges must be unique. Consensus is also used to enforce that the delegating authority not make modifications to any delegated table and thus need not be trusted by the delegatee.
In addition, we provide explicit support for commitments that enforce an explicit lower-bound on the duration of delegations. Otherwise valid changes to cells that have a valid commitment are disallowed, including revoking delegations. Upon expiration, however, the same namespace may be delegated to another party.
Finally, decentralized infrastructure is highly visible and commonly misused. As mappings are replicated among consensus nodes, of primary concern is resource exhaustion. We limit undesired abuse of the structure by embedding recursive scale restrictions inside mappings, verified and ratified at consensus time. Combined with time-bound delegations, this ensures that the system is resistant to spam in the short-term and can remove misbehaving hierarchies in the long-term.
The remainder of this draft specifies the structure for authenticated mapping management as well as its interfaces to consensus protocol implementations and users.
2. Structure
Trust within the delegation structure is based on public key signatures. Namespace authorities must sign mapping additions, modifications, delegations, and revocations to their table as proof to the consensus participants that such changes are legitimate. For the sake of completeness, the public key and signature types are detailed below. All types in this draft are described in XDR [RFC4506].
typedef publickey opaque<>; /* Typically a 256 byte RSA signature */
struct signature {
publickey pk;
opaque data<>;
};
2.1. Cells
Cells are the basic unit of the delegation structure. In general, they compose an authenticated record of a mapping that may be queried by clients. We describe two types of cells:
enum celltype {
VALUE = 0,
DELEGATE = 1
};
Value cells store individual mapping values. They resolve a lookup key to an arbitrary value, for example, an encryption key associated with an email address or the zone files associated with a particular domain. The public key of the cell’s owner (e.g. the email account holder, the domain owner) is also included, as well as a signature authenticating the current version of the cell. Since the cell’s contents are controlled by the owner, its "value_sig" must be made by the "owner_key". The cell owner may rotate their public key at any time by signing the update with the old key.
struct valuecell {
opaque value<>;
publickey owner_key;
/* Owner signs contents */
signature value_sig;
};
Delegate cells have a similar structure but different semantics. Rather than resolving to an individual mapping, they authorize the **delegee** to create arbitrary value cells within a table mapped to the assigned namespace. This namespace must be a subset of the **delegator**’s own namespace range. Like the table authority, the delegee is uniquely identified by their public key. Each delegate cell and subsequent updates to the cell are signed by the delegator - this ensures that the delegee cannot unilaterally modify its namespace, which limits the range of mappings they can create to those legitimately assigned to them.
```c
struct delegatecell {
opaque namespace<>
publickey delegee;
/* Table authority controls delegations, not delegee */
signature delegation_sig;
unsigned int allowance;
};
```
Both cell types share a set of common data members, namely a set of UNIX timestamps recording the creation time and, if applicable, the time of last modification. An additional commitment timestamp must be present in every cell. Each commitment is an explicit guarantee on behalf of the table’s authority that the mapping will remain valid until at least the time specified. Therefore, while value cell owners may modify their cell’s contents at any time (e.g. this scheme supports key rotation), the authority cannot change or remove the cell until its commitment expires, as enforced by the consensus nodes. Similarly, delegated namespaces are guaranteed to be valid until the commitment timestamp expiration, although after expiration, they can be reassigned to other parties. Likely, most long-term delegations will be renewed (with a new commitment timestamp) before the expiration of the current period. The tradeoff between protecting delegees from arbitrary authority action and allowing quick delegation reconfiguration is customizable to the use case. Likely, widely-used services will see larger delegation periods for stability whereas small namespaces with relatively unknown delegees will experience shorter delegations.
An **allowance** must be provided, which limits the upper-bound size of a delegated table. For value cells, the allowance value is ignored and set to 0. Importantly, for delegate cells, an allowance with value 0 indicates no limit is placed on the size of the delegated table. Given that the delegee has complete control over the contents of their table, it is emphatically not recommended to grant a delegatecell an unlimited allowance, in order to limit the storage burden on consensus nodes. This limit is recursive along delegations - the total number of cells in a table plus the sum of allowances.
among its "delegatecells" must be less than or equal to the table’s allowance, if non-zero. Further, a table with a non-zero allowance may not grant a delegate an unlimited allowance. These properties must be validated during consensus before adding new cells to a table, which can be performed at every consensus node because table entry counts are visible publicly.
Finally, a valid table cell’s timestamps and allowance is signed by the table authority and placed in "authority_sig".
```c
union innercell switch (celltype type) {
case VALUE:
valuecell vcell;
case DELEGATE:
delegatecell dcell;
};
struct cell {
/* 64-bit UNIX timestamps */
unsigned hyper create_time;
unsigned hyper *revision_time;
unsigned hyper commitment_time;
/* Ignored by value cells */
unsigned int allowance;
signature authority_sig;
innercell c;
}
```
### 2.2. Tables
Every cell is stored in a table, which groups all the mappings created by a single authority public key for a specific namespace. Individual cells are referenced by an application-specific label in a lookup table. The combination of a lookup key and a referenced cell value forms a mapping.
```c
struct tableentry {
opaque lookup_key<>
cell c;
};
```
Delegating the whole or part of a namespace requires adding a new lookup key for the namespace and a matching delegate cell. Each delegation must be validated in the context of the other table entries and the table itself. For example, the owner of a table delegated an /8 IPv4 block must not to delegate the same /16 block to two different tables.
2.3. Prefix-based Delegation Correctness
To generalize correctness, each table must conform with a prefix-based rule: for every cell with value or delegation subset "c" in a table controlling namespace "n", "n" must (1) be a prefix of "c" and (2) there cannot exist another cell with value or delegation subset "c2" such that "c" is a prefix of "c2".
While there exist many more hierarchical naming schemes, many can be simply represented in a prefix scheme. For example, suffix-based delegations, including domain name hierarchies, can use reversed keys internally and perform a swap in the application layer before displaying any results to clients. Likewise, 'flat' delegation schemes where there is no explicit restriction can use an empty prefix.
2.4. Root Key Listing
Each linked group of delegation tables for a particular namespace is rooted by a public key stored in a flat root key listing, which is the entry point for lookup operations. Well-known application identifier strings denote the namespace they control. We describe below how lookups can be accomplished on the mappings.
```c
struct rootentry {
publickey namespace_root_key;
string application_identifier<>;
signature listing_sig;
unsigned int allowance;
}
struct rootlisting {
rootentry roots<>;
}
```
A significant question is how to properly administer entries in this listing, since a strong authority, such as a single root key, can easily protect the listing from spam and malicious changes, but raises important concerns about misuse. Concurrent work on IP address allocation [IP-blockchain] explores using a Decentralized Autonomous Organization built on the Ethereum blockchain to manage all delegations where proper behavior is economically motivated. We identify similar challenges: controlling spam and misuse, while operating in a decentralized manner.
In this draft, however, we focus on enabling governance through consensus operations. For that reason, potential root entries are nominated with a proposed allowance, which will restrict the total number of cells currently supported by an application. For large systems such as IP delegation or well-known entities like the IETF, the limit can be disabled as discussed earlier in this draft. It is important that decisions regarding root listing membership be made by the consensus nodes themselves, since they bear the largest burden to store tables, communicate with other nodes, and service client queries. This structure further allows table authorities to focus on content-specific administration of their own namespaces, which is not provided for in the generic delmap semantics. If an application begins to run out of allowance (too many cells or large delegations), it can sign and nominate a new "rootentry" for the same application identifier with a larger value, at which point the other nodes can (given global knowledge of table sizes and growth rates, along with additional real-world information, if applicable) determine whether or not to accept the change.
Thus, this draft explicitly requires prospective consensus algorithms to provide a mechanism for inter-node voting on governance issues. This is already common in protocols that provide for periodic updates: quorums in slice infrastructures like Stellar, Bitcoin-style percentage- and time-based agreement windows, or hard forks. Finally, although the possibility of fundamental disagreement in governance between different sets of consensus nodes is real, in realistic settings, in the worst case such groups should not necessarily continue to trust each other in consensus relationships and may indicate a (valid) need to split.
3. Interacting with a Consensus Node
3.1. Storage Format
Delegation tables are stored in a Merkle hash tree, described in detail in [RFC6962]. In particular, it enables efficient lookups and logarithmic proofs of existence in the tree, and prevents equivocation between different participants. Among others, we can leverage Google’s [Trillian] Merkle tree implementation which generalizes the datastructures used in Certificate Transparency. In map mode, the tree can manage arbitrary key-value pairs at scale, but critically, this requires flattening the delegation links such that each table may be queried, while ensuring that a full lookup from the application root is made for each mapping.
Given a "rootentry", the corresponding table in the Merkle tree can be queried at the following key (where || indicates concatenation):
root_table_name = app_id || namespace_root_key
It follows that tables for delegated namespaces are found at:
table = root_table_name || delegee_key_1 || ... || delegee_key_n
And finally, individual entries are identified by the namespace lookup key:
cell = table || desired_lookup_key
Once an entry is found in the tree, a logarithmic proof can be constructed with the hashes of the siblings of each node in the tree’s path to the entry.
struct merkleproof {
opaque sibling_hashes[32]<>
cell entry_cell;
signature tree_sig;
}
The entry is hashed together with each "sibling_hash" - if the total matches the known tree root hash, then the entry must have been in the tree.
### 3.2. Client Interface
The presence of a natural mapping structure motivates an external client interface similar to a key-value store.
struct MerkleRootOperation { }
struct MerkleRootReturn {
opaque root_hash[32];
signature tree_sig;
}
It is important to note that the client should not rely on a root hash that has been provided by a single server to verify a "merkleproof", instead querying multiple consensus nodes using this interface. Upon discovering that different servers are advertising non-matching hashes, the signed proof should be used to prove to other clients/nodes that one or more malicious trees are equivocating.
enum ReturnCode {
CELL = 0,
TABLE = 1,
ERROR = 2
}
struct GetOperation {
string application_identifier;
opaque full_lookup_key<>;
}
union GetReturn switch (ReturnCode ret) {
case CELL:
cell value;
merkleproof p;
case TABLE:
table t;
merkleproof p;
case ERROR:
string reason;
}
Given an application identifier and the fully-qualified lookup key, the map described in the previous section can be searched recursively. At each table, we find the cell whose name matches a prefix of the desired lookup key. If the cell contains a "valuecell", it is returned if the cell’s key matches the lookup key exactly, else an "ERROR" is returned. If the cell contains a "delegatecell", it must contain the key for the next table, on which the process is repeated. If no cell is found by prefix-matching, the node should return "ERROR" if the key has not been fully found, else the table itself (containing all of the current cells) is provided to the client. As in every interaction with the delegated mapping structure, users should verify the attached proof. Verifying existence of an entry follows from the same method.
Internet-Draft Delegated Mappings April 2019
struct SetOperation {
string application_identifier;
opaque full_lookup_key<>;
cell c;
}
struct SetRootOperation {
rootentry e;
bool remove;
}
union SetReturn switch (ReturnCode ret) {
case SUCCESS:
opaque empty;
case ERROR:
string reason;
}
Creating or updating a cell at a specified path requires once again
the full lookup key, as well as the new version of the cell to place.
The new cell must be well-formed under the validation checks
described in the previous section, else an "ERROR" is returned. For
example, updating a cell’s owner without a signature by the previous
owning key should not succeed. Both value cells and new/updated
delegations may be created through this method. Removing cells from
tables (after their commitment timestamps have expired) can be
accomplished by replacing the value or delegated namespace with an
empty value and setting the owner’s key to that of the table
authority. Asking the consensus layer to approve a new root entry
follows a similar process, although the application identifier and
lookup key is unnecessary (see "SetRootOperation"). Nodes can also
trigger votes to remove entries from the root key listing to redress
misbehaving applications.
4. Consensus
Safety is ensured by reaching distributed consensus on the state of
the tree. The general nature of a Merkle tree as discussed in the
previous section enables almost any consensus protocol to support
delegated mappings, with varying guarantees on the conditions under
which safety is maintained and different trust implications. For
example, a deployment on a cluster of nodes running a classic
Byzantine Fault Tolerant consensus protocol such as [PBFT] requires a
limited, static membership and can tolerate compromises in up to a
third of its nodes. In comparison, proof-of-work schemes including
many cryptocurrencies have open membership but rely on economic
incentives and distributed control of hashing power to provide
safety, and federated consensus algorithms like the Stellar Consensus
Protocol (SCP) [I-D.mazieres-dinrg-scp] combine dynamic members with real-world trust relationships but require careful configuration. Determining which scheme, if any, is the "correct" protocol to support authenticated delegation is an open question.
4.1. Interface
Explicit requirement for voting HERE
At a minimum, the consensus layer is expected to provide mechanisms for nodes to
1. Submit new values (commonly cell, but also root listing, updates) for consensus
2. Receive externalized values to which the protocol has committed
3. Validate values received from other nodes for each iteration of the protocol, as specified below
4. Voting mechanism for making root listing governance decisions
Specific protocols may require additional functionality from the delegated mapping layer, which should be implemented to ensure that valid updates are eventually applied (assuming a working consensus layer).
4.2. Validation
Incorrect (potentially malicious) updates to the Merkle tree should be rejected by nodes participating in consensus. Given the known prefix-delegation scheme, each node can apply the same validation procedure without requiring table-specific or application-specific knowledge. Validation also provides a simple mechanism for rate-limiting actors attempting to perform DoS attacks, as only the most recent change to a particular cell need be retained, and the total number of updates to any particular table or overall can be capped. Upon any modification to the delegation tables, a "SetOperation" or "SetRootOperation" as defined in the previous section, the submitted change to the consensus layer should:
1. Reference an existing application identifier in the root key listing and a valid table if applicable.
2. For updates to all cells:
* contain an unmodified "create_time" or a current timestamp if a new cell
* contain a current "revision_time" in the case of an update
* set a "commitment_time" greater than or equal to the previous commitment
* not grant unlimited allowance (value 0) to delegate cells unless the delegating table also has an unlimited allowance
* result in a total table size ("valuecell" count + "delegatecell" allowances) less than or equal to the table allowance, if not unlimited
* contain a valid signature of the overall cell data by the table authority
3. For updates to value cells:
* be signed only by the current "owner_key" if the cell commitment has not yet expired, or by a new owner upon expiration
* have a lookup key in the table that belongs to the authority’s namespace
* not conflict with other cells in its table, breaking the prefix-delegation property
4. For updates to delegate cells:
* be signed by the table authority’s public key for new delegations or updates
* retain the same "namespace" and "deleege" value unless the "commitment_time" is expired
* contain a valid namespace owned by the authority delegating the cell
* not conflict with other values or delegations in the same table, breaking the prefix-delegation property
Only after a round of the consensus protocol is successful are the changes exposed to client lookups.
4.3. SCP
While consensus can be reached with many protocols, this section describes how the interface described above can be satisfied by SCP.
Updates to the delegation tables consist of the table change itself (the new version of the cell). Since SCP does not need specific knowledge of the format of these proofs, they directly form consensus on the opaque values submitted to the consensus layer. Once a combination of proofs are agreed to as outputs for a given slot, they are externalized to the mapping layer and applied to the local node’s table states. [I-D.mazieres-dinrg-scp] requires this layer to provide a _validity_ function that is applied to each input value, allowing nodes to detect misformed cells that violate the delegation semantics as defined by the previous subsection.
SCP asks the higher-level protocol to define a _combining_ function to compose multiple candidate values. In this application, we can take the union of valid updates proposed by the consensus nodes, rejecting duplicate updates to the same cell in favor of the most up-to-date timestamp.
Finally, SCP by specification uses federated voting to confirm values, which can be used directly to propose and validate modifications to the root key listing.
5. Security Considerations
The security of the delegation tables is primarily tied to the safety properties of the underlying consensus layer. Further, incorrect use of the public key infrastructure authenticating each mapping or compromise of a namespace root key can endanger mappings delegated by the key after their commitments expire.
6. References
6.1. Normative References
[Trillian]
6.2. Informative References
[I-D.mazieres-dinrg-scp]
[IP-blockchain]
[PBFT]
Acknowledgments
We are grateful for the contributions and feedback on design and applicability by David Mazieres, as well as help and feedback from many members of the IRTF DIN research group, including Dirk Kutscher and Melinda Shore.
This work was supported by The Stanford Center For Blockchain Research.
Authors’ Addresses
Sydney Li
Electronic Frontier Foundation
815 Eddy Street
San Francisco, CA 94109
US
Email: sydney@eff.org
|
{"Source-Url": "http://art.tools.ietf.org/pdf/draft-watson-dinrg-delmap-02.pdf", "len_cl100k_base": 5092, "olmocr-version": "0.1.49", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 30283, "total-output-tokens": 6280, "length": "2e12", "weborganizer": {"__label__adult": 0.0003561973571777344, "__label__art_design": 0.0003426074981689453, "__label__crime_law": 0.0010652542114257812, "__label__education_jobs": 0.0004451274871826172, "__label__entertainment": 0.00010025501251220704, "__label__fashion_beauty": 0.00018513202667236328, "__label__finance_business": 0.0009984970092773438, "__label__food_dining": 0.00038743019104003906, "__label__games": 0.0006875991821289062, "__label__hardware": 0.0022430419921875, "__label__health": 0.0006189346313476562, "__label__history": 0.0004177093505859375, "__label__home_hobbies": 0.0001036524772644043, "__label__industrial": 0.0005583763122558594, "__label__literature": 0.00031685829162597656, "__label__politics": 0.0008387565612792969, "__label__religion": 0.00044798851013183594, "__label__science_tech": 0.1773681640625, "__label__social_life": 0.00011116266250610352, "__label__software": 0.043548583984375, "__label__software_dev": 0.767578125, "__label__sports_fitness": 0.0002856254577636719, "__label__transportation": 0.0006122589111328125, "__label__travel": 0.00023376941680908203}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26466, 0.01612]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26466, 0.38415]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26466, 0.87856]], "google_gemma-3-12b-it_contains_pii": [[0, 1490, false], [1490, 2419, null], [2419, 5000, null], [5000, 6702, null], [6702, 9372, null], [9372, 10990, null], [10990, 12855, null], [12855, 15497, null], [15497, 16837, null], [16837, 18021, null], [18021, 20137, null], [20137, 21994, null], [21994, 23265, null], [23265, 25160, null], [25160, 26466, null], [26466, 26466, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1490, true], [1490, 2419, null], [2419, 5000, null], [5000, 6702, null], [6702, 9372, null], [9372, 10990, null], [10990, 12855, null], [12855, 15497, null], [15497, 16837, null], [16837, 18021, null], [18021, 20137, null], [20137, 21994, null], [21994, 23265, null], [23265, 25160, null], [25160, 26466, null], [26466, 26466, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26466, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26466, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26466, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26466, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26466, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26466, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26466, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26466, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26466, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26466, null]], "pdf_page_numbers": [[0, 1490, 1], [1490, 2419, 2], [2419, 5000, 3], [5000, 6702, 4], [6702, 9372, 5], [9372, 10990, 6], [10990, 12855, 7], [12855, 15497, 8], [15497, 16837, 9], [16837, 18021, 10], [18021, 20137, 11], [20137, 21994, 12], [21994, 23265, 13], [23265, 25160, 14], [25160, 26466, 15], [26466, 26466, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26466, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-25
|
2024-11-25
|
b07e8556567dd0afe9e286d9172df4f6842bfc0a
|
[REMOVED]
|
{"Source-Url": "https://bdataanalytics.biomedcentral.com/track/pdf/10.1186/s41044-019-0043-6", "len_cl100k_base": 6588, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 34970, "total-output-tokens": 9001, "length": "2e12", "weborganizer": {"__label__adult": 0.0003554821014404297, "__label__art_design": 0.0008730888366699219, "__label__crime_law": 0.00033736228942871094, "__label__education_jobs": 0.0010547637939453125, "__label__entertainment": 0.00015020370483398438, "__label__fashion_beauty": 0.00019860267639160156, "__label__finance_business": 0.0003211498260498047, "__label__food_dining": 0.0004041194915771485, "__label__games": 0.0006022453308105469, "__label__hardware": 0.0013246536254882812, "__label__health": 0.0007357597351074219, "__label__history": 0.0004892349243164062, "__label__home_hobbies": 0.00015020370483398438, "__label__industrial": 0.000499725341796875, "__label__literature": 0.0002894401550292969, "__label__politics": 0.00024628639221191406, "__label__religion": 0.0004749298095703125, "__label__science_tech": 0.158203125, "__label__social_life": 0.00016379356384277344, "__label__software": 0.025238037109375, "__label__software_dev": 0.806640625, "__label__sports_fitness": 0.0003077983856201172, "__label__transportation": 0.0005030632019042969, "__label__travel": 0.0002617835998535156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 38211, 0.04002]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 38211, 0.55544]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 38211, 0.84487]], "google_gemma-3-12b-it_contains_pii": [[0, 2594, false], [2594, 5921, null], [5921, 8081, null], [8081, 11045, null], [11045, 12765, null], [12765, 15971, null], [15971, 16463, null], [16463, 18869, null], [18869, 22259, null], [22259, 23454, null], [23454, 24075, null], [24075, 25395, null], [25395, 28633, null], [28633, 33126, null], [33126, 38211, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2594, true], [2594, 5921, null], [5921, 8081, null], [8081, 11045, null], [11045, 12765, null], [12765, 15971, null], [15971, 16463, null], [16463, 18869, null], [18869, 22259, null], [22259, 23454, null], [23454, 24075, null], [24075, 25395, null], [25395, 28633, null], [28633, 33126, null], [33126, 38211, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 38211, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 38211, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 38211, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 38211, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 38211, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 38211, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 38211, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 38211, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 38211, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 38211, null]], "pdf_page_numbers": [[0, 2594, 1], [2594, 5921, 2], [5921, 8081, 3], [8081, 11045, 4], [11045, 12765, 5], [12765, 15971, 6], [15971, 16463, 7], [16463, 18869, 8], [18869, 22259, 9], [22259, 23454, 10], [23454, 24075, 11], [24075, 25395, 12], [25395, 28633, 13], [28633, 33126, 14], [33126, 38211, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 38211, 0.11585]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
1cb33123e1390a0d84595c80739d015f0ddae2ee
|
Level-oriented universal visual representation environment
Leszek Rybicki*, Marta Burzańska
Faculty of Mathematics and Computer Science, Nicolaus Copernicus University, Chopina 12/18, 87-100 Toruń, Poland.
Abstract – We propose a three-dimensional graphics engine targeted at simultaneous visualizing multiple data sets and simulations in progress using a number of different visualization methods. The user can navigate between different views in a way in which one would traverse a museum: by switching focus from one object to another or zooming out to include several objects at the same time. Related visualizations are vertically organized into levels or floors, further enhancing the museum metaphor. Additional information and means of manipulating the visualized data or simulations are provided for the user in a form of a two-dimensional on-screen overlay and also with the use of various input devices, not only mouse or keyboard. L.O.U.V.R.E. proved to be a very efficient and useful tool when dealing with experiments on robotics simulations. This paper presents such usage, and also indicates other possible applications. We find that it fills a gap as an intuitive solution encompassing graphing, simulation and user interface at the same time. Its applications go far beyond computer science research into such fields as biology or physics.
1 Introduction
This paper describes the design and implementation of a programming library for visualizing multiple data sets and simulations in a unified way using a novel paradigm. The need for the library arose during the implementation of another project, which involved a simulated robot that learned to evaluate its current state, and generate a policy using that evaluation. In short, the robot associated a value with its position, one that can be roughly associated with the distance to task completion, if starting from that state. The policy of the robot could be regarded as a vector field: for every position in space the robot had a direction of movement,
*leszek.rybicki@gmail.com
which could be visualized as a vector. Also, since the robot was steered using three neural networks, the approximation error of the networks could be also plotted in the same reference frame, since all networks had the position in space as input or part of the input.
Displaying the progress for all tasks required viewing them in the same reference frame. Since the learning process was gradual, depended on a number of parameters and required restarting from time to time, it had to be continuously overviewed and optimized. A good visualization of the robot’s internal world model and policy along with the simulation of the robot itself allowed for noticing which could still be optimized, where the networks had the greatest error levels, and how the generated policy depended on the gradually improving value function.
For investigating one plot or simulation we decided to make the simulated camera hover and orbit around a focus point. If the focus point were in the center of a plot, it would give the illusion of viewing an object from all sides. In this mode the other visualizations would be hidden from the user both for speeding up the display redrawing and allowing the user to focus on the single object.
As the need for more different visualizations arose, we added the ability to place the objects, or exhibits, on different levels. One level contained the visualized output of the nets and network errors, while another two levels were occupied by the visualizations of the robot performing different tasks. This way the environment became a multistory building in which the user could move around shifting focus from one visualization to another, or comparing several visualizations at the same time, or switching to another set of plots on a different level in space. Using the application felt like visiting a virtual museum with different exhibits and navigating around them was easy and proved useful when the results of the experiment were presented to audience.
Since there was information that needed to be visible at all times and certain elements needed to be interactively modified during the training and simulation, we added a simple GUI on a semitransparent layer on the screen. The layer contained a progress gauge for the current learning phase, a number of flat mean square error plots, buttons for starting and stopping the simulation and a map of the robot’s internal model of the task set, one which could be interacted with. For documenting the project, we created a print mode in which all elements were displayed in a way that made them look better in print and added screenshot capability, along with the saving of neural network data and the mean square error history. A mode for making a number of subsequent screenshots allowed to render short movie sequences presenting the learning process.
Since it soon became apparent that the potential of the graphical environment went far beyond the needs of the project, we decided to extract the part responsible for visualization, user interface and interaction and add features that could be useful in a more general scope of use: text rendering on flat surfaces in the threedimensional environment and in the overlay GUI as well as parametric animations. The project was dubbed LOUVRE.
We envision the use of LOUVRE as a unified threedimensional user interface for running multiple applications. The current attempts at adding a third dimension to the user interface do so by placing flat windows in space (Project Looking Glass [1], Compiz Fusion) to ensure
compatibility with the existing applications. There are few interfaces that truly leverage the illusion of space in an effective way (BumpTop [2] deserves a mention). We believe that information displayed by applications can be effectively placed in space without any loss of clarity.
Further in the paper we make the distinction between different intended users of the project: the end user and the developer, sometimes identified with the researcher. The end user is any person viewing a simulation or application written using the LOUVRE library. We talk about the end user in terms of user interface, navigation and interaction. Another example of an end user would be a student or pupil using a LOUVRE-based application as a learning tool with visualizations of geometrical forms, chemical particles or physics simulations. The developer is a person creating the application, sometimes extending the built-in capabilities to better suit the needs of the project. If the project is a scientific one, we use the term researcher.
The rest of the paper is organized to describe the LOUVRE project from different points of view: the following section contains technical information about the programming library, including hardware and software requirements. Section 3 describes how LOUVRE-based applications can be interacted with – the end user point of view. Section 4 contains basic information on how to use LOUVRE for scientific visualization and how to add new types of objects. Section 5 discusses the relation of LOUVRE to other similar tools. The paper is concluded by a discussion of the strengths and weaknesses of this form of visualization, as well as possible applications and future development.
## 2 Technical description
LOUVRE has been implemented in the D language [3], which is a relatively new programming language quickly expanding its programmer base, especially among game programmers, due to its numerous features and speed of execution. The same reasons appeal to researchers, who need fast platform-native executables written with a concise and legible code. The D language is currently the topic of two international conferences and is taught in universities, including one in Poland – Nicolaus Copernicus University. There are two D compilers: DMD, which is made by the main developer of D, Walter Bright and GDC, which is part of the GNU Compiler Collection and has been chosen for compiling LOUVRE due to its multi-platform compatibility and standards compliance. LOUVRE works with both standard libraries available for the D language: Tango and Phobos.
OpenGL rendering, input device support and True Type font rendering in LOUVRE has been achieved thanks to SDL, or rather the D port of SDL – Derelict. SDL provides an uniform programmer’s interface on a multitude of platforms. For PNG texture loading and saving PNG-formatted screenshots we used the LodePNG library. SDL needs to be installed in the end-user’s system for the LOUVRE-based applications to work.
LOUVRE has been compiled and tested on Linux, MacOSX and Windows.
Three-dimensional rendering and translucency effects used in LOUVRE require an accelerated graphics card, but since unnecessary objects are hidden when possible to avoid distracting the end-user, the rendering of the ones in view is quite fast, making LOUVRE less GPU and CPU-hungry than an average modern computer game. Especially the CPU savings (rendering plots does take some floating-point calculations) are important for the projects that require CPU hungry calculations or simulations and visualization at the same time. LOUVRE has been tested (actually, in most part, written) on a Linux machine with drivers that did not take full advantage of the graphics card. In one case the Linux machine was used for calculations only and another machine was used for visuals, using a local network and the X11 technology. This method, especially useful for presentation of running simulations, gives a noticeable boost in both calculation speed and quality of the visuals.
Fonts rendered in high resolution and large images require graphics adapters with support for big textures. In a given project, it is up to the developer to keep text and textures small and compatible with a client’s graphics card, LOUVRE provides no detection or warnings at the moment.
3 User interface
LOUVRE is intended to be intuitive for the end user, while freeing the programmer from the burden associated with designing an interactive three dimensional display. Instead of leaving certain choices to the developer, we decided to limit them to keep the environment consistent and predictable. A good example of this is camera control, where pitch is limited, roll is not modifiable and yaw is done by orbiting around a focus point. Camera motion will be described in detail later.
3.1 Gallery Paradigm
The three-dimensional objects in LOUVRE are meant to be viewed like exhibits in a museum or gallery. The user can focus on a single exhibit, overview a number of corelated exhibits, move among them or travel to other floors to see other types of exhibits. We believe that users will find this method of organization to be quite intuitive. Rather than having separate windows, menus or other means of switching between exhibits, the user can employ an ability that’s not only already known, but arguably natural: simply explore.
It should be kept in mind that LOUVRE has been designed for viewing scientific simulations and data. A typical exhibit is intended to be a plot visualizing a data set. LOUVRE has built-in capability to visualize data sets as volume plots, vector fields, landscapes and scatterplots, depending on data dimensionality and programmer’s choice.
appearance of plots is another example of a choice that was made for the programmer. Instead of having the researcher select color settings, line width and arrow shapes, we decided to create a number of pre-set modes for different purposes, for example a dark background with semi-transparent, pseudo color plots for displaying results on a projector screen and a bright background, high-contrast wireframe plots for printing.
Yet LOUVRE was never intended to be just an engine for displaying static plots. It is optimized from the bottom-up to visualize data as calculations progress. The plots are rendered in real time using data that can change from frame to frame. Plots and other exhibits can change using a system of parametric animations that are triggered during the user’s interaction. In addition, LOUVRE can visualize custom simulations, like the aforementioned moving robot. Since animation, simulation, drawing and user interface are performed by separate threads, the interaction with LOUVRE remains smooth during calculation and data update.
The end-user is also provided with a two dimensional overlay, which is meant for display elements that should always be visible. An example that keeps things within the gallery para-digm would be a map of the museum or an interactive guide. The overlay can contain buttons, progress gauges, flat plots and interactive maps. Since LOUVRE is designed to be customizable for the programmer, it’s easy to design new control elements for particular projects.
### 3.2 Interactivity
The observer in the LOUVRE environment can move within a single floor using either the keyboard (the W, A, S and D keys) or by dragging the mouse (holding the right button) or orbit around a point by dragging the mouse with the left button. Orbiting below a focused exhibit is not permitted (camera pitch is capped at a certain angle), but can be optionally permitted by the programmer. We propose a design guideline – if an exhibit requires viewing from below, place it above the ground.
The up and down arrow keys on the keyboard move the observer forward and backward respectively and the left and right arrow keys orbit left and right. While the observer is moving, the focus point is displayed to allow for targeting particular exhibits. The focus point is normally kept at some level above the ground, but can be moved up and down using the Page-Up and Page-Down keys. Moving the focus point up or down to another level causes the environment to display the exhibits on that level. Level height is 2 units in the LOUVRE system and the Page-Up, Down keys move the focus point by 0.5.
The observer is kept at a constant distance from the focus point, but can use the mouse wheel (or the Q and E keys) to zoom in and out. At a preset zoom level only the exhibit nearest to the focus point is displayed, allowing the observer to focus on that exhibit only, while orbiting...
around it. If the observer decides to move while in a single exhibit mode, other exhibits are displayed as outlines on the floor to provide means of orientation. As the observer moves closer to another exhibit’s outline, the exhibit becomes visible, while the previously focused one disappears. When the observer’s camera is zoomed out to view several exhibits, still only the nearest exhibits are visible: exhibits further than 4 units from the focus point are not drawn to conserve CPU power. Also, the visible exhibits are covered by a gradually thickening fog, which can be optionally switched off. The parameters of the fog allow the observer to comfortably view several adjacent exhibits, while seeing some further ones darkened. Outlines of exhibits that are too far to be displayed are not even visible in the fog.
Since the LOUVRE environment was designed for scientific data display, there is a built-in mode in which all objects are displayed in high contrast and with accented lines, a "publication-ready" mode. In this mode the fog and directional light are off, the two-dimensional overlay is hidden and all objects are drawn in shades of grey, where applicable. Landscape plots are displayed as wireframe to enhance readability on paper. Custommade objects should respect this mode. By default, when making a screenshot (the P key), LOUVRE switches to publication mode for the screenshot. Publication mode can be turned on and off with the I key. In the machine learning project, taking a screenshot was extended to also save data from the simulation as text files. This method of extending standard functionality is available to developers. LOUVRE can be used to make video sequences by taking screenshots of every rendered frame, but while making a video no changes are made to the display and no custom operations are permitted.
### 3.3 The overlay
For interactive visualizations we have designed a flat on-screen layer that displays semi translucent controls of various types. This layer is the primary recipient of mouse input in a short chain of response. As the user moves the mouse, overlay controls lighten up: depending on the type of control it can either become less translucent or display some additional data. A mouse action (click or drag) is sent to that control. If the control is designed to react to mouse clicks (like a button), the click is intercepted and the button’s default action is executed. Even if an action has been executed, the button can still allow the click to be passed on to the gallery.
If a control does not implement an action (like a progress bar), the click is simply sent to the gallery.
An example of a custom control in the machine learning project was a map of the task set, which allowed to switch between tasks in the visualization: while all tasks were being trained, the user could select to visualize the progress of any of the tasks. The task map reacted to clicking, dragging and orbiting motion (the task map was actually three-dimensional itself) and the control showed additional information about the tasks when hovered over.
Since the overlay covers the whole screen, overlay objects are likely to cover objects in the three-dimensional gallery. Therefore they are designed to be translucent and as unobtrusive as possible: contain simple graphics rather than text, appear on sides of the screen, display only crucial information in their inactive state and more when hovered over.
### 4 API design
This section is meant to demonstrate how to use LOUVRE’s to make visualization or presentation using built-in graphing capabilities and overlay components as well as extend LOUVRE.
#### 4.1 Displaying data
Data for flat vector fields and level plots is kept in a Dataset2D structure, while data for three-dimensional vector fields and volume plots – in an analogous Dataset3D structure. Scatterplots, being simply sets of points, are treated separately, via a Scatterplot class. A Dataset, be it two- or three-dimensional, is a lattice of values. If the values are scalars, the data set will be visualized as a level plot or volume plot. If the values are vectors, the data will be visualized as a vector field.
To initialize a data set, use:
```java
Dataset2D d2 = new Dataset2D(20,20,2);
Dataset3D d3 = new Dataset3D(30,30,30,1);
```
where the first set of parameters of the constructor are lattice dimensions and the last one is the dimension of the data.
In order to fill the data set object with values, use:
```java
for(int y = 0; y<=d2.maxy; y++)
for(int x=0; x<=d2.maxx; x++){
float[] pos = d2.position(x,y);
d2[x,y] = [pos[0]+0.05* sin(0.3*x), pos[1]+0.05* cos(0.4*x)];
}
```
The data in the Dataset(2/3)D object can be accessed in two ways: either using integer indices, which are interpreted as lattice points, or with floating point indices, which will be interpreted as a position in the plot, scaled to fit in a cube between -1 and 1. The easiest way to convert integer indices to the floating point position vector is with the position method, as...
shown above. The position is required for the vector field: for generality, the vectors are stored in the absolute frame of reference.
Using floating point indices allows the programmer to disregard lattice dimensionality. The above could be also achieved with:
```plaintext
for (float y = -1.0; y <= 1.0; y += 0.01)
for (float x = -1.0; x <= 1.0; x += 0.01)
d2[x, y] = [x + 0.05 * sin (0.3 * x), y + 0.05 * cos (0.4 * x)];
```
Note that position calculation is no longer needed, since x and y are already in the absolute frame of reference. Also note that the d2[x,y] notation is the same for integer or floating point indices.
In case of data sets of scalar values, like d3 in our example, it is legal to use either of the forms:
```plaintext
d3[x, y, z] = 3.14f;
d3[x, y, z] = [3.14f];
```
but the value of d3[x,y,z] is an array of length 1.
Having filled the data set with values, we can create a plot object. Three-dimensional plots have to be put in exhibits. An exhibit can contain several subobjects called views. View objects need to implement a method called draw in which they, basically, draw themselves, but the scale and position in space of the drawing can be determined by the Exhibit object, the default being the frame of reference of the exhibit. Any plot is thus a view within an exhibit object, allowing plots to be arranged and displayed together in the same frame of reference or scaled and transformed within a view's own space.
For easy displaying of plots in the same frame of reference, we have designed the Multiplot object. The multiplot contains an array of data sets and scatterplots and displays all of them.
```plaintext
Multiplot mp = new Multiplot();
mp.views ~= new PlotLegend("x","y","value");
mp.datasets ~= d2;
mp.datasets3d ~= d3;
mp.scatterplots ~= new Scatterplot();
scatterplot.points = [[0.0, 0.2, 0.5], [0.1, 0.1, 0.4], [0.2, -0.1, 0.2]];
```
The = operator is an append operator, standard to the D language. What happens in the above lines is that we append data sets to the arrays of the multiplot mp. Since the Multiplot is an Exhibit object, we can add views to it, in this case – a simple legend that automatically labels the x, y and z axes. In order to place the multiplot exhibit in the LOUVRE space, we use a similar notation:
```plaintext
gallery.floor[0]~=mp;
```
The gallery contains one floor by default. The multiplot will appear in the center of the floor and the camera will be looking at it when the application is initialized.
4.2 Overlay controls
Adding GUI controls to the overlay is a three step process. First, the controls need to be initialized:
```java
Button up = new Button(vec(-550,230), 30.0,
new Texture("textures/up.png"));
Button down = new Button(vec(-550,310), 30.0,
new Texture("textures/down.png"));
```
The above code creates two buttons, places them 550 pixels left from the center of the screen and 230 and 310 pixels down. The next parameter is the scale, in this case: 30 pixels. The parameter after that can be a texture object or a string constant.
The buttons are inactive and clicking them causes no action. Assigning actions to buttons is achieved by:
```java
up.onClick = &display.camera.forward;
down.onClick = &display.camera.back;
```
The display.camera is the built-in camera object, forward and back are the methods of the object. These methods, or rather delegates to those methods (the & notation) are assigned to the buttons and will be executed when the buttons are clicked.
All that is left is to add the buttons to the overlay interface:
```java
display.controls ~= [up, down];
```
The coordinate system for controls (centered in the center of the screen) may not be traditional, as most graphical environments are centered in the top-left corner, but it is consistent with the coordinate system used to place the exhibits and local coordinate systems used when drawing exhibit contents.
4.3 Slides, labels and animations
Additional information about the exhibits can be presented in the form of billboard like objects. The billboards can contain lines of text and graphics organized in rows, columns and combinations thereof, allowing for easy creation of presentation slides that will reside in the three-dimensional environment alongside other exhibits.
```latex
Slide introduction =
new Slide("What is Louvre?",
["− API", "− GUI", "− 3D engine", "− Graphing system"]);
```
The above line creates a Slide exhibit, which will contain a title and a bullet list in a column. The Slide constructor creates Label objects out of the string constants and determines their size. The title will be automatically resized to take up the whole exhibit width and the bullets in the list will be resized to have the same font size.

A Label object is a view containing either a line of text or a graphic and can be placed together with other views in an exhibit.
With complex views and labels organized into rows and columns, the LOUVRE system is a prototype of a three-dimensional user interface.
Any object in LOUVRE can be animated using Animation objects. An animation object is based on another object’s parameter, which would be changed with time. The simplest form of animation changes one parameter of an object from a start value to an end value during a given amount of time. More complex animations can change multiple parameters, modify them in a loop or according to a function. All animation objects are taken care of by a separate thread, which triggers animations, progresses those already running and stops them if their end conditions become true.
5 Other visualization projects
It is not easy to compare LOUVRE to other existing projects. It is a hybrid between a 3D graphics library, a plotting engine and presentation software, while not being a swiss army knife in either of those fields. Using the same software for supervision of experiments and presentation of results along with slides and informational graphics, shortens the work flow
and appeals to the imagination of people viewing the presentation. Since LOUVRE targeted at a specific user group – scientists and engineers, we have decided to compare it to some scientific visualization tools.
One of the most popular engines for visualization is VTK (Visualization Toolkit, [5]). VTK is an open source engine for 3D graphics, image processing and visualization with parallel rendering support and ports for multiple programming languages, including C++ and Python. Certainly a more universal and powerful tool than LOUVRE with a widespread user base and a large amount of documentation, tutorials and expert advice. In fact, VTK was considered for rendering the visuals for the machine learning project. For some researchers and programmers, including the authors of this paper, using a tool this universal is less convenient than using a simpler tool. At the level of complexity of VTK, unless advanced functionality is needed, designing a visualization that conforms to the needs of the project can be very time consuming. VTK workflow is very low level, allowing for various forms of visualization, but burdening the programmer with technical details and taking the focus away from the experimental data or simulation to be visualized. Another difference is that VTK is meant to be embedded in an external GUI, while LOUVRE has built-in GUI capabilities.
Another visualization package we investigated is AVS/Express [6]. It is a commercial software that requires minimal coding skills from the user. Also a powerful tool, that is much easier to learn than VTK. VTK and AVS have been compared by the authors of [7]. What needs to be pointed out is that unlike LOUVRE, AVS allows only for a single thread, event based execution paradigm. Also the user is confined within the range of premade modules. They provide an easy development with generic components but the user is blocked from the low-level control over visualization. What’s more – although the process of creating a visualization is much quicker than in VTK, it still is a slow and absorbing task.
Other visualization software like IBM OpenDX (which is very similar to AVS/Express), pv3 or Visad have their advantages and disadvantages. Some, like pv3, have difficulties dealing with huge scientific data. Some have parallel processing and some do not. Some are easy to set up, some are very troublesome. The way we believe LOUVRE stands out is by being a complete package for rapid visualization development that comes with a predefined set of templates that are used to build bigger structures, but it is flexible enough so that new templates can be added by a single programmer.
6 Conclusions and future plans
The LOUVRE project is based on a novel paradigm, which we believe to be intuitive for developers and end-users alike. It gracefully combines a three-dimensional simulation world with a two-dimensional GUI, while not burdening the developer with too much choice. Default settings for all objects are usually what the developer needs and what a viewer would expect. The gui is not advanced and lacks basic features found in other GUIs, but is unobtrusive and servers its purpose – to enable interaction with the gallery or display additional information on the screen. While anything that can be done in LOUVRE can also be done in a number
of other more universal tools, LOUVRE allows for rapid development of aesthetically looking and practical visualizations.
There are some weak points to LOUVRE. First, the dependence on the D compiler can be problematic to many programmers. It is worth noting here that one does not need to rewrite the existing simulation code to D, as linking with C code is easy. D is needed to design the simulation environment and, if necessary, extend the default objects. Another drawback lies in the gallery paradigm itself: LOUVRE fails for viewing flat images alongside three-dimensional plots or viewing a large number of visualizations at the same time. Two applications for which a set of windows would be perfect. Also, side by side windows would display three-dimensional plots as having the same scale, allowing for comparison, while LOUVRE forces a perspective and dims faraway objects. Despite these drawbacks, we believe that there are many possible scenarios in which LOUVRE can be used.
The gallery paradigm proved useful for a machine learning task and LOUVRE has been tested as a tool for displaying slides, akin to presentation software. These are two quite diverse uses that pave the way to a multitude of fields in which LOUVRE can be employed. Education has been mentioned before. Exploring the gallery requires no prior instruction for a student and any description of the objects can easily be included with the objects themselves – traits of a good learning application, an alternative to static pictures in a book. Students could learn about geometry, chemistry, physics, geography and arts, to name just a few, by observing animations prepared by a teacher.
Since the three-dimensional environment is made to resemble a building with objects placed on a grid, LOUVRE can easily be used for making interactive floor plans of buildings with detailed information about different areas in the building. The overlay can be used to display a map of the floor or controls for finding one’s way around in the building. Shopping malls, airports, hotels and other places in which visitors need to find their way to a certain room, store or office would benefit from an interactive, game like display.
In the future, we plan to extend LOUVRE by embedding a physics engine that would allow for more realistic animations and would simplify making simulations. We intend to enable the use of multi-touch devices for navigation and graphical user interface. The interoperability with more input-output file formats is a must, especially the ability to load and display mesh objects.
To further facilitate the development of applications and lessen the dependency on D we plan to make most common tasks scriptable, i.e. equip the LOUVRE system with an interpreter of a scripting language or link the library to a scripting language interpreter. The first option seems most tempting, although we acknowledge the practicality of making a Python module for creating and arranging visualizations. The GUI part of the project needs more polishing: the default controls are rather simplistic and placing them in pixel-exact positions is a burden. This could also be scriptable, with an automatic control positioning system. Grouping controls into sidebars is a good idea for future development. Also, any custom drawing of objects needs to be implemented in pure OpenGL. There should be a higher-level library for drawing GUI elements and custom three-dimensional objects.
To conclude this paper, we wish to express hope that the LOUVRE project gets a positive reception from the community and, through collaboration, the gallery paradigm will be adopted for different applications and more functionality will be added.
7 Acknowledgements
The authors wish to gratefully acknowledge the help of the Laboratory of Cognition and Behavior of RIKEN Brain Science Institute in which the concept of LOUVRE was born and first used during an experiment, as well as tested for presentation of experiment results.
The research was in part funded by the Polish Minister of Scientific Research and Higher Education grant N N201 385234 (2008-2010).
References
|
{"Source-Url": "https://journals.umcs.pl/ai/article/download/3287/2481", "len_cl100k_base": 6715, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 28012, "total-output-tokens": 7729, "length": "2e12", "weborganizer": {"__label__adult": 0.0004131793975830078, "__label__art_design": 0.0016946792602539062, "__label__crime_law": 0.00036263465881347656, "__label__education_jobs": 0.0023174285888671875, "__label__entertainment": 0.00015163421630859375, "__label__fashion_beauty": 0.00021016597747802737, "__label__finance_business": 0.00024259090423583984, "__label__food_dining": 0.0004444122314453125, "__label__games": 0.0007543563842773438, "__label__hardware": 0.0017108917236328125, "__label__health": 0.0007200241088867188, "__label__history": 0.0005297660827636719, "__label__home_hobbies": 0.00012946128845214844, "__label__industrial": 0.0006952285766601562, "__label__literature": 0.0003476142883300781, "__label__politics": 0.0002777576446533203, "__label__religion": 0.0006842613220214844, "__label__science_tech": 0.1630859375, "__label__social_life": 0.0001386404037475586, "__label__software": 0.0178680419921875, "__label__software_dev": 0.80615234375, "__label__sports_fitness": 0.0003266334533691406, "__label__transportation": 0.0006456375122070312, "__label__travel": 0.00027489662170410156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 33982, 0.02955]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 33982, 0.63167]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 33982, 0.92678]], "google_gemma-3-12b-it_contains_pii": [[0, 2060, false], [2060, 5618, null], [5618, 8208, null], [8208, 11344, null], [11344, 14261, null], [14261, 16804, null], [16804, 19337, null], [19337, 21851, null], [21851, 23269, null], [23269, 25439, null], [25439, 28777, null], [28777, 32247, null], [32247, 33982, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2060, true], [2060, 5618, null], [5618, 8208, null], [8208, 11344, null], [11344, 14261, null], [14261, 16804, null], [16804, 19337, null], [19337, 21851, null], [21851, 23269, null], [23269, 25439, null], [25439, 28777, null], [28777, 32247, null], [32247, 33982, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 33982, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 33982, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 33982, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 33982, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 33982, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 33982, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 33982, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 33982, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 33982, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 33982, null]], "pdf_page_numbers": [[0, 2060, 1], [2060, 5618, 2], [5618, 8208, 3], [8208, 11344, 4], [11344, 14261, 5], [14261, 16804, 6], [16804, 19337, 7], [19337, 21851, 8], [21851, 23269, 9], [23269, 25439, 10], [25439, 28777, 11], [28777, 32247, 12], [32247, 33982, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 33982, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
ae8515d2be8240a6cb2392d5454f452cc12b2124
|
[REMOVED]
|
{"Source-Url": "http://oro.open.ac.uk/31204/1/cw2011.pdf", "len_cl100k_base": 5213, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 28457, "total-output-tokens": 7542, "length": "2e12", "weborganizer": {"__label__adult": 0.00026297569274902344, "__label__art_design": 0.0002789497375488281, "__label__crime_law": 0.0002608299255371094, "__label__education_jobs": 0.00033545494079589844, "__label__entertainment": 6.073713302612305e-05, "__label__fashion_beauty": 0.00011712312698364258, "__label__finance_business": 0.0002512931823730469, "__label__food_dining": 0.00027251243591308594, "__label__games": 0.00027489662170410156, "__label__hardware": 0.0004651546478271485, "__label__health": 0.0003485679626464844, "__label__history": 0.00018966197967529297, "__label__home_hobbies": 4.988908767700195e-05, "__label__industrial": 0.00023984909057617188, "__label__literature": 0.00025916099548339844, "__label__politics": 0.0002435445785522461, "__label__religion": 0.0003170967102050781, "__label__science_tech": 0.0146026611328125, "__label__social_life": 7.706880569458008e-05, "__label__software": 0.01091766357421875, "__label__software_dev": 0.9697265625, "__label__sports_fitness": 0.00017762184143066406, "__label__transportation": 0.0003380775451660156, "__label__travel": 0.0001723766326904297}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29019, 0.02064]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29019, 0.19173]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29019, 0.84225]], "google_gemma-3-12b-it_contains_pii": [[0, 811, false], [811, 2868, null], [2868, 6182, null], [6182, 8331, null], [8331, 10912, null], [10912, 12400, null], [12400, 14890, null], [14890, 17555, null], [17555, 17668, null], [17668, 20406, null], [20406, 23197, null], [23197, 25823, null], [25823, 29019, null]], "google_gemma-3-12b-it_is_public_document": [[0, 811, true], [811, 2868, null], [2868, 6182, null], [6182, 8331, null], [8331, 10912, null], [10912, 12400, null], [12400, 14890, null], [14890, 17555, null], [17555, 17668, null], [17668, 20406, null], [20406, 23197, null], [23197, 25823, null], [25823, 29019, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29019, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29019, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29019, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29019, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29019, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29019, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29019, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29019, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29019, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29019, null]], "pdf_page_numbers": [[0, 811, 1], [811, 2868, 2], [2868, 6182, 3], [6182, 8331, 4], [8331, 10912, 5], [10912, 12400, 6], [12400, 14890, 7], [14890, 17555, 8], [17555, 17668, 9], [17668, 20406, 10], [20406, 23197, 11], [23197, 25823, 12], [25823, 29019, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29019, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
61b01910428c03fd3ccf9b22d342121415d655eb
|
The Time and Technology is Here to Stand Software Engineering on its Head
As an information society we have become a software society. Software is everywhere, from our phones and our desktops, to our cars, homes and every location in between. The amount of software used worldwide is unknowable; we do not even have agreed measures to quantify its extent or value [1]. We suspect there are at least 1 billion lines of code that have accumulated over time [1,2]. On the order of $875 billion was spent worldwide on software in 2010, of which about half was for packaged software and licenses and the rest for programmer services, consulting and outsourcing [3]. In the U.S. alone, about 2 million people work as programmers or related [4].
It goes without saying that software is a very big deal.
No matter what the metrics, it is expensive to develop and maintain software. This is also true for open source, which has its own costs of ownership [5]. Designing software faster with fewer mistakes and more re-use and robustness have clearly been emphases in computer science and the discipline of programming from its inception.
This attention has caused a myriad of schools and practices to develop over time. Some of the earlier efforts included computer-aided software engineering (CASE) or Grady Booch's (already cited in [1]) object-oriented design (OOD). Fourth-generation languages (4GLs) and rapid application development
(RAD) were popular in the 1980s and 1990s. Most recently, agile software development or extreme programming have grabbed mindshare.
Altogether, there are dozens of software development philosophies, each with its passionate advocates. These express themselves through a variety of software development methodologies that might be characterized or clustered into the prototyping or waterfall or spiral camps.
In all instances, of course, the drivers and motivations are the same: faster development, more re-use, greater robustness, easier maintainability, and lower development costs and total costs of ownership.
The Ontology Perspective in this Mix
For at least the past decade, ontologies and semantic Web-related approaches have also been part of this mix. A good summary of these efforts comes from Michael Uschold in an invited address at FOIS 2008 [6]. In this review, he points to these advantages for ontology-based approaches to software engineering:
- Re-use -- abstract/general notions can be used to instantiate more concrete/specific notions, allowing more reuse
- Reduced development times -- producing software artifacts that are closer to how we think, combined with reuse and automation that enables applications to be developed more quickly
- Increased reliability -- formal constructs with automation reduces human error
- Decreased maintenance costs -- increased reliability and the use of automation to convert models to executable code reduces errors. A formal link between the models and the code makes software easier to comprehend and thus maintain.
These first four items are similar to the benefits argued for other software engineering methodologies, though with some unique twists due to the semantic basis. However, Uschold also goes on to suggest benefits for ontology-based approaches not claimed by other methodologies:
- Reduced conceptual gap -- application developers can interact with the tools in a way that is closer to their thinking
- Facilitate automation -- formal structures are amenable to automated reasoning, reducing the load on the human, and
- Agility/flexibility -- ontology-driven information systems are more flexible, because you can much more easily and reliably make changes in the model than in code.
In making these arguments, Uschold picks up on the "ontology-driven information systems" moniker first put forward by Nicola Guarino in 1998 [7]. The ideas around ODIS have had substantial impact on the semantic Web community, especially in the use of formal ontologies and modeling approaches. The FOIS series of conferences, and most recently the ODiSE series, have been spawned from these ideas. There is also, for example, a fairly rich and developed community working on the integration of UML via ontologies as the drivers or specifiers of software [8].
Yet, as Uschold is careful to point out, the idea of ODIS extends beyond software engineering to encompass all of information systems. My own categorization of how ontologies may contribute to information systems is:
1. Domain modeling -- this category includes the domain knowledge representations and reasoning and inference bases that are the traditional understanding of ontologies in the semantic space. The structural aspects are akin to a database schema definition; the unique aspects of ontologies reside in their logic foundations and graph structures, which offer more power in inferencing, reasoning and graph analysis than conventional approaches
2. Model-driven architectures (MDA) -- like UML, these are platform-independent specifications that provide the functional and dataflow definitions of "models" executed by the system. These are the natural progeny of earlier CASE approaches, for example. Such systems also potentially allow graphical or visual means for building or hooking together components as a substitute to direct coding
3. Program specifications and executables -- though fairly experimental at present, these approaches use the languages of RDF, OWL or direct use of logic languages to create the equivalent of executable software programs. A couple of experimental systems include Fhat and Neno, for example, point to possible future directions in this area.[9]
4. Runtime or utility components -- proper construction of ontologies can be a source for labels and prompts within user interfaces and other runtime uses. Because of the ontology basis, these contributions may also be contextual.[10]
5. Automated agents -- based on context, user choices and the governing ontologies, new instruction sets can be generated via what some term automated agents or "robots" to instruct subsequent steps in the software, including potentially analysis or validation. Mission Critical IT.[11] is apparently the most advanced in this area; we discuss their ODASE approach more below
6. Bespoke drivers of generic applications -- through using and combining a number of the aspects above, in its totality this approach is a very different paradigm, as we describe below.
When we look at this list from the standpoint of conventional software or software engineering, we see that #1 shares overlaps with conventional database roles and #2, #3 and #4 with conventional programmer or software engineering responsibilities. The other portions, however, are quite unique to ontology-based approaches.
**But Is Software Engineering Even the Right Focus?**
For decades, issues related to how to develop apps better and faster have been proposed and argued about. We still have the same litany of challenges and issues from expense to re-use and brittleness. And, unfortunately, despite many methodologies *du jour*, we still see bottlenecks in the enterprise relating to such matters as:
*Software is merely an intermediary artifact to accomplish some given tasks. Rather than "engineering" software, the focus should be on how to fulfill those tasks in an optimal manner -- and that demands a systems approach.*
- data access
- queries
- data transformations
- data integration or federation
Ontology-Driven Apps Using Generic Applications - 03-07-2011
by Mike Bergman - AI3:::Adaptive Information - http://www.mkbergman.com
- reports
- other data presentations
- business analysis, and
- targeted, specialty functionality.
Promises such as self-service reporting touted at the inception of data warehousing two decades ago are still to be realized [12]. Enterprises still require the overhead and layers of IT to write SQL for us and prepare and fix reports. If we stand back a bit, perhaps we can come to see that the real opportunity resides in turning the whole paradigm of software engineering upside down.
Our objective should not be software per se. Software is merely an intermediary artifact to accomplish some given task. Rather than engineering software, the focus should be on how to fulfill those tasks in an optimal manner. How can we keep the idea of producing software from becoming this generation's new buggy whip example [13]?
For reasons we delve into a bit more below, it perhaps has required a confluence of some new semantic technologies and ontologies to create the opening for a shift in perspective. That shift is one from software as an objective in itself to one of software as merely a generic intermediary in an information task pipeline.
Though this shift may not apply (at least with current technologies) to transactional and process-based software, I submit it may be fundamental to the broad category of knowledge management. KM includes such applications as business intelligence, data warehousing, data integration and federation, enterprise information integration and management, competitive intelligence, knowledge representation, and so forth. These are the real areas where integration and reports and queries and analysis remain frustrating bottlenecks for knowledge workers. And, interestingly, these are also the same areas most amenable to embracing an open world (OWA) mindset [14].
If we stand back and take a systems perspective to the question of fulfilling functional KM tasks, we see that the questions are both broader and narrower than software engineering alone. They are broader because this systems perspective embraces architecture, data, structures and generic designs. The questions are narrower because software -- within this broader context -- can be now be generalized as artifacts providing the fulfillment of classes of functions.
**ODapps: The Ontology-Driven Application Approach**
*Ontology-driven applications -- or ODapps for short -- based on adaptive ontologies are a topic we have been nibbling around and discussing for some time. In our oft-cited seven pillars of the semantic enterprise we devote two pillars specifically (#4 and #3, respectively) to these two components [15]. However, in keeping with the systems perspective relevant to a transition from software engineering to generic apps, we should also note that canonical data models (via RDF) and a Web-
oriented architecture are two additional pillars in the vision.
ODapps are modular, generic software applications designed to operate in accordance with the specifications contained in one or more ontologies. The relationships and structure of the information driving these applications are based on the standard functions and roles of ontologies (namely as domain ontologies as noted under #1 above), as supplemented by the UI and instruction sets and validations and rules (as noted under #4 and #5 above). The combination of these specifications as provided by both properly constructed domain ontologies and supplementary utility ontologies is what we collectively term adaptive ontologies [16].
ODapps fulfill specific generic tasks, consistent with their bespoke design (#6 above) to respond to adaptive ontologies. Examples of current ontology-driven apps include imports and exports in various formats, dataset creation and management, data record creation and management, reporting, browsing, searching, data visualization and manipulation (through libraries of what we call semantic components), user access rights and permissions, and similar. These applications provide their specific functionality in response to the specifications in the ontologies fed to them.
ODapps are designed more similarly to widgets or API-based frameworks than to the dedicated software of the past, though the dedicated functionality (e.g., graphing, reporting, etc.) is obviously quite similar. The major change in these ontology-driven apps is to accommodate a relatively common abstraction layer that responds to the structure and conventions of the guiding ontologies. The major advantage is that single generic applications can supply shared functionality based on any properly constructed adaptive ontology.
In fact, the widget idea from Web 2.0 is a key precursor to the ODapps design. What we see in Web 2.0 are dedicated single-purpose widgets that perform a display operation (such as Google Maps) based on the properly structured data fed to them (structured geolocational information in the case of GMaps).
In Structured Dynamics' early work with RDF-based applications by our predecessor company, Zitgist, we demonstrated how the basic Web 2.0 widget idea could be extended by "triggering" which kind of mashup widget got invoked by virtue of the data type(s) fed to it. The Query Builder presented contextual choices for how to build a SPARQL query via UI based on what prior dropdown list choices were made. The DataViewer displayed results with different widgets (maps, profiles, etc.) depending on which part of a query's results set was inspected (by responding to differences in data types). These two apps, in our opinion, remain some of the best developed in the semantic Web space, even though development on both ceased nearly four years ago.
This basic extension of data-driven applications -- as informed by a bit more structure -- naturally evolved into a full ontology-driven design. We discovered that -- with some minor best practice additions to conventional ontologies -- we could turn ontologies into powerhouses that informed applications through:
- An understanding of the kind of things under consideration, including their inference chains
- The types of data in results sets, and how that informs the nature of the widget(s) (maps, calendars, timelines, charts, tabular reports, images, stories, media, etc.) appropriate to display and manipulate that information, and
- UI and utility functions such as interface labels, mouseovers, auto-suggests, spelling suggestions,
synonym matches, etc.
Like the earlier Zitgist discoveries, basing the applications on only one or two canonical data models and serializations (RDF and a simple data exchange XML, which Fred Giasson calls structXML) provides the input uniformity to make a library of generic applications tractable. And, embedding the entire framework in a Web-oriented architecture means it can be distributed and deployed anywhere accessible by HTTP.
Booch has maintained for years that in software design abstraction is good, but not if too abstract [1]. ODapps are a balanced abstraction within the framework of canonical architectures, data models and data structures. This design thus limits software brittleness and maximizes software re-use. Moreover, it shifts the locus of effort from software development and maintenance to the creation and modification of knowledge structures. The KM emphasis can shift from programming and software to logic and terminology [16].
In the sub-sections below, we peel back some portions of this layered design to unveil how some of these major pieces interact.
**Built Upon an Ontology- and Web-based Architecture**
Again, to cite Booch, the most fundamental software design decision is architecture [1]. In the case of Structured Dynamics and its support for ODapps, its open semantic framework (OSF) is embedded in a Web-oriented architecture (WOA). The OSF itself is a layered design that proceeds from a kernel of existing assets (data and structures) and proceeds through conversion to Web service access, and then ontology organization and management via ODapps [17]. The major layers in the OSF stack are:
- **Existing assets** — any and all existing information and data assets, ranging from unstructured to structured. Preserving and leveraging those assets is a key premise
- **scones / irON** - the conversion layer, in part consisting of information extraction of subject concepts or named entities (scones) or the instance record Object Notation for conveying XML, JSON or spreadsheets (CSV) in RDF-ready form (via irON or RDFizers)
- **structWSF** - a platform-independent suite of more than 20 RESTful Web services, organized for managing structured data datasets; it provides the standard, common interface by which existing information assets get represented and presented to the outside world and to other layers in the OSF stack
- **Ontologies** — are the layer containing the structured assets “driving” the system; this includes the concepts and relationships of the domain at hand, and administrative ontologies that guide how the user interfaces or widgets in the system should behave
- **conStruct** - connecting modules to enable structWSF and sComponents to be hosted/embedded in Drupal, and
- **sComponents** - (mostly) Flex semantic components (widgets) for visualizing and manipulating structured data.
Not all of these layers or even their specifics is necessary for an ontology-driven app design [18]. However, the general foundations of generic apps, properly constructed adaptive ontologies, and canonical data models and structures should be preserved in order to operationalize ODapps in other settings.
OSF is the Basis for Domain-specific Instantiations
The power of this design is that by swapping out adaptive ontologies and relevant data, the entire OSF stack as is can be used to deploy multiple instantiations. Potential uses can be as varied as the domain coverage of the domain ontologies that drive this framework.
The OSF semantic framework is a completely open and generic one. The same set of tools and capabilities can be applied to any domain that needs to manage and understand information in its own domain. With the existing ODApps in hand, this includes from unstructured text or documents to conventional structured databases.
What changes from domain to domain are the data structures (the ontologies, schema and entity references) and their instance data (which can also be converted from existing to canonical forms). Here is an illustration of how this generic framework can be leveraged for different deployments. Note that Citizen Dan is a local government example of the OSF framework with relatively complete online demos:
Structured Dynamics continues to wrinkle this basic design for different clients and different industries. As we round out the starting set of ODapps (see below), the major effort in adapting this generic design to different uses is to tailor the ontologies and "RDFize" existing data assets.
**Lower Layers**
Conversion of existing assets to RDF and canonical forms is not discussed further here. See the irON and scones documentation or the TechWiki for more information on these topics.
The structWSF Web Services Layer
The first suite of ODapps occurs at the structWSF Web services layer. structWSF provides a set of generic functions and endpoints to:
- Import or export datasets
- Create, update, delete (CRUD) or otherwise manage data records
- Search records with full-text and faceted search
- Browse or view existing records or record sets, based on simple to possible complex selection or filtering criteria, or
- Process results sets through workflows of various natures, involving specialized analysis, information extraction or other functions.
Here is a listing of current ODapp functions within structWSF (with links to details for each):
<table>
<thead>
<tr>
<th>WSF management Web services</th>
<th>User-oriented Web services</th>
</tr>
</thead>
<tbody>
<tr>
<td>• <strong>Auth</strong>: Validator</td>
<td>• CRUD: Create</td>
</tr>
<tr>
<td>• <strong>Auth</strong>: Lister</td>
<td>• CRUD: Read</td>
</tr>
<tr>
<td>• <strong>Auth Registrar</strong>: Access</td>
<td>• CRUD: Update</td>
</tr>
<tr>
<td>• <strong>Auth Registrar</strong>: WS</td>
<td>• CRUD: Delete</td>
</tr>
<tr>
<td>• <strong>Ontology</strong>: Create</td>
<td>• <strong>Browse</strong></td>
</tr>
<tr>
<td>• <strong>Dataset</strong>: Create</td>
<td>• <strong>Search</strong></td>
</tr>
<tr>
<td>• <strong>Dataset</strong>: Read</td>
<td>• <strong>Scones</strong></td>
</tr>
<tr>
<td>• <strong>Dataset</strong>: Update</td>
<td>• <strong>SPARQL</strong></td>
</tr>
<tr>
<td>• <strong>Dataset</strong>: Delete</td>
<td>• <strong>Import</strong></td>
</tr>
<tr>
<td></td>
<td>• <strong>Export</strong></td>
</tr>
</tbody>
</table>
At this level the information access and processing is done largely on the basis of structured results sets. Other visualization and display ODapps are listed in the next subsection.
The Semantics Components Layer
The visualization and data display and manipulation ODapps are provided via the semantic components layer. Structured Dynamics's sComponents are Flex-based widgets that conform to a standard, generic design. Other developers using the OSF framework are developing JavaScript versions [19]. Here is the current library (with links to details for each):
<table>
<thead>
<tr>
<th>New Components</th>
<th>Components Extending Flex</th>
</tr>
</thead>
<tbody>
<tr>
<td>• Portable Control Application</td>
<td>• sHBox</td>
</tr>
<tr>
<td>• sBarChart</td>
<td>• sImage</td>
</tr>
<tr>
<td>• SCO Ontology</td>
<td>• sText</td>
</tr>
<tr>
<td>• sControl</td>
<td></td>
</tr>
<tr>
<td>• sDashboard</td>
<td></td>
</tr>
<tr>
<td>• sGenericBox</td>
<td></td>
</tr>
<tr>
<td>• sLinearChart</td>
<td></td>
</tr>
<tr>
<td>• sMap</td>
<td></td>
</tr>
<tr>
<td>• sPieChart</td>
<td></td>
</tr>
</tbody>
</table>
These components can be used in combination with any of the structWSF ODapps, meaning the filtering, searching, browsing, import/export, etc., may be combined as an input or output option with the above.
The next animated figure shows how the basic interaction flow works with these components:
Using the ODapp structure it is possible to either “drive” queries and results sets selections via direct HTTP request via endpoints (not shown) or via simple dropdown selections on HTML forms or Flex widgets (shown). This design enables the entire system to be driven via simple selections or interactions.
without the need for any programming or technical expertise.
As the diagram shows, these various sComponents get embedded in a layout canvas for the Web page. By interacting with the various components, new queries are generated (most often as SPARQL queries) to the various structWSF Web services endpoints. The result of these requests is to generate a structured results set, which includes various types and attributes.
An internal ontology that embodies the desired behavior and display options (SCO, the Semantic Component Ontology) is matched with these types and attributes to generate the formal instructions to the sComponents. When combined with the results set data, and attribute information in the irON ontology, plus the domain understanding in the domain ontology, a synthetic schema is constructed that instructs what the interface may do next. Here is an example schema:
```
<geoname_wikipediaArticle>
<prefLabel>wikipedia article</prefLabel>
<description>Wikipedia article web page</description>
<allowedType>Neighborhood</allowedType>
<allowedType>City</allowedType>
<allowedType>Province</allowedType>
<allowedType>Country</allowedType>
<allowedValue>
<primitive>String</primitive>
</allowedValue>
</geoname_wikipediaArticle>
<muni_population_year_2006>
<prefLabel>population in 2006</prefLabel>
<description>Population of a geographical region in 2006</description>
<allowedType>Neighborhood</allowedType>
<allowedType>City</allowedType>
<allowedType>Province</allowedType>
<allowedType>Country</allowedType>
<allowedValue>
<primitive>Integer</primitive>
</allowedValue>
<maxValues>1</maxValues>
<orderingValue>2006</orderingValue>
<comparableWith>muni_population_year_1971</comparableWith>
<comparableWith>muni_population_year_1976</comparableWith>
<comparableWith>muni_population_year_1981</comparableWith>
<comparableWith>muni_population_year_1986</comparableWith>
<comparableWith>muni_population_year_1991</comparableWith>
<comparableWith>muni_population_year_1996</comparableWith>
<comparableWith>muni_population_year_2001</comparableWith>
<displayControl>sBarChart</displayControl>
<displayControl>sLinearChart</displayControl>
</muni_population_year_2006>
```
These instructions are then presented to the sControl component, which determines which widgets (individual components, with multiples possible depending on the inputs) need to be invoked and displayed on the layout canvas.
As new user interactions occur with the resulting displays and components, the iteration cycle is generated anew, again starting a new cycle of queries and results sets. Importantly, as these pathways and associated display components get created, they can be named and made persistent for later re-use or within dashboard invocations.
Self-service Reporting
Since self-service reporting has been such a disappointment [12], it is worth noting another aspect from this ODapp design. Every "thing" that can be presented in the interface can have a specific display template associated with it. Absent another definition, for example, any given "thing" will default to its parental type (which, ultimate, is "Thing", the generic template display for anything without a definition; this generally defaults to a presentation of all attributes for the object).
However, if more specific templates occur in the inference path, they will be preferentially used. Here is a sample of such a path:
```
Thing
├── Product
│ └── Camera
│ └── Digital Camera
│ └── SLR Digital Camera
│ └── Olympus Evolt E520
```
At the ultimate level of a particular model of Olympus camera, its display template might be exactly tailored to its specifications and attributes.
This design is meant to provide placeholders for any "thing" in any domain, while also providing the latitude to tailor and customize to every "thing" in the domain.
It is critical that generic apps through an ODapp approach also provide the underpinnings for self-service reporting. The ultimate metric is whether consumers of information can create the reports they need without any support or intervention by IT.
Adaptive Analysis
The Mission Critical IT reference provided earlier [11] helps point to the potentials of this paradigm in a different way. Mission Critical also shows user interfaces contextually chosen based on prior selections. But they extend that advantage with context-specific analysis and validation through the SWRL rules-
base semantic language. This is an exciting extension of the base paradigm that confirms the applicability of this approach to business intelligence and general enterprise analytics.
**Standing Software Engineering on its Head**
All of this points to a very exciting era for enterprise and consumer apps moving into the future. We perhaps should no longer talk about "killer apps"; we can shift our focus to the information we have at hand and how we want to structure and analyze it.
Using ontologies to write or specify code or to compete as an alternative to conventional software engineering approaches seems too much like more of the same. The systems basis in which such methodologies such as MDA reside have not fixed the enterprise software challenges of decades-long standing. Rather, a shift to generic applications driven by adaptive ontologies -- ODapps -- looks to shift the locus from software and programming to data and knowledge structures.
This democratization of IT means that everything in the knowledge management realm can become "self service." We can create our own analyses; develop our own reports; and package and disseminate what we and our colleagues need, when they need it. Through ontology-driven apps and adaptive ontologies, we can turn prior decades of software engineering practices on their head.
What Structured Dynamics and a handful of other vendors are showing is by no means yet complete. Our roster of ODapp widgets and templates still needs much filling out. The toolsets available for creating, maintaining, mapping and extending the ontologies underlying these systems are still woefully inadequate [20]. These are important development needs for the near term.
And, of course, none of this means the end of software development either. Process and transactions systems still likely reside outside of this new, emerging paradigm. Creating great and solid generic ODapps still requires software. Further, ODapps and their potential are completely silent on how we create that software and with what languages or methodologies. The era of software engineering is hardly at an end.
What is exceptionally powerful about the prospects in ontology-driven apps is to speed time to understanding and place information manipulation directly in the hands of the knowledge worker. This is a vision of information access and control that has been frustrated for decades. Perhaps, with ontologies and these semantic technologies, that vision is now near at hand.
---
[1] This estimate is from Grady Booch, 2005. "The Complexity of Programming Models," see [http://www.cs.nott.ac.uk/~nem/complexity.pdf](http://www.cs.nott.ac.uk/~nem/complexity.pdf). He comments on the weakness of software lines of code as a meaningful measure. At the time in 2005, he estimated perhaps 800 billion lines of code has accumulated, which given growth and vagaries of such guesstimates I have updated to the 1 billion number noted.
[2] For a wildly different estimate, that has been criticized somewhat, see Blackduck Software, 2009. "Estimating the Development Cost of Open Source Software," at [http://www.blackducksoftware.com/development-cost-of-open-source](http://www.blackducksoftware.com/development-cost-of-open-source). According to Blackduck's research there are over 200,000 OSS projects on the Internet representing more than 4.9 billion lines of available code from 4,000 sites that the company monitors. Blackduck estimates that reproducing this OSS would cost $387 billion for "typical" SLOC estimating bases. While Blackduck is likely in the best place of any organization to track open source given their business model, others have criticized the estimates
because only a portion (fewer than 10%, consistent with my own research) of open source projects are active, and many active projects also lack significant code bases. Nonetheless, there is still a huge disparity between the 1 billion SLOC estimate in [1] and this estimate of 5 billion for open source alone. This disparity is an indicator of the measurement challenges.
[3] See IMAP, 2010. *Computing & Internet Software Global Report — 2010*, 40 pp, see http://imap.com/imap/media/resources/HighTechReport_WEB_89B4E29C01817.pdf. The relative splits they show for software packages and licenses, IT consulting or outsourcing are 48%, 29% and 23%, respectively, of the total shown. Note however, that Gartner estimates are as high as 2x these amounts, again showing the uncertainty of measuring software; see, for example, http://www.gartner.com/it/page.jsp?id=1209913.
[5] Simply conduct a Web search on "open source" "cost of ownership" to see the many studies in this area. Depending on advocacy, estimates may be as high as proprietary software to a lower, but still substantial percentage. In no cases are open source understood to be fully "free" once maintenance, upgrades, modifications, and site adaptations are considered.
[8] See Phil Tetlow et al., eds., 2006. *Ontology Driven Architectures and Potential Uses of the Semantic Web in Software Engineering*, a W3C Editor's Draft on Best Practices, February 11, 2006; see http://www.w3.org/2001/sw/BestPractices/SE/ODA/. UML class diagrams have close resemblance to certain ontology structures. This effort was part of a formal collaboration between W3C and the Object Management Group (OMG), which resulted among other things in the production of the Ontology Definition Metamodel (ODM). In the OMG's model-driven architecture (MDA) initiative, models are used not only for design and maintenance purposes, but as a basis for generating executable artifacts for downstream use. The MDA approach grew out of much of the standards work conducted in the 1990s in the Unified Modeling Language (UML).
[9] Neno is a semantic network programming language and Fhat is a virtual machine that works off of it. These two projects have been largely abandoned. A related project is Ripple, a relational, stack-based dataflow language by Joshua Shinavier, which is episodically updated.
[10] Holger Knublauch of TopQuadrant has made the point that ontologies can also have runtime uses as well: "In contrast to conventional Model-Driven Architecture known from object-oriented systems, semantic applications use their data models not only at design time, but also as runtime components. The rich declarative semantics of ontological data models can be exploited to drive user interfaces and to control an application's behavior." See H. Knublauch, 2007. "From Ontology Design to Deployment: Semantic Application Development with TopBraid," presented at the 2007 *Semantic Technology Conference*, San Jose, CA; see http://www.semantic-conference.com/2007/sessions/15.html.
set of tools to facilitate the creation of working applications from a semantic business model (an ontology), using the open standards OWL, SWRL, and RDF. The ODASE code generators (a.k.a "robots") generate an API based on the business terminology defined by the OWL+SWRL+RDF business model, which the ODASE platform then uses to execute the rules and reasoning as contextual choices are made by the user. Among other links, the company has an impressive online demo that shows a consumer telecommunications purchase example; there is also a video explaining the rules basis of the ODASE framework.
[13] The buggy whip industry as a major economic entity ceased to exist with the introduction of the automobile, and is cited in economics and marketing as an example of an industry ceasing to exist because its market niche, and the need for its product, disappears. Not recognizing what industry or business purpose is being served is an oft-cited cause for obsolescence. Thus, software engineering is a practice that serves the creation of software, which itself is only a means to a functional end.
[14] See M. K. Bergman, 2009. "The Open World Assumption: Elephant in the Room," AI3:::Adaptive Information blog, December 21, 2009. The open world assumption (OWA) generally asserts that the lack of a given assertion or fact being available does not imply whether that possible assertion is true or false: it simply is not known. In other words, lack of knowledge does not imply falsity. Another way to say it is that everything is permitted until it is prohibited. OWA lends itself to incremental and incomplete approaches to various modeling problems.
[16] See M.K. Bergman, 2009. “Ontologies as the ‘Engine’ for Data-Driven Applications“, AI3:::Adaptive Information blog, June 10, 2009, for the first presentation of these topics, but the specific term adaptive ontology was not yet used. That term was first introduced in “Confronting Misconceptions with Adaptive Ontologies” (August 17, 2009). The dedicated treatment of these topics and their interplay was provided in M.K. Bergman, 2009. “Ontology-driven Applications Using Adaptive Ontologies“, AI3:::Adaptive Information blog, November 23, 2009. The relation of these topics to enterprise software was first presented in M.K. Bergman, 2009. “Fresh Perspectives on the Semantic Enterprise“, AI3:::Adaptive Information blog, September 28, 2009.
[17] Some 250 pp of complete technical documentation for these projects is provided on the Structured Dynamics' open source OpenStructs TechWiki.
[19] To find these groups and follow the open source OSF developments, see xxx. So long as the basic design comports with the foundations herein, sComponents may be developed in any rich Internet application (RIA) environment.
[20] Ontology development, management and mapping is the emerging imperative in the semantic technology space. For some thoughts on how Structured Dynamics is approaching this question, see a Normative Landscape of Ontology Tools on the TechWiki.
PDF generated by *AI3:::Adaptive Information* blog
|
{"Source-Url": "http://www.mkbergman.com/wp-content/uploads/kalins-pdf/singles/948.pdf", "len_cl100k_base": 7604, "olmocr-version": "0.1.53", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 32172, "total-output-tokens": 8678, "length": "2e12", "weborganizer": {"__label__adult": 0.0002713203430175781, "__label__art_design": 0.00035190582275390625, "__label__crime_law": 0.00023484230041503904, "__label__education_jobs": 0.00041103363037109375, "__label__entertainment": 5.2094459533691406e-05, "__label__fashion_beauty": 0.0001068115234375, "__label__finance_business": 0.00024890899658203125, "__label__food_dining": 0.0002579689025878906, "__label__games": 0.0003788471221923828, "__label__hardware": 0.00038743019104003906, "__label__health": 0.0002472400665283203, "__label__history": 0.00015234947204589844, "__label__home_hobbies": 4.673004150390625e-05, "__label__industrial": 0.00023066997528076172, "__label__literature": 0.0002244710922241211, "__label__politics": 0.00018155574798583984, "__label__religion": 0.00029969215393066406, "__label__science_tech": 0.007556915283203125, "__label__social_life": 5.811452865600586e-05, "__label__software": 0.00762939453125, "__label__software_dev": 0.97998046875, "__label__sports_fitness": 0.00017940998077392578, "__label__transportation": 0.0003173351287841797, "__label__travel": 0.00014317035675048828}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 38055, 0.0116]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 38055, 0.34078]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 38055, 0.90365]], "google_gemma-3-12b-it_contains_pii": [[0, 1434, false], [1434, 4479, null], [4479, 7483, null], [7483, 10439, null], [10439, 14045, null], [14045, 17219, null], [17219, 18269, null], [18269, 18580, null], [18580, 21484, null], [21484, 22089, null], [22089, 24344, null], [24344, 26644, null], [26644, 30344, null], [30344, 34341, null], [34341, 38005, null], [38005, 38055, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1434, true], [1434, 4479, null], [4479, 7483, null], [7483, 10439, null], [10439, 14045, null], [14045, 17219, null], [17219, 18269, null], [18269, 18580, null], [18580, 21484, null], [21484, 22089, null], [22089, 24344, null], [24344, 26644, null], [26644, 30344, null], [30344, 34341, null], [34341, 38005, null], [38005, 38055, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 38055, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 38055, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 38055, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 38055, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 38055, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 38055, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 38055, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 38055, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 38055, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 38055, null]], "pdf_page_numbers": [[0, 1434, 1], [1434, 4479, 2], [4479, 7483, 3], [7483, 10439, 4], [10439, 14045, 5], [14045, 17219, 6], [17219, 18269, 7], [18269, 18580, 8], [18580, 21484, 9], [21484, 22089, 10], [22089, 24344, 11], [24344, 26644, 12], [26644, 30344, 13], [30344, 34341, 14], [34341, 38005, 15], [38005, 38055, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 38055, 0.11386]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
bc0b401309488f9868f14e35957ad0bf5fffa2bf
|
Acceptance Test Driven Planning
Richard J. Watt\textsuperscript{1} David Leigh-Fellows\textsuperscript{2}
\textsuperscript{1} Richard J. Watt, ThoughtWorks, UK
\texttt{rwatt@thoughtworks.com}
\textsuperscript{2} David Leigh-Fellows, Egg, UK
\texttt{David.Fellows@Egg.com}
Abstract. The experience of writing and maintaining Acceptance Tests for many is not a successful one. Perhaps, like unit tests, their worth is misunderstood. When first introduced to acceptance testing many think of them merely as a form of black box testing and miss their greater significance as a multi-use form of requirements specification. We have found that by making acceptance tests not only central to the definition of a story but central to our process they can be used to drive the entire development. This paper describes an adaptation, or evolution to XP style planning that takes the existing planning practices (with some additions) and organises them in a way which we believe can lead to better planning and more predictable results.
1 Introduction: How Do We Know When We Are Done?
One of the defining questions for a development team is “do the developers know when they are done”. The question is a simple one but too often the answer is not as obvious as it should be. Whatever form the requirements are expressed in, it is important for the development team to be clear on what is to be implemented for them to know “when they are done”. Acceptance Tests (ATs) are an effective way of expressing requirements in a way that provides an unambiguous answer to this question. However, getting acceptance tests written and maintained is often difficult for a team. As we evolved our process over time there would be many bumps in the road to attend to but this seemed to be our biggest problem so we tackled it first.
Acceptance Tests are not only central to the definition of a story but by making them central to the process they can be used to drive the entire development [1].
2 And Then There Were Tests
There are many types of tests in software development projects. For our purposes we shall limit our discussion to unit, functional and acceptance style tests. We introduce these descriptions to make a distinction between these test types and to clarify our interpretation of ATs specifically.
2.1 Unit Tests
Unit Tests test units. In the context of XP style projects and Test-Driven Development (TDD) [2], unit tests serve two purposes:
- Unit Tests provide a means to automate the testing of code we develop at the level of methods, functions and procedures. In themselves they are useful but by assembling these individual tests into a suite of tests, we gain much more.
As a suite of tests they provide feedback on the effect of our changes to the existing code base, thus helping control and verify the internal quality of the code. Refactoring, one of the most important techniques to emerge in the last decade, would arguably not have been adopted so widely if it were not for the rise of unit testing and the Xunit framework specifically.
- In the context of TDD, they serve to provide us with a framework we can use to direct the design of the systems we develop.
In [1] the authors describe an approach where ATs are used to drive development; and they argue further that the advantages of unit testing can be met, and in some cases surpassed, solely through the application of ATs. By using ATs to drive development we are able to assess the external quality of the system but not the internal quality of the design or code itself. In our experience this carries an unnecessary risk and we would argue that the short (design) and long (maintenance) term benefits of unit testing outweigh their cost.
2.2 Functional Tests
Functional Tests\(^1\) fill the middle ground between Unit Tests and ATs. They are often used by developers to verify that their unit-tested components work together as expected. Unlike unit tests where the objects under test commonly have the objects on which they depend mocked out, functional tests interact with the actual objects. Functional tests are more extensive in their coverage and usually involve some kind of end-to-end scenario.
2.3 Acceptance Tests
Acceptance Tests specify the acceptance criteria for the story. If the story is the promise of a conversation then agreeing the ATs mark its conclusion.
It is during the course of this conversation that questions will be asked, the customer requirement will evolve and ultimately a shared understanding of the requirement will
\(^1\) Although originally the name given to what we now call acceptance tests [3], their meaning is now more commonly taken to be as described.
be reached which will shape what the developers implement for that story. Unlike unit or functional tests, the customer writes ATs.
It is common for these tests to be written during the course of the iteration, perhaps finalised midway through the iteration [3:1]. A disadvantage to this approach is the potential for developers to develop the wrong functionality in the interim period when the requirement is still not fully clear. This can result in subsequent rework to bring the code back in line once the requirement has been clarified.
In Planning Extreme Programming [5], Kent Beck and Martin Fowler remark on the idea of getting the customer to write the ATs in preparation for the iteration planning session, but go on to say that “it seems to be impossible to get the acceptance tests at the beginning of the iteration”. Brian Marick used the term “Coaching Tests” [6] to describe this scenario, although the name does not seem entirely appropriate. Alternatively, Joshua Kerievsky, has chosen to call ATs “Customer Tests” [7] but their meaning is essentially the same either way – only the name has changed.
The idea and practice of writing ATs definitions before the coding even begins has both obvious and subtle benefits that we will discuss in the next section. What are the obstacles to writing ATs before the iteration planning begins and how can they be overcome? We have sought to find answers to these questions in the last year and in doing so have developed an adaptation of iteration planning that has some key benefits over the traditional approach.
3. Why Acceptance Testing Is So Important
If a story serves as a description of the requirement then the ATs form the ultimate definition of the requirement. When we describe the acceptance criteria for a story we are defining the bounds of that story, helping our developers understand what to build and helping them know when they’re done. The ATs define the interface contract between what the customer wants and what the developers must implement.
ATs also provide us with a means to define acceptable external quality [8]. For example, in my application, if I click on a submit button and somewhere in the depths of the application a call is made to an unavailable sub-system, does the application go bang and display a generic error, does it elegantly attempt to recover and retry, or perhaps give me the offer of some alternate service? There are different costs associated with each option; each will result in a different user experience; and each will effect the user’s perception of external quality.
We rely on our automated unit tests to tell us if we have broken anything, and the same is true for ATs. If unit tests, as a side effect, provide a means to monitor and maintain internal quality then ATs provide the same function for external quality. Both are equally important but the external quality is what the customer sees and experiences, and therefore values most.
And how should we run our tests? We could run our ATs manually every time we add or change some functionality. Unfortunately this tends to be both resource and time intensive and often results in tests not being run as frequently as they should. To enjoy the same benefits we take for granted when writing unit tests, we should automate our ATs too.
The case for using ATs would seem to be a strong one and yet their adoption is far from universal. Why is this so?
Perhaps, like unit tests, their worth is misunderstood. When first introduced to TDD many developers perceive unit testing as purely a testing technique and miss its greater benefit as a design technique. The same can be said for acceptance testing. When first introduced to acceptance testing many think of them merely as a form of black box testing and miss their greater significance as a multi-use form of requirements specification.
Ultimately, there are many reasons why ATs are not always written and maintained and each of these constraints/issues must be addressed for acceptance testing to be successful:
- Customer participation: Unlike unit tests, which are written and maintained by the developers, the customer writes the ATs (although often with the help of development and/or QA) [3:2]. For those customers used to more traditional forms of development the demands of an agile project can initially be difficult and the responsibilities unclear. However the benefits are soon apparent. On one of our recent projects, our customers commented: “they’re [ATs] hard to write at first but helped me to feel comfortable about what I needed and what would be delivered” [9].
- Management buy-in: Quite often the reason the assigned customer finds the role a strain is because their duties are myriad and the project is just one of their many responsibilities. Management must be aware and supportive of the investment required to perform the role of a customer on an XP style project.
- QA availability: The purpose and process of writing unit tests is quite different from writing ATs and requires a different set of skills. QA people have the necessary skills to help the customer articulate the acceptance criteria for a story and their contribution is essential to the overall process.
- Our developers are already writing unit tests and the introduction of ATs means even more tests. “We’ve already got all these units tests to do and now we’ve got these ATs to implement as well” (sic) - nobody said it was going to be easy. For every useful test we write there is a benefit, and equally for every test we keep there is a maintenance cost. Our code hygiene
habits must be applied consistently to both our production and our test code if we are to remain agile.
In our experience we have found that once introduced to the benefits of TDD few developers abandon such a self-rewarding practice. The benefits of ATs are often not initially as compelling to developers as they are for unit testing. However, their value is soon acknowledged as the likelihood of misunderstanding the requirement is lessoned and thus rework avoided.
- ATs have traditionally been difficult to automate due to limited framework support. A framework helps reduce the cost of ownership by reducing the effort it takes to write and maintain tests. Of course, things have changed with the advent of functional testing frameworks like FIT [10] and the more recent FAT [11], but their popularity is still some way off that of the ubiquitous Xunit unit testing framework.
5. Now To Planning
Our experience of iteration planning was perhaps typical. As fully signed up members to the agile development cause, we all agreed that this form of planning was better than what we did before, and yet in our shared experience the process was never wholly successful and not without some pain. Maybe we were doing something wrong but the more people we spoke to the more we realised our experience of planning was at least not uncommon.
As an illustration of our plight, below is a description of a typical iteration planning session drawn from our shared experience:
All interested parties gather into a room which for us meant ‘n’ developers (where ‘n’ <= 12), our customer, our QA, often an interaction designer, our project manager, iteration manager and coach – all empowered to contribute to the planning process.
Our customer would describe each of the stories in turn. The developers would ask questions and discuss alternate solutions before producing a list of tasks for each story and an updated estimate figure. This process of discussion could take a long time and was once described by a customer as feeling more like a “techno babble” session than a planning one. From a developer perspective the customer could not provide the information they needed in order to produce confident estimates in the meeting. This resulted in best-guess estimates on the incomplete information. Our customer thought they had all the information to hand before they went into the session but even with their best efforts they couldn’t anticipate all the questions that were going to be asked.
What seemed like a good idea to start with did not feel so good 8 hours later as the team emerged tired and not so sure about this whole “empowerment” thing.
The real pain came when we measured our velocity at the end of the iteration and discovered the discrepancy between what we had signed up for and what we had
achieved. There are, of course, many reasons why this could have happened but once we had investigated underlying the causes we discovered that the main problem was that we hadn’t identified a complete set of tasks for each story. Next time there was much less enthusiasm about iteration planning. We could all see that the developers were working really hard and the results produced were good but in hindsight it was if they had started a 400m race but didn’t know where the finishing line was and just kept going round the track. Our understanding of the work was incomplete which meant it was unclear when we were done, which meant everyone was very tired and nobody was very happy. So we knew we had to do something.
6. Getting Our Stories Straight
One of the biggest problems we had in our planning sessions was that our customer felt that no matter what they did to prepare there were still many questions they could not answer without time for further analysis or/and investigation. Our solution was simple: a day or two before the end of the iteration the customer would sit down with the QA and a developer to begin the process of writing ATs for the upcoming stories, or in our terms, “Getting our Stories Straight”. In short, we still ended up asking the same questions but by doing this activity before the planning session we were able to find more answers earlier and thus be better prepared for when we did gather the full team into a room. This is not a return to “big up front analysis” but an acknowledgement that as we approach the end of an iteration we already have a good idea of what is going to be completed in this iteration and the customer has a good idea of what stories they want to include in the next.
Our principal aim at this stage was simply to better prepare the customer for our planning session so that developers could get more of the answers they needed at the time they needed them, but we soon discovered there were many more benefits. In particular we have identified the following benefits:
• **Are our tests any good?** The QA helps the customer make sure the acceptance criteria specify the expected behavior and external quality. The developer is on hand to make sure that there is no technical reason why the functionality required to pass the ATs cannot be implemented. If we liken this to UML use cases, a story becomes the title of the use case and the ATs become the use case itself detailing the main success scenario, alternate and error scenarios. [12].
• **Are our stories too big?** One of the positive side effects of this process is that it often highlights if a story is likely to be too big for the development team to estimate before we even get to the planning session. The simple correlation between the size and number of ATs and the size of the story has proven to be a reliable predictive indicator.
• **The chance to improve our estimates:** For a story that appears too large we may choose at this stage to break it into two or more smaller stories. In our
experience, smaller stories are easier to estimate accurately. We strive to have stories that can be ideally completed in 1 to 3 days.
- **Customer requirements vs. QA requirements**: The testing interests of the QA may go beyond that of what is needed to define the requirements for the story, but over time we have found that the difference is much smaller than we expected.
The last point is an important one. Using ATs as our “single source of truth” means the needs of both the customer and the QA function are served by a single artefact. We would later see how the same ATs could be used to improve our task breakdown and estimates. The key to these additional benefits was our decision to choose ATs as our focal point for all planning and development activities. With our stories “straight” the next thing to improve was how we ran our planning sessions.
### 7. The Planning Workshop
In Acceptance Test Driven Development the typical XP planning session is refactored into something we call the Planning Workshop. The objectives remain the same as the XP planning session (updates to our story estimates with a clearer picture of their dependencies), but we find the quality of the information provided is much improved.
The Planning Workshop is split into two phases, “Task Identification” and “Present and Challenge”.
#### 7.1 Task Identification.
We have a set of candidate stories for the next iteration, their ATs, some existing high level estimates and a vague understanding of what dependencies exist between stories.
The Planning Game Workshop begins with the customer presenting the candidate stories to the rest of the team. Each candidate story is described along with its ATs.
The developers are then grouped into triples and each mini team signs up to a subset of the stories for further analysis. We organise ourselves into triples because we’ve found that 3 is the optimum number of people to have in a mini team; we find that 3 people are able to fit around a pair station and the fact that we have an odd number always results in a mediator in case of disagreement.
Once each candidate story has a triple assigned we move into the phase designed to drive out the tasks required to pass the ATs. Each triple heads back to a workstation and pulls up the detailed ATs for their candidate stories. The customer and QA float between the triples answering any questions that may arise to make sure that everyone
is clear on what is required in the story. At this stage the existing ATs may be altered or (more rarely) added to.
The ATs provide a framework to help the developers think about what needs to be done; the developers consider each statement in turn and ask what functionality must be implemented to satisfy each statement; the answers to these questions become our tasks. It is useful and illustrative to consider what we did before and the reasons that led us to this process of task identification. In previous iterations, it became obvious to us that there was a discrepancy between the tasks identified for a story and the actual work required to complete a story. It was common to find a developer saying that they had finished the tasks for a story and now only had the ATs to implement. The problem was that it took the same time to implement the ATs as it had taken them to complete the tasks. Their original task breakdown, with all the best intentions, was incomplete. We quickly found that by using the ATs as the focus of the task identification exercise we were able to produce a list of tasks which was much more representative of the work that we would need to do to complete a given story. With the increase in confidence we gained from a more structured approach to task identification, we also found our estimates improved too.
7.2 Present and Challenge.
The next phase of our planning workshop is called “Present and Challenge”. The idea is that each triple presents their solution for a given story back to the rest of the team, and the rest of the team are then given the opportunity to challenge the list of tasks to see if we can refine the task list and the estimates given. This works well on two levels as it is a useful tool for exploring (at a high level) the proposed solution with the whole team present, whilst also acting as a double-check ensure we have considered all of the tasks.
In addition, this process gives the team members an opportunity to practice their presentation and debating skills. We have also found it can be useful in establishing team rapport – the sessions are designed to be challenging and we manage them carefully to avoid challenge turning into conflict. Finally, the process is time-boxed and takes 2-3 hours as compared to our previous and much less effective 6-8 hour marathon session.
8. Putting It All Together
We have spoken specifically about “Getting Our Stories Straight” and “The Planning Workshop”, but where do these activities fit into the larger picture?
In a two week iteration we are now able to limit the impact of planning activities down to a single day for nearly all the developers.
The morning marks the end of the existing iteration and begins with a show-and-tell session to allow interested (and paying) parties to come along and see what the team has achieved in the iteration. There are usually few surprises here as the customer and QA will have seen each story as it was completed during the iteration, but it is a useful opportunity for the team to appreciate all that has been achieved.
We then follow this with a short retrospective [13] where we discuss those things that went well, not so well, things that still puzzle us and any actions we need to take to improve.
An optional addition to the morning programme is a technical retrospective which we have used on occasion when there have been significant changes to the code base which not all members of the team have been directly involved in. This of course is a “smell” of sorts but, regardless, is often a useful way to get everyone back on the same page before we begin the next iteration.
A break for lunch, a new iteration begins and we are in the “Planning Workshop” for most of the afternoon.
A “Big Up Front Thinking” session at the end of the day is also optional but is sometimes used by the team to draw broad brush impressions (class and simple interaction diagrams mostly) of how the code might evolve for the set of stories we are just about to begin working on. Big up front design? Not really. It is just a way to share ideas and get clear in people’s minds current ideas on where we might go next.
The day is over and it is time to go home and look forward to another iteration.
9. Conclusion
Kent Beck has always been keen to stress that none of the guidelines or practices are new in themselves but that the organisation and order of their application is different. When practiced together they produce a benefit greater than the sum of their parts. The 12 plus\(^2\) practices can broadly be seen to fall into either one of two camps: planning or development type activities. We would argue that development is emphasized over planning yet in practice successful planning is more difficult to achieve.
The familiar mantra of test-code-refactor, combined with continuous integration and source control has given us a development environment with all the right ingredients and a fairly prescriptive recipe on how they should be practiced. From a developer standpoint these practices are self-serving and self-satisfying: we do them because they make our lives easier, more productive and fun. We continue to refactor not because we are told to but because we know that if we don't keep the code base clean we (or some other poor soul) will have to pay the cumulative price of working with our code debt. We write tests first because they drive out the functionality of the application. As a bonus they provide us with a suite of tests that signal when a change results in breaking something else in the existing application.
The planning activities, which make up the other half of XP, are much less prescriptive in how they should be applied. XP style planning, especially for those used to more traditional heavyweight processes, can initially appear almost too simple to work. Ultimately planning is about capturing requirements in some shape or form, prioritising which are most important, estimating the effort it will take to implement those requirements and delivering demonstrable business value on a regular basis. If only it was always this simple: The customer does not always know what they want when we need them to express their requirement: the requirement is not always clear to the developers; the developers are not clear when they are done; and task breakdown is incomplete, resulting in volatile velocity.
This paper describes an adaptation, or evolution to XP style planning which takes the existing planning practices (with some additions) and organises them in a way which we believe can lead to better planning and more predictable results. In developing the process, we have aimed, at every juncture, to find the least amount of work we could do and still make informed, quality decisions. Experience has taught us that this balance point is not easily found.
Over time we have recognised that Acceptance Test Driven Planning appears to have a ‘Goldilocks’ like quality – any more process and we feel the overhead, and any less and the process begins to fail. We do, of course, continue to look for ways in which we can improve the process but after many months and many projects, the balance we have found by planning and driving the development in this simple way feels “just right”.
\(^2\) For example, retrospectives are a commonplace practice on many XP style projects.
Biographies of the authors
Richard Watt: Richard is a coach and developer working with ThoughtWorks in the UK. In the last three years Richard has spent a large part of his time coaching and mentoring teams in XP and other Agile development methods. He has been a practitioner of XP since late '99 and can’t remember how he developed software before then but is sure the results weren’t as good.
David Leigh-Fellows: David Leigh-Fellows is a software architect and iteration manager. He has run half a dozen XP software projects since he came across Kent Beck three years ago. Dave has 15 years experience of software development and is a test driven everything convert.
Key Phrases
Extreme programming, acceptance testing, planning, unit testing.
Acknowledgements
To Owen Rogers and Ivan Moore for their contribution to the early development of some of the ideas presented in the paper; for being smart; and being great fun to work with.
To Alan Francis, Areiel Wolanow, and Ally Stokes for their constructive feedback in the earlier drafts; to Rachel Davies, Alex Howson, and Stuart Blair for their time and support in helping get the paper into a fit and proper state as the deadline loomed.
To Mary Poppendieck for her valued feedback and the ongoing support of our ideas.
And finally, to my colleague Rebecca Parsons for her hard work and encouragement in helping us make sure our work was best represented.
Bibliography
References
|
{"Source-Url": "http://static1.1.sqspcdn.com/static/f/447037/6485915/1270926040627/Acceptance+Test+Driven+Development.pdf?token=MUs1uQSAOIixC%2FL9CngxZ%2FqMkW8%3D", "len_cl100k_base": 5485, "olmocr-version": "0.1.49", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 23246, "total-output-tokens": 6523, "length": "2e12", "weborganizer": {"__label__adult": 0.0004305839538574219, "__label__art_design": 0.00032639503479003906, "__label__crime_law": 0.000293731689453125, "__label__education_jobs": 0.001854896545410156, "__label__entertainment": 4.4286251068115234e-05, "__label__fashion_beauty": 0.0001807212829589844, "__label__finance_business": 0.0004582405090332031, "__label__food_dining": 0.00037169456481933594, "__label__games": 0.0004706382751464844, "__label__hardware": 0.0004324913024902344, "__label__health": 0.0004127025604248047, "__label__history": 0.00018894672393798828, "__label__home_hobbies": 9.995698928833008e-05, "__label__industrial": 0.00030684471130371094, "__label__literature": 0.0002658367156982422, "__label__politics": 0.0002617835998535156, "__label__religion": 0.0004181861877441406, "__label__science_tech": 0.0015859603881835938, "__label__social_life": 0.0001220703125, "__label__software": 0.0030612945556640625, "__label__software_dev": 0.9873046875, "__label__sports_fitness": 0.0003800392150878906, "__label__transportation": 0.0004351139068603515, "__label__travel": 0.0002343654632568359}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28936, 0.02229]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28936, 0.2587]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28936, 0.96099]], "google_gemma-3-12b-it_contains_pii": [[0, 2308, false], [2308, 4696, null], [4696, 7663, null], [7663, 10343, null], [10343, 13160, null], [13160, 16192, null], [16192, 18634, null], [18634, 21168, null], [21168, 22889, null], [22889, 26017, null], [26017, 27636, null], [27636, 28936, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2308, true], [2308, 4696, null], [4696, 7663, null], [7663, 10343, null], [10343, 13160, null], [13160, 16192, null], [16192, 18634, null], [18634, 21168, null], [21168, 22889, null], [22889, 26017, null], [26017, 27636, null], [27636, 28936, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28936, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28936, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28936, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28936, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28936, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28936, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28936, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28936, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28936, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28936, null]], "pdf_page_numbers": [[0, 2308, 1], [2308, 4696, 2], [4696, 7663, 3], [7663, 10343, 4], [10343, 13160, 5], [13160, 16192, 6], [16192, 18634, 7], [18634, 21168, 8], [21168, 22889, 9], [22889, 26017, 10], [26017, 27636, 11], [27636, 28936, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28936, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
095b742e55e8f241d21bf8d059ab1c3e14aabc25
|
Analysis on the Security and Use of Password Managers
Carlos Luevanos
Willamette University
John Elizarraras
North Star Charter High School
Khai Hirschi
Capital High School
Jyh-Haw Yeh
Boise State University
© 2017 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 collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works. doi: 10.1109/PDCAT.2017.00013
Analysis on the Security and Use of Password Managers*
Carlos Luevanos¹, John Elizarraras², Khai Hirsch³, and Jyh-haw Yeh⁴
¹Dept. of Computer Science, Willamette University, CA
²North Star Charter High School, Eagle, ID;
³Capital High School, Boise, ID
⁴Dept. of Computer Science, Boise State University, ID
Abstract—Cybersecurity has become one of the largest growing fields in computer science and the technology industry. Faulty security has cost the global economy immense losses. Oftentimes, the pitfall in such financial loss is due to the security of passwords. Companies and regular people alike do not do enough to enforce strict password guidelines like the NIST (National Institute of Standard Technology) recommends. When big security breaches happen, thousands to millions of passwords can be exposed and stored into files, meaning people are susceptible to dictionary and rainbow table attacks. Those are only two examples of attacks that are used to crack passwords. In this paper, we will be going over three open-source password managers, each chosen for their own uniqueness. Our results will conclude on the overall security of each password manager using a list of established attacks and development of new potential attacks on such software. Additionally, we will compare our research with the limited research already conducted on password managers. Finally, we will provide some general guidelines of how to develop a better and more secure password manager.
Index Terms—Password Managers, Password Authentication
I. INTRODUCTION
In this paper, we will be discussing three open-source password managers: Passbolt [24], Padlock [8], and Encryptr [6]. We have chosen these three due to each unique quality they carry; we will mention them here once and then bring them up again in their separate sections. Passbolt was chosen for its unique property in that its full potential and benefits are reached when utilized by teams, companies, and closed groups of people who trust each other with sensitive information; additionally, Passbolt runs on OpenPGP [7], a secure email encryption standard founded by Phil Zimmerman. Padlock was chosen for its use of the Electron and Polymer developer environment as well as being a minimalist password manager. Lastly, Encryptr was chosen for its brow-raising qualities; all data is stored in the cloud, and it uses Crypton, a cryptography framework that implements a no-knowledge proof system, a somewhat fancier way of saying end-to-end encryption. To conclude our paper, we will compare and contrast all the features between these password managers and more popular ones in order to have a standard of security for this type of software in general.
*This work was partially funded by the NSF REU Software Security Site and NASA ISGC High School Summer Research Experience grants.
The organization of this paper starts with the related works in Section II. Following that we give a brief rundown and history of password managers. We then discuss each password manager in their own sections; we will go over Passbolt, Encryptr, and Padlock in that order. Each section contains subsections discussing the details of the password managers, reported security flaws already found for them, our reported flaws, a review and critique about the password manager, and then some potential solutions to the vulnerabilities. The paper concludes with suggestions of what an ideal password manager should have; we review some features of more popular password managers and look at the pros and cons of both open-source and closed-source password managers.
II. RELATED WORK
The niche of research on password managers has direct ties to that of applied cryptography and penetration testing, so the body of our work will go back to referencing a mix of academic papers on the security of more popular password managers and penetration testing write ups performed by security auditing teams, although we will reference some papers that display proof of concept or have contributed to the field in some other way. Additionally, we have tried our best to extend any and all audits performed on our three researched password managers. The earliest work for password managers comes from Luo and Henry in 2003 [20], who demonstrated a proof of concept and implementation of a more effective password manager, compared to Microsoft Passport. In 2005, Halderman et al’s work [19] comprised the proof of concept and implementation of a password manager in the web-browser, where an example implementation in Firefox was given in their work.
Moving on to the trend of security analysis, we are given insight on popular password managers such as LastPass and Roboform by Li, He, Song, and Akhawe [18]. Silver, Jana, Chen, Boneh, and Jackson [3] made outstanding contributions to the auto-fill feature found in popular password managers such as LastPass, KeePass, and those implemented in web-browsers such as Google Chrome and Safari. They found critical vulnerabilities that abused the auto-fill feature; such attacks include iFrame sweep attacks, password sync exploitation, and injections. Their work would help greatly influence the policies auto-fill executes. To show some of the root problems as to why password managers are seeming to
become more and more necessary, the work of Gaw and Felten [16] would contribute statistical analysis of surveys performed at Princeton University. Gaw and Felten found that participants often reused passwords for less important websites and predict this trend would grow as more on-line accounts accumulate. Participants were found to be ignorant to the security risks that this trend brings. They also found a feeling of indifference towards the use of password managers. Looking at the rising trend of cloud computing, the work of Zhao, Yue, and Sun [14] contributed to vulnerability analysis of LastPass and Roboform; they were able to detect threats such as credentials being stored in plain-text on cloud servers and offered suggestions to both product makers on how to better secure their data and product.
To conclude the related work we mention Gasti and Rasmussen [13]; their contributions include a forefront on the analysis of password manager database formats, as their paper’s title suggests: “On The Security of Password Manager Database Format.” What Gasti and Rasmussen found was that despite a number of password managers being different from each other, each pretty much used the same database format. They also found several vulnerabilities in each password manager they investigated.
III. OVERVIEW OF PASSWORD MANAGERS
A. Quick Rundown
First and foremost, we must define what a password manager is. Password managers are programs used to generate, encrypt, and store passwords for a client-side user. All that is required of a user is to remember one master password and user name. It is believed that using such software will increase security. Typically passwords will be stored on the local machine itself or on some hosted server. In some cases, they may be hosted on cloud servers to ensure more security for the parties involved; i.e., the user and the host of the servers/proprietors of a password manager. There is some variety in the types of password managers available to the public; some are built into web browsers such as Google Chrome, Mozilla Firefox, Safari, and Microsoft Edge, while others serve as standalone programs with the capability of web-browser integration. Some strictly enforce strong master passwords while others do not. More notably there are a few that have integrated multi-factor authentication, which is very beneficial to security. Given a brief rundown of such software, let us now delve into some history.
B. History of Password Managers
Not much is known about password managers; the first successful implementation of an effective password manager open to the public (to our knowledge), after the work of Luo and Henry [20], was KeePass, developed by Dominik Reichl [21], with an initial launch back in 2003. KeePass is a minimalist password manager that runs on Windows, Mac OS, and Linux, along with unofficial imports to Android, iOS, and Blackberry. The latest versions of KeePass use AES-256 bit encryption [40] along with ChaCha20-256 bit encryption [41]; however, KeePass does allow you to use other algorithms if you wish to do so, but we shall not go over technical specifications. Following a mixed response from the launch of KeePass, it would be a few years until commercial success for password managers took off; LastPass, Dashlane, and Robofor form serve as prime examples, with the LastPass being the most popular, having a reported 7 million users as of 2015 [22]. By the 2010’s it seems as if some kind of password manager mania has taken off. Many developers have begun focusing their time on password managers, and to increase popularity they made their work open-source, giving the public a chance to use their product and view their code, giving the technical community a chance to shape a password manager to their liking by giving feedback on what can be added onto or improved, or by exposing vulnerabilities [23]. This method seems to be useful in the fact that it is essentially a free security audit. Of course, the time it would take to report to developers would be much longer.
IV. OPEN-SOURCE PASSWORD MANAGERS
Now focusing our attention to the bulk of our work, let us recall our three password managers: Passbolt, Padlock, and Encryptr. Each of these password managers is open-source. We chose to look at open-source password managers for multiple reasons. First of all, because they are open-source, we can look at the source code ourselves. Additionally, this also allows us to set up our own servers to test on. Each password manager was chosen for their own unique properties. We shall go into technical detail about each one, along with pointing out vulnerabilities we have found in each one and referencing previous vulnerabilities exposed by others.
A. PASSBOLT
Passbolt is an open-source password manager initially developed by Kevin Muller, Diego Lendoiro, Remy Bertot, and Cedric Alfonsi, with later work of Passbolt being supported by the GitHub community. Passbolt’s core user-base includes development teams and companies, adopting the philosophy that company password policies can be shoddy or annoying, which in turn creates a less efficient workspace and perhaps some security vulnerabilities. The Passbolt development team believes their product can be adopted to ease the process of sharing passwords among peers and coworkers in an easier and much more secure way [24].
1) Overview of Passbolt: Currently, Passbolt only runs in a browser. More specifically, it only runs on Firefox and Google Chrome. This is reportedly due to them still being in the alpha development of Passbolt [25]. Passbolt was written in JavaScript, PHP, and Shell, and it currently uses OpenPGP for their encryption standard. Passwords stored in Passbolt are encrypted, and the database used by the client can also be encrypted to improve security. However, user names are not
encrypted and are stored in plain text. One existing problem for Passbolt includes the use of a bad pseudo-random number generator [25]. There is also no current way to change your master password or use multi-factor authentication. There is the option of emailing a copied list of your encrypted passwords to yourself should the option for email notification be enabled. Passbolt also boasts the use of a color security token which should prevent phishing, however, we believe we have found a way to bypass this feature which we will go into detail in our discovered flaws section. Another current flaw reported by the Passbolt team is the predicament of the client and server trusting all keys; although they admit to this being a flaw, they wish to fix this error in the future [25].
2) Reported Security Flaws: Found early in the surveillance of Passbolt, it was discovered by Wigginton et al that the use of the PHPseclib has the potential to default to the use of ECB encryption [4]. While this isn’t a direct flaw in Passbolt itself, it is still a flaw to consider. Reported problems by Passbolt include server integrity problems, DDoS attacks, server information leaks, key revocation, the potential of authentication cookies being stolen if SSL is broken, and the potential to mimic server keys [26]. It should be noted that Passbolt currently only uses MySQL servers, which have had reported problems that were recently fixed by Golunski [2]. Given that Passbolt is only in alpha and developed by a single team rather than a company, they do not have the resources to perform a full-stretched security audit; most vulnerabilities have been found by the developers themselves or by the GitHub community. The team’s use of cryptographic functions (by use of OpenPGP) has been reviewed by security audit team Cure53 [27]. The team was able to find several vulnerabilities in the OpenPGP library but we shall omit the details.
3) Our Discovered Flaws: To begin testing on Passbolt we opted to not perform any attacks already conducted, so we tried some of our own attacks. Before testing, we set up a private server using the Hamachi Virtual Private Network so that we could as closely as possible simulate a work environment typical to what Passbolt should be used for. The tools involved were all on Kali Linux, with the exception of some attacks written in C# and tested on Windows machines. It was very easy to see that a key-logger on an unsuspecting user would give us the master password. Passbolt was also found to be susceptible to a clipboard attack; given the generated passwords can be somewhat hard to read, a user will opt to just copy and paste rather than manually type their passwords, making strong individual passwords to websites and services seem useless if an attacker is successful.
Passbolt has a special feature to prevent phishing attacks; a user will remember a color assigned to them and it will be present when they attempt to log-in. We conducted an attack on their use of this color key token; by grabbing a live copy of a user’s session we were able to find the lines of code that gave us the color. Simply editing these lines we now had an exact copy of what a user would think is the login page, all working as if it were the real thing. With this, an attacker could potentially perform a phishing attack in which they can steal a user’s master password. See Figure 1 and Figure 2 for more detail.


One other attack we created was a custom user-script. A user-script is a custom script that users can install to gain extra functions to websites. Users will typically not look over all of the code in the user-script, so it would be easy to hide two lines of malicious code in a script that looks innocent. We created a script (see Appendix) that would secretly replace all links that download the Firefox Passbolt extension with another random extension. All the links appear to go to the original website, as seen in Figure 3. Because of the way Firefox installs extensions, the user will get a pop-up that says the website itself wants the user to download the fake extension, making the extension seem trusted (See Figures 4 and 5). The Passbolt extension itself can’t be modified, however, as Passbolt detects any changes and disables itself if it finds any. Downloading a fake extension would bypass this, and since the extension is open-source, mimicking the extension would be very simple. A proposed method to get the user to download this user-script is to hide the code inside a good user-script. As mentioned previously, the code would most likely go unchecked. Another method would be to hide it in an extension. The extension would then inject the JavaScript into the website.
4) Review and Critique: Overall, Passbolt was not a very user-friendly password manager and we question the integrity of the product. They have no reported security audits on their
product except a reference to the audit of OpenPGP, and they lack many key features other password managers have, which brings into question why they would even release an alpha version of their product. Additionally, their demo page is quite shoddy and the intended use of the password manager seems to often lead attackers to use cunning phishing attacks and DDoS attacks. The design also increases the risk of an attack on the main administrator, since they are at the core of how Passbolt should be used by a company. It should also be noted there is no enforcement of a strong master password, which is in itself a big security risk.
5) Solutions to Some Vulnerabilities: We suggest that the Passbolt team develop some features such as typing obfuscation and auto-fill to protect against keylogger and clipboard attacks. We also encourage the use of other types of servers besides MySQL. While not all servers are perfect, giving user options can potentially increase the overall security of the company using Passbolt. The user-script vulnerability is something that would be hard for Passbolt to stop, but they should at least use an HTML content security policy that would block scripts loaded from an off-line source, most of the time [12]. We would also recommend some way to either obfuscate the security token or develop some other method in order to prevent our proposed phishing attack.
B. ENCRYPTR
Encryptr is an open-source password manager initially developed by Tommy Williams and then bought out by SpiderOak [28], a company focused on building services that feature no-knowledge frameworks.
1) Overview of Encryptr: Encryptr is a cross-platform password manager, e-wallet, and note-holder written in JavaScript, HTML, CSS, JSON, and XML. Its encryption standard was built using the Crypton framework, created by SpiderOak. Crypton is an open-source framework developed in JavaScript with a primary goal to store information on a server without the server ever knowing what is stored [1]. Crypton’s back-end uses PostgreSQL [36], Redis [37], Node.js [38], and Docker [39]. Encryption and decryption are assumed in AES-256 using Galois/Counter Mode. For more specifics, ElGamal encryption [35] and ECDSA (Elliptic Curve Digital Signature Algorithm) [34] are used for signature verification, elliptic curve cryptography is used for key generation, and such ciphers can be switched for others if a user decides to do so [1]. The strength of Crypton is the protection of user data and data sharing, it is the direct belief of end-to-end encryption that users may feel more secure from attackers and the company hosting such a service. Crypton also uses SRP (Secure Remote Password) authentication, which reportedly limits data compromise, with the only supposed attack that being brute forcing AES keys [1]. Some weaknesses of Crypton include the ability of peer graph analysis and container access frequency analysis. What we mean by the former statement is that user-names are stored in plain text, so it is possible for database records to be analyzed in order to find connections between users and perform some intelligence gathering, leading to more potential attack vectors [1]. As for the latter, containers in Crypton can sometimes be created, updated, and accessed deterministically, which can lead to a potential brute force attack. However, this can be remedied using a strong password [1]. One last note about
Crypton and other SpiderOak applications is the use of the clipboard, which is reported by them to be safer than just typing all your information.
2) Reported Security Flaws: It should be noted in this section that no official security audit of Encryptr has been performed. Furthermore, to our knowledge no security audit has been performed on other SpiderOak services. Only two official security audits were performed and published on Crypton. The main issues reported by Leviathan Security Group include [10]:
1) An account’s public key is not verified against the decrypted private key. This could result in a user encrypting something that cannot be decrypted.
2) The public signing key is not verified against the private signing key.
3) A container by the name of containerNameHMacKey is not verified before decryption, so the server could replace it with a different known container and encrypt a new symmetric key to the user’s public key.
A look into the report by Least Authority gave us some more insight into the security of Crypton which includes [11):
1) Server information forgery: attackers with access to the server can overwrite and forge data on a user’s account.
2) Guessable private keys: an attacker with server access can grab copies of cipher-text and read the plain-text.
3) An attacker with server access can disclose the encryption key, essentially making all container contents available to them.
Having read both reports we noticed plenty of the attacks included DDOSing. While not the largest security threat to worry about, it can still cost companies quite a bit of money and reputation. The reports failed to include auditing web-based attacks such as XSS attacks (Cross-Site Scripting), CSRF attacks (Cross-Site Request Forgery), Man-In-the-Browser attacks, and SQL injections.
3) Our Discovered Flaws: Our reported findings of vulnerabilities for Encryptr include:
1) High security threat with clipboard attacks (copying is the easiest way to transfer passwords from Encryptr to a form).
2) Susceptible to key-loggers when typing your master password or when transferring passwords from Encryptr to a form without copy-paste.
4) Review and Critique: Encryptr was the most minimal of the three open-source password managers reviewed by far; it was incredibly simple, it could be used on almost all platforms and did not require the use of an email, yet you could still retrieve the same data from other devices. One critique of Encryptr is that after some further investigation it was discovered some code is still obfuscated. It is also noted that there is no strict enforcement of strong passwords and generated passwords have a default length of 12 characters.
5) Solutions to Some Vulnerabilities: Like for Passbolt, we recommend SpiderOak implement an auto-fill feature for passwords and credit-card information, along with typing obfuscation should user’s create their own passwords instead of generating one.
C. PADLOCK
Padlock is a minimalist, open-source password manager developed by Martin Kleinschrodt using the Electron and Polymer frameworks, so like Passbolt and Encrypt, it was all written in JavaScript, HTML, and CSS, and for the most part, all code is available to the public. Padlock is multi-platform and can be used on Windows, MacOS, Android, iOS, and some time in the future, Linux.
1) Overview of Padlock: Similar to Passbolt and Encrypt, Padlock uses a copy/paste function to quicken the process of using one’s passwords. As noted earlier, this leads to very big security problems. One of the notable features of Padlock is that the application automatically logs you out of your vault in one minute if there is no user activity detected. This feature can be changed to a maximum of ten minutes or can even be disabled if the user wishes to do so. Padlock uses its own password generator, however, its weakness is that 7 character passwords with at least one uppercase letter, lowercase letter, and special character are considered very strong by Padlock. By the 2017 NIST standards, these generated passwords are not considered secure [29].
2) Reported Security Flaws: Surprisingly, the creator of Padlock has a repository for penetration testing of his own application. Furthermore, the penetration team Cure53 was hired to do even more extensive testing. The reports detail some of the following vulnerabilities:
- Tap-jacking [9].
- Exposed authentication tokens during API requests, leading to Man in the Middle attacks [9].
- Permanent DoS attack on mobile devices: an attacker with server access can increase the number of iterations, essentially making the CPU do a job it cannot do, and ultimately having to make the user reset Padlock if they want to use the application on their phone again. However, resetting Padlock will delete all information stored [9].
- DoS email attacks [9].
3) Our Discovered Flaws: Since Padlock uses the clipboard like Passbolt and Encrypt, along with no auto-fill feature, it was easy to discover that Padlock is susceptible to clipboard attacks and key-loggers. Additionally, we wrote a script (see Appendix) that would be able to reset a user’s account, all that is required is the user click a button, thus deleting all their saved passwords and information. The attack involves a user installing a script or extension which would then inject JavaScript into the Padlock web page. For testing purposes, we did this using our own personal server, but we
believe it can be easily adapted to any other server using Padlock. We also used a user-script (defined in subsection IV-A.3) to manipulate a vulnerability in Padlock. Padlock has an on-line dashboard where users can change what devices have access to their account, as well as reset their data—with no password. To abuse this fault, we made a script that would reset the user’s data the instant they logged into the dashboard. It should be noted that Padlock does try to prevent this. It uses content security policies that block off-line scripts [12]. This method will break certain user-script managers (extensions that install and inject the user-scripts) but some managers are able to bypass the security policy. This is something Padlock can’t fix but they should ask for more verification, such as a password, to reset all of the user’s data. It is just two clicks to clear all of the passwords and devices on an account. It should be noted that if you don’t reset the client, your passwords are safe, but if the cloud was the only place where the passwords were stored, this method will make the passwords unrecoverable. Another script (see Appendix) we made would revoke all of the devices, meaning that the user would lose access to the cloud on their devices. This isn’t a huge issue, as the user can just reconnect, but it demonstrates Padlock’s vulnerability to script attacks.
4) Review and Critique: Padlock lived up to its name of being a minimalist password manager that got the job done and we were quite pleased with the initial security audits that were reported on the application. Overall it was easy to use and the ability to use a custom server was a nice addition. However, we did not like the minimum security standards of generated passwords, nor was there any strict enforcement of strong master passwords.
5) Solutions to Some Vulnerabilities: Similar to Passbolt and Encryptr, we suggest the creation of an auto-fill feature as well as typing obfuscation to prevent keylogger and clipboard attacks. Additionally, we suggest that the reset feature be removed, as loss of all passwords in one swoop can be easy; whether they be by someone with direct access to the local machine or by some social-engineering attack.
V. CONCLUSION: WHAT MAKES A PASSWORD MANAGER MORE SECURE
In this section, we will review the strengths and weaknesses of all the password managers we looked at in comparison with the strengths and weaknesses of more popular password managers in order to envision what a more secure password manager would look like.
A. Strengths of Open-Source Password Managers
Looking back at Passbolt, Encryptr, and Padlock, one of the greatest strengths they commonly share is the fact that they are open-source. This allows for consumers to examine the code and report any vulnerabilities and bugs themselves to quicken the refinement process. This method of putting trust into the consumer eases some of the burdens for developers and, of course, saves money; however, this does come at the cost that bugs and vulnerabilities may be found at a much slower pace. The option of users setting up their own servers is also a nice feature that can potentially increase security for users who know what they are doing, but this can be detrimental when attackers gather knowledge of targets using their own servers. It should be noted that the use of end-to-end encryption by Encryptr, i.e. Crypton, is a very desirable feature, especially for those who want the utmost privacy they can get. Such no-knowledge features were even commented on by Edward Snowden, who is pushing for end-to-end encryption to become a more standard feature in cloud storage [30].
B. Weaknesses of Open-Source Password Managers
Being open-source allows people to find vulnerabilities, but not everyone will report the security problems they find. An attacker can keep a vulnerability they found secret and use it in a future attack. Additionally, quite a few open-source password managers do not have many features that strengthen security like more well-known, closed-source password managers do. In order for an open-source product to be successful, it must have a strong group of supporters that review the code and make suggestions, and a development team that listens to feedback and works quickly and diligently.
C. Strengths of Closed Source Password Managers
Closed source password managers have the benefit of keeping their code hidden from potential attackers. This means that an attacker usually won’t be able to see the code and exploit vulnerabilities found in it. It also means duplicating the password manager is harder, so certain attacks, like a fake extension, wouldn’t be as effective. We would also like to point out some of the desirable features that closed-source password managers such as LastPass have. LastPass includes features such as auto-fill, and two-factor authentication using your phone, or fingerprint. LastPass also includes the feature of passwords only being local, meaning they are stored only on the machine [31]. Closed source password managers also include features such as secure file and password sharing, tracking history of what sites were logged-in, and reports of the current strength of your passwords. Such features were included in password managers such as LastPass, Dashlane, and Roboform [32].
D. Weaknesses of Closed Source Password Managers
The main weakness of a closed source password manager is the proprietor behind it. The user has to trust that the company is securely storing their passwords, since the user doesn’t know the details of how their passwords are being stored and processed. The proprietor is also responsible for security updates, and they will usually have fewer people looking over each line of code than an open-source project would. The users have to trust that the owner of the password manager is responsible and active in providing security updates. Furthermore, while it is not feasible to claim that closed-source password managers are at risk of facing more attacks, the implications behind a security breach are detrimental; larger closed-source managers risk losing massive amounts of assets and user data since they are larger targets with more resources...
to take from. Such an example can be seen from LastPass in the first quarter of 2017, an exploit found by a Google researcher revealed a flaw that could have let attackers exploit the LastPass browser extension [33].
E. Theoretical Design for a Good Password Manager
A good password manager would prioritize security over ease of use. Firstly, the password manager would be open-source to ensure that anyone who uses it can know what it is doing to protect their privacy. While a long password may be annoying to the user, the master password must be strong. If the master password is weak to brute force attacks, it brings down the security of the whole password manager. For this reason, the password manager would require a complex master password that meets the 2017 NIST standards. We would also suggest to add an auto-fill function to the password manager. This would prevent clipboard and keylogger attacks if implemented correctly. Our approach to auto-fill would be to press a browser extension button to activate the auto-fill function on the current site, much like certain other password managers already do. We would also lock the user’s vault after a specified period of inactivity set by the user (no longer than two hours). The user would then need to type in their master password again before using the password manager. For cloud storage, we would suggest using a no-knowledge approach, similar to Encryptr, to ensure that the server and any server-side attackers don’t have access to any password. We would allow the use of a custom server, but force the use of HTTPS. We would try to make every step as automated as possible to increase usability. This would include setting up a custom server, since all of the password managers we tested had a very difficult setup process.
References
[34] Don Johnson, Alfred Menezes and Scott Vanstone, "The Elliptic Curve Digital Signature Algorithm (ECDSA), http://cs.ubc.ca/~koc/c130/hotnotes/ecdsa-cert.pdf
[38] "Node.js Foundation," https://nodejs.org/en/about/
APPENDIX
Listing 1: Script that will make all links that download the Firefox Passbolt Extension change to download NoScript (An arbitrarily chosen extension)
```javascript
// Changes all of the links that download the Firefox extension
var links = document.querySelectorAll("a[href='https://www.passbolt.com/download/firefox']"); // gets all links meant to download the Passbolt firefox extension
for (var i = 0, len = links.length; i < len; i++) { // go through all the links
var link = links[i];
link.setAttribute('onclick', "location.href='https://goo.gl/2WjK9u';return false;";)
// makes the href change to our page when the link is clicked. This allows us to hide
// the real location of the link since it only changes where it goes after you click the
// link.
}
```
Listing 2: Script for Padlock that resets all of the data once the user logs into their dashboard
```javascript
// Clicking reset data link
var links = document.querySelectorAll("a[href='.?action=resetdata']"); // gets the link to reset data
for (var i = 0, _len = links.length; i < _len; i++) {
var link = links[i];
link.click(); // clicks the link to reset
}
// Clicking buttons
setTimeout(function() {
var buttons = document.getElementsByTagName('button'); // gets all buttons on page
for (var j = 0; j < buttons.length; j++) { // Loop through all buttons
if (typeof buttons[j].click === "function") { // checks to see if button.click is a function
buttons[j].click(); // clicks the button
}
}, 1); // Times out to allow webpage to show buttons after clicking link
```
Listing 3: Script that revokes all devices connected to a Padlock Cloud once the user logs into the dashboard
```javascript
// Submits the form that revokes all devices on Padlock Cloud
var forms = document.forms; // gets all forms on page
for (var i = 0, len = forms.length; i < len; i++) { // Loop through all forms
forms[i].submit(); // submit all of the forms found
}
```
For documentation on these scripts, go to https://github.com/iblacksand/vulnerabilitydocumentation. It features the full scripts, a keylogger, and a clipboard reader. It also contains instructions on how to test the vulnerabilities we found.
|
{"Source-Url": "https://scholarworks.boisestate.edu/cgi/viewcontent.cgi?article=1175&context=cs_facpubs", "len_cl100k_base": 7448, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 25798, "total-output-tokens": 9981, "length": "2e12", "weborganizer": {"__label__adult": 0.0005640983581542969, "__label__art_design": 0.0009136199951171876, "__label__crime_law": 0.0038547515869140625, "__label__education_jobs": 0.0033168792724609375, "__label__entertainment": 0.0002930164337158203, "__label__fashion_beauty": 0.0003180503845214844, "__label__finance_business": 0.0011539459228515625, "__label__food_dining": 0.0003895759582519531, "__label__games": 0.0023136138916015625, "__label__hardware": 0.003736495971679687, "__label__health": 0.001033782958984375, "__label__history": 0.0004546642303466797, "__label__home_hobbies": 0.0002624988555908203, "__label__industrial": 0.0004334449768066406, "__label__literature": 0.0006041526794433594, "__label__politics": 0.00041794776916503906, "__label__religion": 0.0004754066467285156, "__label__science_tech": 0.19873046875, "__label__social_life": 0.00026679039001464844, "__label__software": 0.266357421875, "__label__software_dev": 0.51318359375, "__label__sports_fitness": 0.00033402442932128906, "__label__transportation": 0.00024628639221191406, "__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, 42566, 0.0208]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 42566, 0.36855]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 42566, 0.93755]], "google_gemma-3-12b-it_contains_pii": [[0, 635, false], [635, 5923, null], [5923, 11801, null], [11801, 16904, null], [16904, 20345, null], [20345, 25821, null], [25821, 32086, null], [32086, 40323, null], [40323, 42566, null]], "google_gemma-3-12b-it_is_public_document": [[0, 635, true], [635, 5923, null], [5923, 11801, null], [11801, 16904, null], [16904, 20345, null], [20345, 25821, null], [25821, 32086, null], [32086, 40323, null], [40323, 42566, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 42566, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 42566, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 42566, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 42566, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 42566, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 42566, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 42566, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 42566, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 42566, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 42566, null]], "pdf_page_numbers": [[0, 635, 1], [635, 5923, 2], [5923, 11801, 3], [11801, 16904, 4], [16904, 20345, 5], [20345, 25821, 6], [25821, 32086, 7], [32086, 40323, 8], [40323, 42566, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 42566, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-08
|
2024-12-08
|
ca19d9b510f2f0940d5d5fb95393056302aa5ca1
|
### SPARTex
<table>
<thead>
<tr>
<th>Item Type</th>
<th>Article</th>
</tr>
</thead>
<tbody>
<tr>
<td>Authors</td>
<td>Abdelaziz, Ibrahim; Al-Harbi, Razen; Salihoglu, Semih; Kalnis, Panos; Mamoulis, Nikos</td>
</tr>
<tr>
<td>Eprint version</td>
<td>Publisher's Version/PDF</td>
</tr>
<tr>
<td>DOI</td>
<td>10.14778/2824032.2824091</td>
</tr>
<tr>
<td>Publisher</td>
<td>VLDB Endowment</td>
</tr>
<tr>
<td>Journal</td>
<td>Proceedings of the VLDB Endowment</td>
</tr>
<tr>
<td>Rights</td>
<td>This work is licensed under the Creative Commons Attribution Non Commercial-No Derivs 3.0 Unported License.</td>
</tr>
<tr>
<td>Download date</td>
<td>2023-11-01 10:44:07</td>
</tr>
<tr>
<td>Item License</td>
<td><a href="http://creativecommons.org/licenses/by-nc-nd/3.0/">http://creativecommons.org/licenses/by-nc-nd/3.0/</a></td>
</tr>
<tr>
<td>Link to Item</td>
<td><a href="http://hdl.handle.net/10754/668634">http://hdl.handle.net/10754/668634</a></td>
</tr>
</tbody>
</table>
SPARTex: A Vertex-Centric Framework for RDF Data Analytics
Ibrahim Abdelaziz*† Razen Harbi*† Semih Salihoglu‡ Panos Kalnis* Nikos Mamoulis†
* KAUST, Saudi Arabia † Stanford University, USA ‡ University of Ioannina, Greece
{first.last}@kaust.edu.sa semih@stanford.edu nikos@cs.uoi.gr
ABSTRACT
A growing number of applications require combining SPARQL queries with generic graph search on RDF data. However, the lack of procedural capabilities in SPARQL makes it inappropriate for graph analytics. Moreover, RDF engines focus on SPARQL query evaluation whereas graph management frameworks perform only generic graph computations. In this work, we bridge the gap by introducing SPARTex, an RDF analytics framework based on the vertex-centric computation model. In SPARTex, user-defined vertex-centric programs can be invoked from SPARQL as stored procedures. SPARTex allows the execution of a pipeline of graph algorithms without the need for multiple reads/writes of input data and intermediate results. We use a cost-based optimizer for minimizing the communication cost. SPARTex evaluates queries that combine SPARQL and generic graph computations orders of magnitude faster than existing RDF engines. We demonstrate a real system prototype of SPARTex running on a local cluster using real and synthetic datasets. SPARTex has a real-time graphical user interface that allows the participants to write regular SPARQL queries, use our proposed SPARQL extension to declaratively invoke graph algorithms or combine/pipeline both SPARQL querying and generic graph analytics.
1. INTRODUCTION
SPARQL is the standard RDF query language; it allows users to express subgraph pattern matching queries. On the other hand, there is an emerging new type of RDF analytics [9, 10] that require the combination of generic graph search operations with SPARQL patterns. Examples for such operations are reachability queries, centrality analysis and community detection. For example, Qu et al. [9] filter the results of SPARQL queries by a set of graph centrality algorithms to identify the key biological entities within the resulting RDF subgraphs. Rietveld et al. [10] represent the RDF data as a directed unlabeled graph, analyze it by degree centrality and PageRank operations using a generic graph engine, re-write the result back into RDF format, and run on it SPARQL queries. In this case, SPARQL queries are evaluated against a mutated RDF graph, enriched by centrality and PageRank information for each node.
Putting aside the aforementioned attempts which are application-specific, state-of-the-art centralized [6, 13] and distributed [7, 2] RDF data management systems fail to support graph search operations in a principled way and they only target SPARQL queries. SPARQL itself lacks procedural capabilities; therefore, expressing graph operations using SPARQL [12] results in verbose and complex queries that are (i) expensive to evaluate; and (ii) hard to formulate, read and understand by users. This is evident in some recent works [12, 8, 5], which try to express generic graph operations using SPARQL: these approaches are limited to a small set of graph operations like clustering and graph diffusion. On the other hand, a deluge of vertex-centric graph management systems have been proposed for efficient graph analytics, like Pregel [4] and GRACE [1]. However, these systems lack the capability of evaluating ad-hoc SPARQL queries, which means that a vertex-centric program has to be written for each SPARQL query. Such an approach is tedious and requires prior knowledge about the data, in order to select the optimal query evaluation plan.
In this paper, we introduce SPARTex, a framework that supports efficient and scalable evaluation of SPARQL and graph analytics, while enabling expressing queries in an easy and natural manner. SPARTex capitalizes on two key design principles:
A unified framework. SPARTex is based on the vertex-centric computation model; hence, it inherits the scalability and abstraction of vertex-centric systems. SPARTex can be implemented on top of any system that supports computation at the vertex granularity and exchanging messages between vertices. We propose an efficient and scalable SPARQL operator on top of SPARTex. Since different operators in SPARTex require different data access views, SPARTex has a unified in-memory data store that provides different views of the same data. For example, while PageRank needs to access all outgoing edges of a vertex, SPARQL queries usually select only edges that match a specific pattern. Consequently, SPARTex supports both vertex-centric graph analytics and efficient and scalable SPARQL query evaluation.
SPARQL and User Defined Procedures. To mitigate SPARQL limitations, we propose a SPARQL extension that allows the invocation of user defined vertex-centric programs from SPARQL; such programs are modeled as defined stored procedure in SPARTex. The data store allows graph algorithms to dynamically maintain their computation results in-memory as vertex attributes. Accordingly, the output of such programs can be supplied as input for SPARQL and vice-versa in a pipelined fashion.
SPARTex introduces a new and rich type of RDF analytics that were not feasible before. (i) SPARQL can be used for triggering and querying generic graph algorithms. For example, a user can declaratively run PageRank and return the top-k rank values. (ii) Original RDF data and vertex-computed results can be combined...
as a subgraph pattern in SPARQL. In other words, triple patterns of SPARQL queries can be RDF data or vertex-computed derived data. (iii) Generic graph algorithms and SPARQL query patterns can be pipelined so the output of one operator is the input to another. For example, the Single Source Shortest Path (SSSP) algorithm can start from the vertices that match a specific SPARQL pattern.
2. RDF ANALYTICS FRAMEWORK
RDF data is a set of \((\text{subject}, \text{predicate}, \text{object})\) triples that form a directed labeled graph. SPARQL is the standard query language for RDF. Queries consist of a set of RDF triple patterns, where some of the columns are variables. For example, \(Q_4\) in Figure 1(a) retrieves all students who take courses taught by their advisors. The query corresponds to the graph in Figure 1(b). The answer is the set of bindings of \(?s, ?c, ?p\) that render the query graph isomorphic to subgraphs in the data. SPARQL is restricted to pattern-matching and does not support advanced graph analytics (such as shortest path search, PageRank and centrality computations). Accordingly, current RDF data management systems are not optimized for graph analytics beyond SPARQL.
2.1 SPARQL Extension
In SPARTex, we introduce a SPARQL extension that allows the invocation of user defined stored procedures. Assume that a user is capable of writing and storing his own procedures in a given system; e.g., Pregel programs. For a procedure called \(\text{proc}\) which is located at \(\text{path}\), the user can call \(\text{proc}\) in SPARTex as:
\[
\text{PREFIX prefix: path}
\text{CALL prefix:proc(list[parms]) AS list[properties]}
\]
\(list[\text{parms}]\) is a list of parameters that the procedure expects while \(list[\text{properties}]\) is the list of vertex properties that \(\text{proc}\) will add to the RDF data. For example, the PageRank algorithm expects the maximum number of computation iterations and introduces a \(\text{pRank}\) property per vertex. PageRank can be invoked as follows:
\[
\text{PREFIX algo : <file://path_to_algorithms>}
\text{PREFIX sptx: <http://www.spartex.com/analytics/>}
\text{CALL algo:PageRank(max_iter) AS sptx:pRank}
\]
PageRank in the previous example runs on the entire RDF graph. However, we may want to apply them to only a subset of the graph. For this, we introduce constructs that filter the RDF graph based on vertices and edges. Invoked procedures are optionally associated with one or more filters.
\[
\text{FILTER_VERTEX AS filter\_name WHERE \{ BGP \}}
\text{FILTER\_EDGE AS filter\_name WHERE \{ BGP \}}
\]
All triple patterns of the basic graph pattern BGP in the WHERE clause must have a common vertex. In other words, BGP is a star query around a specific vertex. For \(\text{FILTER\_VERTEX}\), vertices that do not match BGP are filtered out. Similarly, all edges that do not satisfy the BGP pattern of \(\text{FILTER\_EDGE}\) are filtered out. For example, we can exclude objects of triples with RDF :: type predicates from the PageRank algorithm as follows:
\[
\text{PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>}
\text{FILTER\_EDGE AS no_type WHERE \{}
\text{?s \text{teaches} ?c .}
\text{?s \text{takes} ?c .}
\text{?s \text{advisor} ?p .}
\text{FILTER(! sameterm(?p, rdf::type))}
\}
\text{CALL algo:PageRank(max_iter) USING no_type AS sptx:pRank}
\]
So far, we have seen vertex properties set or deleted by stored procedures. However, users may want to deliberately set or delete some vertex properties. Therefore, we introduce two constructs for adding and deleting vertex properties.
\[
\text{ADD PROPERTY \{list[property patterns]\} WHERE \{BGP\}}
\text{DROP PROPERTY \{list[property patterns]\} WHERE \{BGP\}}
\]
BGP in the optional WHERE clause can be an arbitrary pattern; e.g., the following drops \(\text{pRank}\) properties smaller than a threshold:
\[
\text{DROP PROPERTY \{?x sptx:pRank ?val\} WHERE\{}
\text{?x sptx:pRank ?rank .}
\text{FILTER(?rank < threshold)}
\}
\]
2.2 Use Cases
Combining the expressiveness of SPARQL with generic graph computations opens opportunities for deeper RDF data analysis. We now discuss use cases that are not feasible without this extension.
2.2.1 Combining SPARQL and graph properties
Consider \(Q_4\) in Figure 1 and assume we want to filter students based on whether their advisors are popular and teach core courses. Assume that PageRank and centrality properties are used to measure popularity of professors and importance of courses, respectively. If both PageRank and centrality algorithms are available as user-defined stored procedures, \(Q_4\) can be rewritten as:
\[
\text{PREFIX sptx: <http://www.spartex.com/analytics/>}
\text{CALL algo:centrality() AS sptx:centrality}
\text{CALL algo:PageRank(max_iter) AS sptx:pRank}
\text{SELECT ?s WHERE \{}
\text{?p \text{teaches} ?c .}
\text{?s \text{takes} ?c .}
\text{?s \text{advisor} ?p .}
\text{?p sptx:pRank ?rank .}
\text{?c sptx:centrality ?cent .}
\text{FILTER (?rank > val1 && ?cent > val2)}
\}
\]
Note that the query has two types of triple patterns; the first one comes from the structure of the input graph, while the second is derived from the vertex-computed values. Without the proposed extension, such a query would not be easy to express.
2.2.2 Combining SPARQL and analytics
We now demonstrate a use case where the results of SPARQL are used in graph analytics. Consider \(Q_3\) in the previous example and suppose we want to find the shortest path between popular professors that match the pattern and every other vertex in the graph. This can be done by executing the Single Source Shortest Path (SSSP) algorithm starting from these professors as follows:
\[
\text{PREFIX sptx: <http://www.spartex.com/analytics/>}
\text{CALL algo:centrality() AS sptx:centrality}
\text{CALL algo:PageRank(max_iter) AS sptx:pRank}
\text{ADD PROPERTY \{?p sptx:popular "1" . \} WHERE \{}
\text{?p \text{teaches} ?c .}
\text{?s \text{takes} ?c .}
\text{?s \text{advisor} ?p .}
\text{?p sptx:pRank ?rank .}
\text{?c sptx:centrality ?cent .}
\text{FILTER (?rank > val1 && ?cent > val2)}
\}
\]
2.3 SPARTeX Architecture
SPARTeX is an RDF analytics framework that supports declarative SPARQL queries as well as procedural graph algorithms, based on the discussed SPARQL extension. SPARTeX can call user-defined stored procedures written as vertex-centric programs. These procedures can be executed in a pipelined fashion and can dynamically maintain their computation results in memory as vertex attributes. Subsequent operators can use these results if needed. An overview of SPARTeX is depicted in Figure 2. In the rest of this section, we detail each of the different components of our framework.
2.3.1 Vertex-centric Framework
Vertex-centric computation frameworks are built on top of distributed file systems for data persistence, such as the input graph, check-pointing files, and computation outputs. The user defines a set of properties that defines a set of possible vertex labels and edges in the set of possible edge labels while the set of unique predicate labels.
Using the ADD PROPERTY construct, we identify the popular property as 1. Then, we create a vertex filter to exclude all vertices without this property. Finally, the filter is associated with the SSSP procedure call so it only starts from vertices defined in the filter.
2.3.2 Unified In-Memory Data Store
SPARTeX stores \( G = (V, E, F_E, L_E, F_V, L_V, \Psi) \). A directed, labeled and vertex-attributed graph. \( V \) and \( E \) are the set of vertices and edges in \( G \), respectively. \( e(u, v) \in E \) denotes a directed edge from \( u \) to \( v \). \( L_E \) is the set of possible edge labels while \( F_E : E \rightarrow L_E \) is a labeling function that assigns a label to each edge. \( L_V \) is the set of possible vertex labels and \( F_V : V \rightarrow L_V \) assigns a unique label for each vertex. \( \Psi \) defines a set of properties that can be associated to a vertex. Each vertex \( v \in V \) is associated with a set of \( m \) properties \( (p_1(v), p_2(v), ..., p_m(v)) \) such that \( p_i(v) \) denotes the value of the property \( p_i \) for \( v \).
Our graph model is generic and can be easily adopted for RDF data. We use the labels of subjects, predicates, and objects as their unique identifiers. Therefore, \( V \) is the set of subjects and objects, while \( E \) is the set of edges defined by the input triples. \( L_E \) is the set of unique predicate labels. \( \Psi \) is initially empty; however, during execution a vertex can be given one or more properties.
2.3.3 SPARQL Operator
The SPARQL operator evaluates RDF rich data analysis tasks. The parser is responsible for preprocessing incoming queries. It segregates the analytics constructs from the pattern matching of SPARQL. The subgraph pattern is then converted into a graph representation. Afterwards, both the analytics constructs and the pattern graph are passed to the query planner. The query planner checks the existence of the called procedures and the consistency of their parameters. Then, it sends the pattern graph to the query optimizer to compile the query execution plan. The query optimizer utilizes global statistics maintained in the statistics manager. The planner consolidates the generic analytics part and the optimized pattern matching query plan into a global pipelined execution plan. Finally, the plan is evaluated by the pipelined executor.
3. DEMONSTRATION
We implemented SPARTeX on top of GPS [11], an open-source Pregel clone. SPARTeX is deployed on a cluster of 12 machines each with 148GB RAM and two 2.1GHz AMD Opteron 6172 CPUs. The machines run 64-bit 3.2.0-38 Linux Kernel and connected by a 10Gbps Ethernet switch. We plan to conduct the demonstration with remote access to this cluster which will be accessible from the conference site. As the amount of data communicated between the GUI and the cluster is minimal (queries and final results), we are not expecting significant delays during the demonstration. Using the synthetic LUBM\(^3\) benchmark, we have generated LUBM-4000 dataset which contains 534 million triples. Besides, we also used YAGO\(^2\), a real dataset consisting of 295 million triples.
3.1 Audience Interaction
Figure 3 shows the GUI interface of SPARTeX. Using the GUI, we offer two different interaction scenarios:
**SPARQL Query Evaluation:** Participants can select a dataset against which they can execute either manually written SPARQL
\(^2\)http://swat.cse.lehigh.edu/projects/lubm/
\(^3\)www.mpi-inf.mpg.de/yago/
queries or choose one from the predefined benchmark queries. Pre-defined queries for YAGO2 dataset are those defined in [7] whereas LUBM queries are the same queries used in [2]. The predefined queries provide a mixture of queries with varying structural characteristics and selectivity classes. Once the query and the dataset are specified, SPARTeX evaluates the query and displays the results as well as the total query response time.
**RDF Graph Analytics:** Participants can run vertex-centric graph algorithms on a dataset of their choice. We provide a wide range of graph algorithms from which participants can choose. In particular, the following algorithms are available: PageRank, Degree Centrality, SSSP, Peer-Pressure clustering and Graph Diffusion.
Using the set of supported algorithms and our extension, participants are allowed to run different algorithms on the dataset they choose. Moreover, they can pipeline SPARQL queries and graph analytics as needed. For example, on YAGO2 dataset, participant can evaluate many possible use cases, like: (i) using our filtering construct, a participant can define a filter that limit PageRank evaluation to only vertices that have the property hasPage. (ii) Write a SPARQL query that retrieves the vertices with the highest PageRank values. (iii) Cluster the entire YAGO2 graph and retrieve the clusters information. (iv) Managing (add/delete) vertex properties. (v) Run SSSP from vertices that belong to certain cluster or has certain property value. All these use cases are defined and participants can visualize their query syntax and modify it if needed. Moreover, they can also define and evaluate other use cases.
### 3.2 Evaluation Results
We evaluate the two use cases described in Section 2.2 using SPARTeX and LUBM-4000 dataset. Since no other system can fully support these use cases, we use combinations of SPARQL engines and analytics systems. We use H2RDF+ [7] as SPARQL engine with two different analytics systems. The first combination is H2RDF+ with PEGASUS [3], a graph mining library on top of MapReduce. The second combination uses H2RDF+ with GPS [11]. In both cases, data need to be moved between multiple systems and formatted accordingly. Figure 4 shows the execution time for both use cases. In the first case, graph analytics is performed prior to query evaluation. SPARTeX performs better than H2RDF+GPS because it maintains the computation results in its in-memory store. Therefore, no data formatting or re-indexing is required. GPS on the other hand needs to output the results to HDFS for further processing in H2RDF+. PEGASUS, performs worse than GPS confirming that MapReduce approaches do not perform well for graph analytics. Both H2RDF+PEGASUS and H2RDF+GPS require data formatting and re-indexing by H2RDF+ before evaluating SPARQL queries. The cost of data formatting and indexing is very substantial accounting for more than 80% of the processing time. Finally, when evaluating SPARQL queries, SPARTeX performs significantly better than H2RDF+. The same applies on the second use case; however, since the SSSP algorithm is not available in PEGASUS, we only compare to H2RDF+GPS.
### 4. REFERENCES
---
**Figure 3: SPARTeX Graphical Interface**
**Figure 4: Rich RDF Analytics.**
|
{"Source-Url": "https://repository.kaust.edu.sa/server/api/core/bitstreams/2383db2b-8302-4769-8920-5b2c070b08d5/content", "len_cl100k_base": 4918, "olmocr-version": "0.1.53", "pdf-total-pages": 5, "total-fallback-pages": 0, "total-input-tokens": 16540, "total-output-tokens": 5960, "length": "2e12", "weborganizer": {"__label__adult": 0.0003724098205566406, "__label__art_design": 0.0003783702850341797, "__label__crime_law": 0.0005068778991699219, "__label__education_jobs": 0.0017185211181640625, "__label__entertainment": 0.00014913082122802734, "__label__fashion_beauty": 0.00021660327911376953, "__label__finance_business": 0.00055694580078125, "__label__food_dining": 0.0003986358642578125, "__label__games": 0.0006747245788574219, "__label__hardware": 0.0010986328125, "__label__health": 0.0007905960083007812, "__label__history": 0.00042629241943359375, "__label__home_hobbies": 0.0001207590103149414, "__label__industrial": 0.0006122589111328125, "__label__literature": 0.00046944618225097656, "__label__politics": 0.0003895759582519531, "__label__religion": 0.0005121231079101562, "__label__science_tech": 0.22216796875, "__label__social_life": 0.00019240379333496096, "__label__software": 0.04400634765625, "__label__software_dev": 0.72314453125, "__label__sports_fitness": 0.00034117698669433594, "__label__transportation": 0.0006189346313476562, "__label__travel": 0.00027632713317871094}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22085, 0.02492]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22085, 0.53205]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22085, 0.83888]], "google_gemma-3-12b-it_contains_pii": [[0, 857, false], [857, 6358, null], [6358, 12474, null], [12474, 16956, null], [16956, 22085, null]], "google_gemma-3-12b-it_is_public_document": [[0, 857, true], [857, 6358, null], [6358, 12474, null], [12474, 16956, null], [16956, 22085, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 22085, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22085, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22085, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22085, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 22085, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22085, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22085, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22085, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22085, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22085, null]], "pdf_page_numbers": [[0, 857, 1], [857, 6358, 2], [6358, 12474, 3], [12474, 16956, 4], [16956, 22085, 5]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22085, 0.08511]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
f2650b194168d6264a4cd81bd700c3891f65bc45
|
Web Technologies and Transitions to Web 3.0
Adrian Ghencea
*Specialist IT, Bucharest, Romania, e-mail: aghencea@yahoo.com
ARTICLE INFO
Article history:
Received: September 29, 2015
Received in revised form: October 8, 2015
Accepted: October 10, 2015
Available online: October 20, 2015
KEYWORDS: web services, web technologies, Web 3.0 transition
ABSTRACT
The information system shall represent the support of the put on and of the simplification of rules and administrative procedures in order to ensure a broad and non-discriminatory public access to public services and also to reduce tariffs for these services, along with the operating costs and the personnel costs.
IT&C market and the major brands have come up with new solutions and new architectures: SOA (Services Oriented Architecture), S+S or SaS (Software as Services) complex architectures, modulation, business solutions designed to streamline information and its flow, to privilege the citizen access to services, signifying furthermore a careful spending of public money lead to a double vertical and horizontal integration of all services, transactions and applications.
Introduction
The governance, whichever the level and the enforcement of institutions, it is the most important investor and in the same time a user of information technology. The public administration is certainly crossing trough an important transformation process in the medium and long time term and its availableness in terms of implementation of modern information technologies is the key to this transformation. Since the strategies and public policies define the role of the citizen as an active participant in governance and not only as a simple user, the public administration will have to learn to reorganize their held information for facilitating the transparency and democratic process of the making decision, for the consensus building and for the dialogue and deliberation. The most significant difference which proves the development based on components is that none of the individual components are made in accordance with other component that follows up their integrating services. Each component is grownup in accordance with a general profile so it can be integrated in different contexts and addressed to a larger market segment. Therefore the generality of the components is an efficient action because it allows software manufacturers to cover a wider market and in the same time allows to the buyers the possibility to add features without initial experience. But this is also an issue as these components have not been created having as purpose "the integration".
Taking in consideration all the above, one of the current objectives of public administration is the integration of implemented applications in order to increase their efficiency and the performance of the whole unit. The compatibility is a major issue raised by these component-based systems design. By compatibility, we understand the ability of two entities to interact and this interaction should have a semantically meaning. For the traditional software development any subordinated way newly created is strongly customized according to requirements of the module super ordinate. This module super ordinate incorporates and uses
the subordinated service. Therefore, all modules are compatible accordingly with its own specifications and with parent module specifications. Computer technologies meet these challenges offering various solutions, flexible and efficient solutions Web-based, which provide access to information anywhere and anytime in a secure environment. On the administration level, web services are a valid alternative for consistent developing.
**Web services**
The ability to switch data is an essential element for success. In the same time at the level of one organization, we find implemented various solutions for solving specific problems and for stoking and making data's switch and therefore the communication are not an easy one between them. Web services have evolved as a practical solution, efficiency in terms of cost, which provides the fusion of that information coming from several applications, exceeding these barriers created by the use of the operating systems, platforms and different languages.
A web service provides a defined set of features to achieve an objective. If in the past a client could use only an application which was installed on a local machine, today you can access an application from any computer, from anywhere in the world by using different development platforms such as C++, Web, Java or Borland Delphi and web standards such as Hyper Text Transfer Protocol (HTTP), Extensible Markup Language (XML), Web Services Description Language (WSDL) and Simple Object Access Protocol (SOAP).
The web services objective is to provide any kind of application to a client no matter what is the platform developed or the architecture implemented, having in view to create an environment where every customer, regardless the device used, desktop or mobile, has the ability to identify a service network and use it as a local service.
Web services are widely used, to facilitate interoperability between different hardware and software solutions, between different computer architectures and application programming interfaces (API). Such interoperability provides immediate benefits that enable faster integration and lower costs of existing services.
Besides, it was mentioned statements for the development of applications by combining multiple services into a single workflow. With this functionality, the applications will be easier to adjust because the services would be added or removed from that stream. Moreover, interoperability will allow application developers to replace a service with another one when technical or business reasons will require this. This development perspective regarding SOA (Service-Oriented Architecture) becomes reality through standardization and technology development concerning web services.
The service-oriented architectures implemented with web services have fundamentally changed the business processes supported by those distributed processing. These technologies bring to the forefront the prospect of services available anytime, anywhere and on any platform. Through web services operators can provide for their users high added-value services, explore new business opportunities, increase their income and may increase the degree of customer retention. There by expanding business opportunities for developers allowing to promote their applications and develop solutions that work in different environments and platforms.
In the present, the intense use of infrastructures and mobile technologies is another trend that facilitates communication and information access from any location at any time. Convergence of mobile technologies and Web services, support the emergence of new business service models and accelerates the development of fixed and mobile internet technologies. Mobile technologies benefit from the advantages of interoperability offered by web services. Interoperable messaging structures lead to reducing time and integration costs, creating premises for the embracement of Web services and opening new opportunities for development.
The growing background of informatics systems brings together various notions and elements. Between them, the code is right the final language for expressing requirements. Languages can approach to the requirements, the tools can help you parse and assemble
these requirements in formal structures but is always necessary the accuracy and therefore will always need the code.
The use of information systems has contributed considerably to streamline business processes. Yet over time, organizations were forced to use more solutions for complete business automation and this resulted in the emergence of limitations or blockages caused by incompatibilities and lack of integration of the solutions used. This applications developed in different technologies has become a standard communication need to be independent of platforms and systems used until then.
Over the years, there have been several attempts, most of which were representative:
- DCOM - Distributed Component Object Model provided by Microsoft
- RMI - Remote Method Invocation provided by the Sun
- CORBA - Common Object Request Broker Architecture provided by OMG
- In this context was necessary to define and impose an open standard that does not belong to anyone and with the following main features:
- The independence of architecture, operating systems, databases and hardware such as PC, large machines or mobile devices
- Which can be used in every domain from simple solutions (P2P - Peer to Peer) to systems EAI (Enterprise Application Integration) and even systems B2B (Business to Business)
- To allow communication between applications running on low speed connections
- To be modular
- Possible solutions listed above do not meet fully the characteristics. In this way has developed the web services (WS) standard. A web service is based on SOAP, WSDL and UDDI. To be able to use these services we need first a method by which to describe and organize data. This method is given by XML.
**Extensible Markup Language (XML)**
To have an electronic communication it should be used a standard through it the information can be transmitted or received, plus it should be understood by both parties and systems involved in communication. This need has led to the definition of SGML (Standard Generalized Markup Language). This standard is based on so-called markers, used to delimit the beginning and end information. SGML standard was used for a long time (more than 15 years) by large firms in very specific applications. Along with the development of web technologies is required the use of a similar standard, but to be more accessible and also to preserve its original standard in describing fully the information contained. This is the definition of XML as a derived standard from SGML as it is not belonging to any company and it is an open standard used on any platform and for any type of data transmission, preferable to implement web services.
XML - Extensible Markup Language, is a specification of World Wide Web Consortium (W3C) defining a meta-language for describing data. XML provides the technological basis for Web services technologies. Choosing XML for a project enables a large number of applications and access to a community of experienced engineers. XML enables structured data such as spreadsheets, contact lists, configuration parameters, financial transactions or technical drawings. XML is a set of rules to create text formats that allows data structure. XML makes it easy for a computer to generate and read data, and ensure that the data structure is correct. XML avoids common pitfalls in language design: it is extensible, platform-independent and supports internationalization and localization. XML is fully compatible with Unicode character set.
Like HTML, XML uses tags (words between '<' and '>') and attributes (with form "name="value"). While HTML specifies what each tag and attribute means and often, how they will appear the text marked with these in the browser, XML uses tags only to delimit the data segment, leaving the interpretation of these data into the application that read them.
Programs that produce spreadsheets, contact lists and other structured data often keep the data on the hard, using a binary or text format. An advantage of text format is that it allows the user to view the file if it is necessary, to view the file without using the program that
produced it the data can be read with other text editors. Also text format makes errors debug easier for developers. Like HTML, XML files are files that users are not forced to read them, but may do so if it is necessary. Compared with HTML, XML rules allow fewer variations. A forgotten tag or an attribute without quotes makes an XML file unusable, while in HTML is permitted. XML specification forbids to an application to try appreciating what the creator wanted to make wrong, to a XML file. If an error occurs, the application must stop reading and report an error.
Because XML is a text format and uses tags to delimit data, XML files are almost always higher than binary formats. XML designers have taken this decision for some objective reasons. Text format advantages are obvious and disadvantages can usually be replaced to a new level. Disk space is cheaper than it was in the past. Compression programs can compress the files very well and very quickly. In addition, communication protocols like HTTP/1.1, basic protocol of the web, can compress data under way saving bandwidth as well as binary format.
XML 1.0 is the specification that defines what tags and attributes are. Beyond XML 1.0 is "XML family" is a set of modules (growing) that provides useful services to meet important task and commonly used. XLink describes in a standard way the addition of hyperlinks in an XML file. XPointer is syntax in development, used to identify parts of an XML document. An XPointer is similar to a URL, but instead to indicate a Web document, this indicates a part of an XML file. CSS, Style Sheet language can be used with XML as is used with HTML. XSL is advanced language Style Sheet being based on XSLT, a transformation language used to rearrange, add or delete tags and attributes. DOM is a standard set of functions for manipulating XML (and HTML) in a programming language. XML Schemes 1 and 2 help developers to precisely define the structure of XML files in the format they created. Other modules and utilities are still in development.
XHTML the follower of HTML is an important application XML, with the form of a document. XHTML has many of the HTML elements. The syntax was partially changed to meet XML rules. A format based on XML inherits XML syntax and a constraint in many ways (for example, XHTML allows to use "<p>", but not "<r>"); also adds understood to syntax (XHTML said that "<p>" is "paragraph", and not "price", "person" or something else).
XML lets you define a new document format, by combining and reusing other document forms. Because the two formats can use elements or attributes with the same name, to eliminate confusion, XML has a mechanism called namespace (domain for names). XSL and RDF are examples of formats based on XML using namespaces. XML schema is designed with this support for modularization. This modularity in the definition of an XML document makes possible to combine two schemes to form a third, which defines a combined document.
**Resource Description Framework (RDF)**
Resource Description Framework (RDF), defined of W3C, is a XML text format that supports resource description and metadata applications such as camera or photo collections. For example, RDF can allow people identification in a photo album (for web) using information from a contact list; then mail client could automatically send an email to these people, alerting them that their photos are on the web (on-line). Such as HTML integrated documents, images, menu systems and forms, RDF are a tool that allows a deeper integration to transform the Web to becoming a semantic web.
Just as people need a convention to determine the meanings of words also and computers need the same thing to communicate efficient. Formal descriptions of a certain category (for example purchase or production) are called ontology and are a necessary part of the Semantic Web. RDF, ontology and representation enable computers to help people work; these are a part of the Semantic Web Activity.
Web Services Description Language (WSDL)
WSDL is an interface that describes in detail the functions that provide a web service. In other words, the WSDL is a description of functions that are provided by SOAP servers starting from the indicated UDDI.
WSDL can be seen as an XML document that describes the routines used in applications, describes the web server location, data form that are received from the communication routines and used parameters. Using a WSDL document can automatically generate classes to access web service. In this way the programmer is relieved from the duty to write these classes manually. A WSDL file is an XML document that describes a Web service using the six main elements:
- Port type - groups and describes operations that are performed by service;
- The port - specify an address for a combination, for example defines a communication port;
- The message - describing the names and formats supported by service;
- Types - defines data types (such as were defined in XML schema) used by the service for sending messages between client and server;
- The joint - defines the communication protocols supported by the operations that provide services;
- The service - specific URL address to access the service.
WSDL document describing a Web service acts as a contract between client and server web service. By adhering to this contract, the service provider and consumer can exchange data in a standardized way regardless of application and platform that operates.
Simple Object Access Protocol (SOAP)
To use a web service is necessary to use a way of data "packing" organized in the form of XML's, to facilitate reading and interpretation by the web server. In this way appeared SOAP (Simple Object Access Protocol) standard that can be viewed as an envelope, containing information. The media does not change from XML, and binary format is unconverted. Are avoided past issues of inconsistency between different operating systems and platforms used.
SOAP is an XML-based protocol defined by the W3C for exchanging data over HTTP, being a simple and standardized method for sending XML messages between applications. Web services use SOAP to send messages between a service and its client/clients. Because all browsers and Web services support HTTP, SOAP messages can be transmitted between applications regardless of platform or programming language. This quality provides web services their interoperability feature. SOAP messages are XML documents that contain some or all of the following:
- The envelope - which specifies that the XML document is a SOAP message that contains the message itself;
- Header (optional) - contains relevant information related message, such as the date on which the message was sent on authentication, etc.
- Content - including message;
- Error - carries information about an error occurred on the server or client level in a SOAP message.
Dates are sent between the client (clients) and Web service using SOAP messages of request and response type, whose format is specified in the WSDL definition. Because both the client and server adhere to the WSDL contract when SOAP messages are created, guaranteeing that the messages are consistent. SOAP protocol is being continuously improved and standardized in order to achieve more effective interoperability.
Universal Description Discovery and Integration (UDDI)
UDDI (Universal Description Discovery and Integration) makes publication easy to search and locate available Web services to be called, is a standard sponsored by OASIS (Organization for the Advancement of Structured Information Standard). Often described as the Yellow Pages of Web services, UDDI is a specification for creating an XML-based registry, presenting information about organizations and web services they offer. UDDI provides organizations a uniform way by which they can present their services and discover services offered by other organizations. Although implementations can vary, usually UDDI describes services using WSDL and communicate via SOAP messages.
UDDI can be a private service within an organization or function as a public service on the Internet. Registering a Web service in UDDI registry is an optional step. To search a web service, a developer can query the UDDI registry to obtain the WSDL for the service that wants to use. Developers can also design their Web services so that customers receive automatic updates on any changes of a service in a UDDI registry.
Service-Oriented Architecture (SOA)
SOA (Service Oriented Architecture - software architecture based on services) is a type of software architecture that involves distributing application functionality into smaller, distinct units - called service - that can be distributed in a network and can be used together to create applications for business. The large capacity of these services that can be reused in different applications is a feature of service-based software architectures. These services communicate with each other by sending information from one service to another. SOA is often seen as a solution to distributed programming and modular programming.
SOA is a flexible, standardized architecture that contribute to better connect the various applications and facilitates the exchange of information between them. SOA unifies business processes by structuring large applications in a collection of small modules called services. These applications can be used by different groups of people both within and outside their company. Typically are implemented functionality that most people would know that service such as for example: completing an application online for an account, view a form or a bank account statement online or make an order of an air ticket online. Main factors that ensure the SOA projects success are evaluating technology options, design, development, delivery and administration. In addition, the need to clearly understand the service-oriented processing must be complemented by understanding their own development environments, the constraints and strategic objectives, to determine the optimal platform to achieve these objectives.
Web services benefits
Between the main benefits, that Web services make available we find:
- integration of data and applications;
- versatility;
- code reuse
- reduce costs
Web services provide the interoperability premises that involve the use of XML technologies that are independent of the developer, platform or programming language and HTTP as a means of transport by which any application can communicate with another. To exchange data with a service, the client requests only the WSDL definition and no need for either party to know how the other is implemented or in what format information is stored. These advantages allow organizations to easily integrate applications and different data formats. Web services are versatile by design. Can be accessed by users via a web-based client interface or can be accessed by other applications or Web services. A client can even combine data from multiple Web services, for example to provide the user an application that updates collections or ERP systems using a single interface-even if the systems are incompatible. Because systems exchange information using Web services, a change in the revenues for example, will not affect the web service. The ability to reuse the code is another positive
aspect of web services flexibility and interoperability. The service can be used by many clients that engage operations provided to achieve different objectives. Instead of creating a custom service for each query unique, parts of service are simply reused, if necessary. All these benefits translate into significant cost savings. Facilitate interoperability means eliminating the need to create custom applications that involve high costs for data integration. Investments made in infrastructure development and systems can be easily used and combined to achieve a high added value. The benefit of using web services is that these represent an independent standard of platform and the programming environment used, and for the programming languages with included support, these automatically occupy themselves of packing/unpacking SOAP messages and the transfer of parameters/results. Thus, the programmer can use the time to focus on the including method function and not on the sending and receiving data.
eGovernment and transition to Web 3.0
The European commission has emphasize which are the main steps that Europe needs to do for responding to the next wave of information revolution, which will intensify in the next years, because of some trends like social networking, the decisive orientation to online services, providing services based on GPS and mobile TV, as well as the fast evolution of using smart tickets.
The Europe lies in a position that allows it to exploit these trends as a result of its politics that support the telecommunication networks opened and oriented to competition, as well as the security and protecting personal information. In the commission reports come up a new broadband performance index which compare the performance from a national level as regards of key elements like connection speed, price, competition, and the coverage area. The internet of the future will radically change the society where we live. The Web 3.0 concept signify availability anytime and anywhere for the business and social environment, using the secured and fast networks. Means the end of differentiation between fixed and mobile lines. Webs 3.0 announce a significant increase in using digital technologies until 2016. The Europe owns the know-how and the capacity at the network level to accomplish this transformation. The users from Europe have access to the improved and much faster internet services: much more than a half of them had access to the broadband internet over 2 Mbps, at the end of year 2007, a speed which is two times bigger than a year ago and which support television over the Internet. The broadband connections cover 70 % of rural population amongst those 27 member states, total coverage reaching 93 %. In the last year the coverage of the broadband connections, in rural environment, in 25 member states, has increased by 8 %, prospects of increasing have maintaining for the current period. This opens the way for a new generation of Internet, and the potential for the European economy is clearly. While a quarter of Europeans have used 2.0 websites in 2007, the business applications for social networking will rapidly evolve. It is also stipulate an worldwide increasing with 15% during 2006-2011, of a business web-based software.
Small applications will need total internet coverage. The concept Internet of things represents a wireless interaction based on the Internet between machines, vehicles, sensors and other objects. The evolution of mobile devices allows the exchange of information or pay online by accessing the internet. It is estimated that by 2015 over a billion mobile devices will support such capabilities.
This context opens up new opportunities for business sector with condition of maintaining the high level of investment in expanding access areas to the high-speed connections and sustaining the work and research. In the announcements of European commission it is specified that the union.
Conclusions
Communication between processes is the key element of distributed systems. This is based on sending messages to a lower level provided by the network. The expression of communication through messaging is more difficult than using primitives based on shared memory available on undistributed platforms.
Modern distributed systems often consist of thousands or even millions of processes spread across a network in which communication is not secure, an example being the internet. Development of applications on a wide coverage area is extremely difficult if the facilities of communication primitive’s computer networks are not replaced with something else.
References
|
{"Source-Url": "http://www.scientificeducation.org/image/data/pdf/post/journal/volume-2/issues-5/SE-JBEIT-14030-Ghencea-Adrian-Web-Technologies-and-Transitions-to-Web-3.0.pdf", "len_cl100k_base": 5129, "olmocr-version": "0.1.50", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 19944, "total-output-tokens": 5782, "length": "2e12", "weborganizer": {"__label__adult": 0.0002620220184326172, "__label__art_design": 0.0004978179931640625, "__label__crime_law": 0.0003826618194580078, "__label__education_jobs": 0.0004448890686035156, "__label__entertainment": 0.00011873245239257812, "__label__fashion_beauty": 0.00012433528900146484, "__label__finance_business": 0.0008478164672851562, "__label__food_dining": 0.0003352165222167969, "__label__games": 0.000377655029296875, "__label__hardware": 0.0013895034790039062, "__label__health": 0.00036263465881347656, "__label__history": 0.00037479400634765625, "__label__home_hobbies": 6.121397018432617e-05, "__label__industrial": 0.0004167556762695313, "__label__literature": 0.0003097057342529297, "__label__politics": 0.0004227161407470703, "__label__religion": 0.00036835670471191406, "__label__science_tech": 0.079833984375, "__label__social_life": 7.396936416625977e-05, "__label__software": 0.04693603515625, "__label__software_dev": 0.865234375, "__label__sports_fitness": 0.00017726421356201172, "__label__transportation": 0.0005536079406738281, "__label__travel": 0.0002601146697998047}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28660, 0.01306]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28660, 0.49716]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28660, 0.92839]], "google_gemma-3-12b-it_contains_pii": [[0, 3272, false], [3272, 7562, null], [7562, 11708, null], [11708, 15724, null], [15724, 19061, null], [19061, 23144, null], [23144, 27434, null], [27434, 28660, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3272, true], [3272, 7562, null], [7562, 11708, null], [11708, 15724, null], [15724, 19061, null], [19061, 23144, null], [23144, 27434, null], [27434, 28660, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28660, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28660, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28660, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28660, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28660, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28660, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28660, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28660, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28660, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28660, null]], "pdf_page_numbers": [[0, 3272, 1], [3272, 7562, 2], [7562, 11708, 3], [11708, 15724, 4], [15724, 19061, 5], [19061, 23144, 6], [23144, 27434, 7], [27434, 28660, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28660, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-29
|
2024-11-29
|
4f3a862e31a652fa74cb6e542bc49ba0c3850988
|
Answer Set Programming*
Answer set programming (ASP) is a form of declarative programming oriented towards difficult combinatorial search problems. It has been applied, for instance, to plan generation and product configuration problems in artificial intelligence and to graph-theoretic problems arising in VLSI design and in historical linguistics.
Syntactically, ASP programs look like Prolog programs, but the computational mechanisms used in ASP are different: they are based on the ideas that have led to the development of fast satisfiability solvers for propositional logic.
Answer set programming has emerged from interaction between two lines of research — on the semantics of negation in logic programming [Gelfond and Lifschitz, 1988] and on applications of satisfiability solvers to search problems [Kautz and Selman, 1992]. It was identified as a new programming paradigm in [Lifschitz, 1999; Marek and Truszczynski, 1999; Niemelä, 1999].
Computing Answer Sets with LPARSE and SMODELS
In this section we discuss the use of the answer set solver created by Ilkka Niemelä’s group at the Helsinki University of Technology. The system consists of two programs, LPARSE and SMODELS; the former is a preprocessor. It can be downloaded from its web site,
The syntax of the input language of LPARSE is more limited in some ways than the class of programs defined in the previous lecture notes (“Answer Sets”), but it includes many useful special cases. In the input language of LPARSE, the head of a rule can be
- an atom,
- empty (that is, ⊥),
- an expression of one of the forms
\[ \{F_1, \ldots, F_n\}^c \]
\[ l \leq \{F_1, \ldots, F_n\}^c \]
\[ \{F_1, \ldots, F_n\}^c \leq u \]
\[ l \leq \{F_1, \ldots, F_n\}^c \leq u \]
*Some parts of this note are taken from the survey “Introduction to Answer Set Programming” by Vladimir Lifschitz.
provided that the formulas $F_i$ are atoms.
In the last case, the superscript $^c$ and the sign $\leq$ are dropped. For instance,
$$1\{p, q\}$$
in the head of a rule stands for
$$1 \leq \{p, q\}^c.$$ \hspace{1cm} (2)
The body can be a conjunction (possibly empty) of
- atoms possibly preceded with $not$,
- expressions of the forms
$$l \leq \{F_1, \ldots, F_n\}$$
$$\{F_1, \ldots, F_n\} \leq u$$
$$l \leq \{F_1, \ldots, F_n\} \leq u$$
provided that each $F_i$ is an atom possibly preceded with $not$.
In the last case, the sign $\leq$ is dropped. For instance, expression (1), when it occurs in a body of an LPARSE rule, stands for
$$1 \leq \{p, q\}.$$ \hspace{1cm} (3)
Note that this expression is different from (2).
In the input language of LPARSE, $:\leftarrow$ stands for $\leftarrow$, and each rule is followed by a period.
If we want to find, for instance, the answer sets for the program
$$p \leftarrow not \ q$$
$$q \leftarrow not \ p$$
$$r \leftarrow p$$
$$r \leftarrow q$$
we create the file
$$p := not \ q.$$ \hspace{1cm} (4)
$$q := not \ p.$$ \hspace{1cm} (5)
$$r := p.$$ \hspace{1cm} (6)
$$r := q.$$ \hspace{1cm} (7)
called, say, input.lp. Then we invoke LPARSE and SMODELS as follows:
% lparse input.lp | smodels 0
The zero at the end indicates that we want to compute all answer sets; a positive number $k$ would tell SMODELS to terminate after computing $k$ answer sets. The default value of $k$ is 1. The main part of the output generated in response to this command line is the list of the program’s answer sets:
Answer: 1
Stable Model: r p
Answer: 2
Stable Model: r q
(“stable model” means “answer set”).
**Problem 1** Use SMODELS to find the answer sets for the program
\[
\begin{align*}
\{p, q\}^c & \leftarrow p, q.
\end{align*}
\]
A group of rules that follow a pattern can be often described in a compact way using variables. Variables must be capitalized. Consider, for instance, the programs \(\Pi_n\)
\[
p_i \leftarrow \text{not } p_{i+1} \quad (1 \leq i \leq n).
\]
To describe \(\Pi_7\), we don’t have to write out each of its 7 rules. Let’s agree to use the symbol `index` to represent a number between 1 and 7. We can write \(\Pi_7\) as
\[
\text{index}(1..7).
p(I) :- \text{not } p(I+1), \text{index}(I).
\]
The auxiliary symbols used in the input language of LPARSE to describe the ranges of variables, such as `index`, are called domain predicates. The “definitions” of domain predicates, such as `index(1..7)`, tell LPARSE how to substitute specific values for variables in schematic expressions, such as `p(I) :- not p(I+1)`. Grounding—translating schematic expressions into sets of rules—is the main computational task performed by LPARSE.
When the input file uses domain predicates, the output of SMODELS lists the objects satisfying each domain predicate along with the elements of the answer set:
Answer: 1
Stable Model: p(1) p(3) p(5) p(7) index(1) index(2) index(3) index(4) index(5) index(6) index(7)
Information on the extents of domain predicates in the output can be suppressed by including a `hide` directive in the input file:
```
hide index(_).
```
The family of programs \(\Pi_n\) can be described by a schema with the parameter \(n\):
\[
\text{index}(1..n).
p(I) :- \text{not } p(I+1), \text{index}(I).
\]
When this schematic description is given to LPARSE as input, the value of the constant \(n\) should be specified in the command line using the option `-c`, as follows:
Problem 2 Consider the program obtained from $\Pi_n$ by adding the rule
$$p_{n+1} \leftarrow \neg p_1.$$
How many answer sets does this program have, in your opinion? Check your conjecture for $n = 7$ and $n = 8$ using SMODELS.
Variables can be also used “locally” to describe the list of formulas in a cardinality expression. The domain predicate characterizing the range of a local variable is placed inside the braces. For instance, the rule
$$1 \leq \{p_1, \ldots, p_n\} \leq 1$$
can be represented in an LPARSE input file by the lines
index(1..n).
$\{p(I) : \text{index}(I)\}1.$
Problem 3 Consider the program
$$1 \leq \{p_{i1}, \ldots, p_{in}\} \leq 1 \quad (1 \leq i \leq n),$$
where $n$ is a positive integer. How many answer sets does this program have, in your opinion? Check your conjecture for $n = 3$ using SMODELS.
A detailed description of the input language of LPARSE, as well as the complete list of options of LPARSE and SMODELS, can be found in the system’s manual, available at its web site.
Besides SMODELS, there are some other answer set solvers that use LPARSE for grounding, such as ASSAT$^1$ and CMODELS$^2$. Among other existing systems for computing answer sets, DLV$^3$ stands out by virtue of two things: it uses a very efficient grounding mechanism, and it can process rules containing disjunctions of several atoms in the head.
Methodology of ASP
To solve a problem using ASP means to write a program whose answer sets correspond to solutions, and then find a solution using an answer set solver, such as SMODELS. The basic approach to writing such a program is known as the “generate-and-test” strategy. First we write a group of rules whose heads contain choice expressions so that the
---
$^1$http://assat.cs.ust.hk/.
$^2$http://www.cs.utexas.edu/users/tag/cmodels/.
$^3$http://www.dbai.tuwien.ac.at/proj/dlv/.
answer sets for this group of rules correspond to “potential solutions”—an easy-to-describe superset of the set of solutions. Then we add a group of constraints that weed out the potential solutions that are not solutions.
Consider, for instance, the use of this method to solve the \( n \)-queens problem. The goal is to place \( n \) queens on an \( n \times n \) chessboard so that no two queens would be placed on the same row, column or diagonal. A solution can be described by a set of atoms of the form \( q(i, j) \) (\( 1 \leq i, j \leq n \)); including \( q(i, j) \) in the set indicates that there is a queen at position \((i, j)\). A solution is a set \( X \) satisfying the following conditions:
1. The cardinality of \( X \) is \( n \).
2. \( X \) does not contain a pair of different atoms of the form \( q(i, j) \), \( q(i', j) \) (two queens in the same row).
3. \( X \) does not contain a pair of different atoms of the form \( q(i, j) \), \( q(i, j') \) (two queens in the same column).
4. \( X \) does not contain a pair of different atoms \( q(i, j) \), \( q(i', j') \) with \( |i' - i| = |j' - j| \) (two queens on the same diagonal).
The sets satisfying Conditions 1 and 2 can be described by the rules
\[
1 \leq \{q(1,j), \ldots, q(n,j)\} \leq 1 \quad (1 \leq j \leq n)
\]
(exactly one queen in each row). These rules form the “generate” part of our program. The “test” part consists of the constraints expressing Condition 3
\[
\leftarrow q(i,j), q(i,j') \quad (1 \leq i, j, j' \leq n; j < j')
\]
and Condition 4
\[
\leftarrow q(i,j), q(i',j') \quad (1 \leq i, i', j, j' \leq n; j < j'; |i' - i| = j' - j).
\]
Here is a representation of this program in the input language of LPARSE:
\[
\text{number}(1..n).
\]
\[
\text{l}\{q(I,J) : \text{number}(I)\}l \text{ :- \text{number}(J)}.
\]
\[
\text{:- q(I,J), q(I,J1),}
\]
\[
\text{number(I;J;J1), J<J1}.
\]
\[
\text{:- q(I,J), q(I1,J1),}
\]
\[
\text{number(I;I1;J;J1), J<J1, abs(I1-I)==J1-J.}
\]
\[
\text{hide number(I).}
\]
The expression \( \text{number}(I; J; J1) \) is the LPARSE abbreviation for
\[
\text{number}(I), \text{number}(J), \text{number}(J1).
\]
Note the conditions \( J < J1 \) and \( \text{abs}(I1-I) == J1-J \) in the bodies of rules. By including them, we tell LPARSE how to limit the choice of values used in the process of grounding.
**Problem 4** Use SMODELS to find all solutions to the 8 queens problem that (a) have a queen at (1,1); (b) have no queens in the 4 \( \times \) 4 square in the middle of the board.
In many cases, the constraints in the test part of the program use auxiliary atoms, defined in terms of the atoms occurring in the generate part. The definitions of the auxiliary atoms form then a third component of the program, besides the “generate” and “test” parts—its “define” part.
Consider, for instance, the problem of finding a Hamiltonian circuit in a given graph—a closed path that visits every node exactly once. A Hamiltonian circuit in a graph \( G \) can be thought of as a subgraph \( C \) of \( G \) that has the same set \( V \) of vertices as \( G \) and satisfies two conditions:
1. Every vertex is adjacent in \( C \) to exactly two vertices.
2. Every vertex is reachable in \( C \) from some fixed vertex \( v_0 \).
The program below represents an edge \( \{u, v\} \) of \( G \) by the atom \( \text{in}(u, v) \), where \( u < v \) (\(< \) is a fixed total order on \( V \)). The presence of this atom in an answer set indicates that the edge \( \{u, v\} \) is included in \( C \). The generate part of the program consists of the rules
\[
\{\text{in}(u, v)\}^c
\]
for all edges \( \{u, v\} \) of \( G \) \( (u < v) \). Thus any set of edges is a potential solution. To encode the two conditions that characterize Hamiltonian circuits, we introduce the auxiliary atoms \( \text{adj}(u, v) \) \( (u < v) \) that represent adjacency in \( C \). These atoms are “defined” in terms of \( \text{in}(u, v) \) by the rules
\[
\text{adj}(u, v), \text{adj}(v, u) \leftarrow \text{in}(u, v)
\]
for all edges \( \{u, v\} \) of \( G \) \( (u < v) \). Then Condition 1 above can be expressed by the constraints
\[
\leftarrow \{\text{adj}(u, v) : v \in V\} \leq 1
\leftarrow 3 \leq \{\text{adj}(u, v) : v \in V\}
\]
for all \( u \in V \). For Condition 2, we introduce the auxiliary atoms \( r(u) \) that express the reachability of \( u \) from \( v_0 \). They are “defined recursively” by the rules
\[
\text{r}(v_0)
\text{r}(u) \leftarrow \text{r}(v), \text{adj}(u, v)
\]
\[
(6)
\]
for all edges \( \{u, v\} \) of \( G \). Using these atoms, we express Condition 2 by the constraints
\[
\leftarrow \text{not } r(u) \quad (7)
\]
for all \( u \in V \).
Answer sets for program (3)–(7) are in a 1–1 correspondence with the Hamiltonian circuits in \( G \). Rules (4) and (6) form the define part of the program, and rules (5) and (7) form the test part.
The following file \( \text{hc} \) is an \textsc{lpars}e encoding of program (3)–(7), in which we assume that the vertices of \( G \) are integers, and \( v_0 = 0 \):
\[
\begin{align*}
\{ \text{in}(U,V) \} & :\text{e} \text{dge}(U,V). \\
\text{adj}(U,V) & :\text{in}(U,V), \text{vertex}(U;V). \\
\text{adj}(V,U) & :\text{in}(U,V), \text{vertex}(U;V). \\
\leftarrow \{ \text{adj}(U,V) : \text{vertex}(V) \}1, \text{vertex}(U). \\
\leftarrow 3\{ \text{adj}(U,V) : \text{vertex}(V) \}, \text{vertex}(U). \\
\text{r}(0). \\
\text{r}(U) & :\text{r}(V), \text{adj}(U,V), \text{vertex}(U;V). \\
\leftarrow \text{not } \text{r}(U), \text{vertex}(U). \\
\text{hide.} \\
\text{show in(\_,\_).}
\end{align*}
\]
(The last two lines tell \textsc{smo}dels to display the \text{in} atoms only.)
This file needs to be appended to a description of \( G \) in the form of a definition of the domain predicates \text{vertex} and \text{edge}. For instance, the file
\[
\begin{align*}
\text{vertex}(0..7). \\
\text{edge}(U,U+1) & :\text{vertex}(U), U\neq3, U\neq7. \\
\text{edge}(0,3). \\
\text{edge}(4,7). \\
\text{edge}(U,U+4) & :\text{vertex}(U), U<4.
\end{align*}
\]
describes the vertices and edges of a cube. Assuming that this file is called \text{cube}, \textsc{smo}dels can be instructed to find a Hamiltonian circuit by the command
\[
\% \text{lparse cube hc | smodels}
\]
**Problem 5** The vertices of graph \( G_n \) are the points \((x, y)\) with coordinates \( x, y \in \{0, \ldots, n - 1\} \); two vertices are adjacent if the distance between them is 1. Use \textsc{smo}dels to find out whether \( G_5 \) has a Hamiltonian circuit.
In each of the following exercises, show how to solve the given computational problem using SMODELS. For the first three exercises below, as in the Hamiltonian circuit example, use specific data (of your choice) to test your program.
Problem 6 A clique in a graph $G$ is a subset of its vertices whose elements are pairwise adjacent. Determine whether $G$ has a clique of cardinality $n$.
Problem 7 You are organizing a large New Year’s Eve party. There will be $n$ tables in the room, with $m$ chairs around each table. You need to select a table for each of the guests, who are assigned numbers from 1 to $mn$, so that two conditions are satisfied. First, some guests like each other and want to sit together; accordingly, you are given a set $A$ of two-element subsets of $\{1, \ldots, mn\}$, and, for every $\{i, j\}$ in $A$, guests $i$ and $j$ should be assigned the same table. Second, some guests dislike each other and want to sit at different tables; accordingly, you are given a set $B$ of two-element subsets of $\{1, \ldots, mn\}$, and, for every $\{i, j\}$ in $B$, guests $i$ and $j$ should be assigned different tables. The goal is to find such a seating arrangement or determine that this is impossible.
Problem 8 You are in charge of assigning referees to the papers submitted to a conference. Each of the $n$ submissions needs to be assigned to a few referees from among the $m$ members of the Program Committee. The PC members have read the abstracts of all submissions, and each of them gave you the numbers of the submissions that he is qualified to referee; let $A_i \ (1 \leq i \leq m)$ be the subset of $\{1, \ldots, n\}$ given to you by the $i$-th committee member. You need to select, for each $i$, a set $X_i$ of papers to be assigned to the $i$-th committee member so that three conditions are satisfied. First, each $X_i$ should be a subset of $A_i$. Second, the cardinality of each $X_i$ should be between a lower bound $l$ and an upper bound $u$. Third, each paper should be assigned to exactly $k$ referees. The goal is to find such an assignment of papers to referees or determine that this is impossible.
Problem 9 Each of four men owns a different species of exotic pet. From the following clues, can you figure out each man’s full name and what kind of pet he owns?
1. Mr. Engel (whose pet is named Sparky), Abner and Mr. Foster all belong to a club for owners of unusual pets.
2. The iguana is not owned by either Chuck or Duane.
3. Neither the jackal nor the king cobra is owned by Mr. Foster.
4. The llama does not belong to Duane (whose pet is named Waggles).
5. Abner, who does not own the king cobra, is not Mr. Gunter.
6. Bruce and Mr. Foster are neighbors.
7. Mr. Halevy is afraid of iguanas.
Problem 10 A set \( A \) of integers is called sum-free if there are no numbers \( x, y \) in \( A \) such that \( x + y \) is in \( A \) also \( (x \) and \( y \) do not need to be different). The Schur number \( S(k) \) is the largest integer \( n \) for which the interval \( \{1, \ldots, n\} \) can be partitioned into \( k \) sum-free sets.\(^5\) Write a program that computes \( S(k) \), and try it for \( k = 1, 2, 3 \).
References
|
{"Source-Url": "http://people.sabanciuniv.edu/~esraerdem/teaching/krr06/asp.pdf", "len_cl100k_base": 5168, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 25243, "total-output-tokens": 6215, "length": "2e12", "weborganizer": {"__label__adult": 0.0003523826599121094, "__label__art_design": 0.00045228004455566406, "__label__crime_law": 0.0004887580871582031, "__label__education_jobs": 0.005664825439453125, "__label__entertainment": 0.0001112222671508789, "__label__fashion_beauty": 0.0002083778381347656, "__label__finance_business": 0.0003635883331298828, "__label__food_dining": 0.0004892349243164062, "__label__games": 0.0008955001831054688, "__label__hardware": 0.0011682510375976562, "__label__health": 0.0006804466247558594, "__label__history": 0.00036787986755371094, "__label__home_hobbies": 0.0002417564392089844, "__label__industrial": 0.0008645057678222656, "__label__literature": 0.0004794597625732422, "__label__politics": 0.0003421306610107422, "__label__religion": 0.0006504058837890625, "__label__science_tech": 0.1256103515625, "__label__social_life": 0.00020968914031982425, "__label__software": 0.0140380859375, "__label__software_dev": 0.84521484375, "__label__sports_fitness": 0.00036215782165527344, "__label__transportation": 0.0006780624389648438, "__label__travel": 0.0002231597900390625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 18089, 0.01935]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 18089, 0.80828]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 18089, 0.84481]], "google_gemma-3-12b-it_contains_pii": [[0, 1895, false], [1895, 3460, null], [3460, 5368, null], [5368, 7233, null], [7233, 9242, null], [9242, 11762, null], [11762, 13768, null], [13768, 16522, null], [16522, 18089, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1895, true], [1895, 3460, null], [3460, 5368, null], [5368, 7233, null], [7233, 9242, null], [9242, 11762, null], [11762, 13768, null], [13768, 16522, null], [16522, 18089, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 18089, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 18089, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 18089, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 18089, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 18089, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 18089, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 18089, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 18089, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 18089, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 18089, null]], "pdf_page_numbers": [[0, 1895, 1], [1895, 3460, 2], [3460, 5368, 3], [5368, 7233, 4], [7233, 9242, 5], [9242, 11762, 6], [11762, 13768, 7], [13768, 16522, 8], [16522, 18089, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 18089, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
ab96aee6d153d0f916aea27fdd1912cbe5364c62
|
Speech Recognition for the iCub Platform
Article · February 2018
DOI: 10.3389/frobt.2018.00010
CITATIONS 0
READS 7
4 authors, including:
Bertrand Higy
Istituto Italiano di Tecnologia
2 PUBLICATIONS 5 CITATIONS
SEE PROFILE
Alessio Mereta
European Space Agency
6 PUBLICATIONS 14 CITATIONS
SEE PROFILE
Leonardo Badino
Istituto Italiano di Tecnologia
45 PUBLICATIONS 322 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
- ALLSpeak View project
- Differential Intelligence View project
All content following this page was uploaded by Bertrand Higy on 26 February 2018.
The user has requested enhancement of the downloaded file.
Speech recognition for the iCub platform
Bertrand Higy\textsuperscript{1,2}, Alessio Mereta\textsuperscript{3}, Giorgio Metta\textsuperscript{1} and Leonardo Badino\textsuperscript{4,}*
\textsuperscript{1}iCub Facility, Istituto Italiano di Tecnologia, Genova, Italy
\textsuperscript{2}Università di Genova, Genova, Italy
\textsuperscript{3}Advanced Concepts Team, European Space Agency, Noordwijk, The Netherlands
\textsuperscript{4}Center for Translational Neurophysiology of Speech and Communication, Istituto Italiano di Tecnologia, Ferrara, Italy
Correspondence*: Leonardo Badino leonardo.badino@iit.it
ABSTRACT
This paper describes open source software (available at https://github.com/robotology/natural-speech) to build automatic speech recognition (ASR) systems and run them within the YARP platform. The toolkit is designed (i) to allow non-ASR experts to easily create their own ASR system and run it on iCub, and (ii) to build deep learning-based models specifically addressing the main challenges an ASR system faces in the context of verbal human-iCub interactions. The toolkit mostly consists of Python, C++ code and shell scripts integrated in YARP. As additional contribution, a second codebase (written in Matlab) is provided for more expert ASR users who want to experiment with bio-inspired and developmental learning-inspired ASR systems. Specifically, we provide code for two distinct kinds of speech recognition: "articulatory" and "unsupervised" speech recognition. The first is largely inspired by influential neurobiological theories of speech perception which assume speech perception to be mediated by brain motor cortex activities. Our articulatory systems have been shown to outperform strong deep learning-based baselines. The second type of recognition systems, the "unsupervised" systems, do not use any supervised information (contrary to most ASR systems, including our articulatory systems). To some extent, they mimic an infant who has to discover the basic speech units of a language by herself. In addition, we provide resources consisting of pre-trained deep learning models for ASR, and a 2,5-hours speech dataset of spoken commands, the VoCub dataset, which can be used to adapt an ASR system to the typical acoustic environments in which iCub operates.
Keywords: automatic speech recognition, yarp, tensorflow, code:python, code:matlab, code:C++
1 INTRODUCTION
Several applications use speech to give instructions to iCub, often relying on proprietary software. However, the robot operates in specific conditions where those systems may perform poorly. An open and easy-to-use system that would reliably recognize commands in this context would thus be a very desirable tool. We
present here a first codebase, henceforth \textit{iCubRec}, which has been built to provide such services to the community of iCub users. It allows to train and run state-of-the-art deep neural network (DNN)-based automatic speech recognition (ASR).
As an additional contribution, a second codebase, henceforth \textit{bioRec}, allows to experiment with novel DNN-based recognition systems that share the same bio-inspired and developmental learning view that gave birth to iCub (Lungarella et al., 2003). \textit{bioRec} is self-contained and independent of \textit{iCubRec}, however its DNN-based acoustic models can effortlessly be used within \textit{iCubRec}.
Finally, in addition to the code, we are also providing resources to facilitate the implementation of a command recognizer: (i) the VoCub dataset, a dataset of registered vocal commands, (ii) pretrained Gaussian Mixture Model (GMM)- and DNN-based acoustic models to perform recognition.
Our code, as well as the resources, are released under GPLv3 license. The code is available at https://github.com/robotology/natural-speech (doi:10.5281/zenodo.1064043).
2 \textbf{ICUBREC}
2.1 Application and utility
An ASR system for iCub typically operates in challenging conditions. We have identified three specific factors which we want the system to be robust to:
- noise; the robot often operates in noisy environments (e.g., noisy servers and computers running, concurrent speakers, the robot itself generating noise).
- accents; the teams working with iCub are international and the robot needs to recognize spoken commands uttered with a wide variety of foreign accents.
- distance and movement; distant speech recognition is an important research topic in ASR and has been the focus of many recent challenges (e.g., the Chime4 challenge\footnote{http://spandh.dcs.shef.ac.uk/chime_challenge/chime2016/}). When the speaker-microphone distance increases, the speech signal-to-noise ratio decreases and signal distortions due to reverberation (in indoor environments) increases. A non-fixed distance, due to a moving speaker and/or microphone, adds further complexity to the task.
Although deep learning has recently produced excellent results in ASR, it still suffers the training-testing mismatched conditions problem. Proprietary ASR systems may perform poorly in the aforementioned acoustic/speech conditions mainly because such conditions are not well covered by their training datasets. We have addressed this problem by building a dataset (VoCub dataset) that covers such conditions and by providing tools to easily adapt a DNN to it.
Other than robust, an ASR system for iCub should be easy-to-use, open and modular. Usability is necessary to allow all iCub mindware developers, who mostly have no ASR background, to train and run ASR on iCub. For this reason we provide pretrained GMM- and DNN-based acoustic models that can be used out of the box with the existing code. At the same time, we want more advanced users to easily modify and adapt the code to their own needs. This can only be done if everything is open and well modularized.
2.2 Methods
To facilitate the understanding of the iCubRec module for non-ASR experts we provide here the definition of few basic ASR terms. A standard ASR system consists of 4 main parts: an acoustic feature extraction step which extracts spectral features from the input acoustic waveform; an acoustic model which relates the extracted features to sub-words (e.g., phonemes, such as consonants and vowels) and then words (i.e., computes the likelihood that vectors of features are generated by a candidate word); a language model, which is independent of the acoustic signals and incorporates prior knowledge about a specific language (e.g., the probability that the word “barks” follows the word “dog”); and a speech decoder which performs word recognition by computing the most probable sequence of words of the utterance, given: a) the acoustic model; b) the language model; c) the dictionary, which consists of all words the system has to recognize along with their phoneme transcriptions. Acoustic modeling is usually done using a Hidden Markov Model (HMM) which is well suited for sequential data like speech. HMMs combine transition probabilities (i.e., \( p(s_t|s_{t-1}) \) where \( s_t \) is a phone label at time \( t \)) with observation probabilities (i.e., \( p(o_t|s_t) \), where \( o_t \) is the input vector of acoustic feature at time \( t \)). The core difference between classical GMM-HMM vs. hybrid DNN-HMM acoustic models simply resides on whether GMMs or DNNs are used to compute the observation probabilities.
2.3 Code description
iCubRec code is based on the Hidden Markov Model Toolkit (HTK) (Young et al., 2015). However, as the training capabilities for DNNs are still quite limited in HTK, we also consider the alternative possibility to train a network with Tensorflow (Martín Abadi et al., 2015) and convert it to HTK format for use in decoding. Although in the later case the DNN is still restricted to the architectures recognized by HTK (for now, only feedforward networks with a limited set of activation functions), this gives more flexibility and control over the training process. Additionally, the use of Tensorflow allows to easily adapt a pretrained DNN to new adaptation data.
The code consists of scripts for:
- acoustic model training with GMMs
- acoustic model training with DNNs
- speech decoding
- integration within YARP for online speech decoding.
iCubRec is a combination of Python 3, Perl and shell scripts, and was written for HTK 3.5 and Tensorflow 1.0.
2.3.1 GMM-based acoustic modeling
Before the advent of DNNs, GMM-HMM systems were state of the art for acoustic modeling in speech recognition. Although they are significantly outperformed by neural networks (Seltzer et al., 2013; Dahl et al., 2012), GMMs are still widely used if only to compute the phone labels / speech segments alignments needed to train a DNN (Dahl et al., 2012). The folder gmm_training provides a set of scripts to train GMM-HMMs using HTK. These scripts are based on Keith Vertanen’s code (Vertanen, 2006) and allow to build models similar to the ones described by Woodland et al. (1994). The recipe is originally intended for TIMIT (Garofolo et al., 1993b) and Wall Street Journal (WSJ) (Garofolo et al., 1993a) datasets and has been adapted for the Chime4 challenge (Vincent et al., 2016) and VoCub datasets.
2.3.2 DNN-based acoustic modeling
Once the speech signal has been aligned (presumably using GMM-HMMs), a DNN-based model can be trained. Two alternatives are available: (i) using the scripts in dnn\_training/htk to train a model with HTK or (ii) using the code under dnn\_training/tf to train the net with Tensorflow. The scripts proposed here are currently restricted to TIMIT and WSJ, but support for additional datasets will be added soon.
2.3.3 Speech decoding
With a model trained with HTK (GMM-based or DNN-based), it is then straightforward to perform recognition on a new utterance. The folder offline\_decoding provides an example of decoding on pre-recorded data with HTK. Additionally, export\_for\_htk.py shows how to easily extract the parameters of a net trained with Tensorflow and convert them into HTK format.
2.3.4 Integration with YARP
All the code presented so far is meant to train and test a system offline. yarp\_decoding folder provides the modules necessary to use an existing model within YARP and perform online recognition. A streaming service based on yarp.js\(^2\) allows to record sound from any device equipped with a microphone and a web browser. Two other modules are provided: rctrl\_yarp\_hear\_asr which saves the recorded data in a file, and the decoder (based on HVite tool from HTK) for feature extraction and command decoding. The application speechrec.xml is available to easily run and connect all the modules.
2.4 Resources
2.4.1 The VoCub dataset
Recording a dataset has two main advantages: (i) it allows to easily test the recognition system and reliably estimate its performance in real conditions, and (ii) it can be used to adapt the system in order to reduce the training/testing mismatch problem. For this reasons we have recorded examples of the commands we want to recognize within real-usage scenarios. That resulted in the VoCub dataset\(^3\).
The recordings consist of spoken English commands addressed to iCub. There are 103 unique commands (see Table 1 for some examples), composed of 62 different words. We recorded 29 speakers, 16 males and 13 females, 28 of them are non-native English speakers. We finally obtained 118 recordings from each speaker: of the 103 unique commands, 88 were recorded once, and 15 twice (corresponding to sentences containing rare words). This results in about 2 hours and 30 minutes of recording in total.
A split of the speakers into training, validation and test sets is proposed with 21, 4 and 4 speakers per set respectively. The files are organized with the following convention setid/spkrid/spkrid\_cond\_recid.wav, where:
- setid identifies the set: tr for training, dt for validation and et for testing.
- spkrid identifies the speaker: from 001 to 021 for training, 101 to 104 for validation and 201 to 204 for testing.
- cond identifies the condition (see below).
- recid identifies the record within the condition (starting from 0 and increasing).
\(^2\) https://github.com/robotology/yarp.js
\(^3\) freely available at https://robotology.github.io/natural-speech/vocub/
Table 1. 10 examples of the commands used in the VoCub dataset
<table>
<thead>
<tr>
<th>Command</th>
</tr>
</thead>
<tbody>
<tr>
<td>I will teach you a new object.</td>
</tr>
<tr>
<td>This is an octopus.</td>
</tr>
<tr>
<td>What is this?</td>
</tr>
<tr>
<td>Let me show you how to reach the car with your left arm.</td>
</tr>
<tr>
<td>Let me show you how to reach the turtle with your right arm.</td>
</tr>
<tr>
<td>There you go.</td>
</tr>
<tr>
<td>Grasp the ladybug.</td>
</tr>
<tr>
<td>Where is the car?</td>
</tr>
<tr>
<td>No, here it is.</td>
</tr>
<tr>
<td>See you soon.</td>
</tr>
</tbody>
</table>
The commands were recorded in two different conditions, a non-static (cond = 1) and a static condition (cond = 2), with an equal number of recorded utterances per condition.
In the static condition, the speaker sat in front of two screens where the sentences to read were displayed. In the non-static condition, the commands were provided to the subject verbally through a speech synthesis system, and the subject had to repeat them while performing a secondary manual task. This secondary task was designed to be simple enough to not impede the utterance repetition task, while requiring people to move around the robot. The distance between the speaker and the microphone in this last condition ranges from 50 cm to 3 m.
We also registered a set of additional sentences for the testing group (same structure but different vocabulary) to test the recognition system for new commands not seen during training. The sentences consist of 20 new commands, pronounced by each speaker of the test set twice: once in non-static condition (cond = 3) and once in static condition (cond = 4).
2.4.2 Trained models
As not all the datasets used in our scripts are freely available, and in order to ease the use of our system, we provide pre-trained acoustic models that can be used out of the box. The models/README.md file contains links to download GMM-based models trained on WSJ, Chime4 and VoCub datasets, and DNN-based models trained on TIMIT and WSJ. Additional DNN-based models will be added in the future. Further details about the different models and the precise training procedure can be found in the same file.
2.5 Example of use
A good demonstration of the capabilities of the code presented so far is given in the file icubrec/DEMO.md. In a few simple steps, the user is shown how to perform offline decoding on the VoCub dataset with a pretrained model. This example is accessible to novice ASR users and does not require any proprietary dataset.
A more in-depth example is given in icubrec/TUTORIAL.md, which provides detailed instruction on how to train a full ASR system on the WSJ dataset. This tutorial goes through all the main steps: training of a GMM-based acoustic model, computation of the alignments, training of a DNN-based acoustic model using those alignments, and finally decoding of the test sentences.
Our module for bio- and cognitive science-inspired ASR is composed of two distinct parts serving different purposes: Articulatory Phone Recognition and Unsupervised/Developmental ASR.
### 3.1 Application and utility
This part includes modules phonerec and pce_phonerec, which build articulatory phone recognition systems. A phone recognition system recognizes the sequence of phones of an utterance. It can roughly be identified as an ASR system without language model and dictionary. Articulatory phone recognition uses prior information about how the vocal tract moves when producing speech sounds. This articulatory view is strongly motivated by influential neurobiological theories of speech perception that assume a contribution of the brain motor cortex to speech perception (Pulvermüller and Fadiga, 2010), and have been shown to outperform strong DNN-based baselines where no prior articulatory information is used (see e.g., Badino et al. (2016)).
### 3.1.2 Unsupervised/Developmental ASR
The second part of bioRec, zerorchallenge, builds “unsupervised” ASR systems. Most recognition systems, including the articulatory systems, are trained on supervised data, where training utterances are associated to phonetic transcriptions, and the inventory of phones is given. This learning setting is far easier than the learning setting of an infant who has to acquire her native language and has to discover the basic units of the language on her own. In order to better understand how an infant can acquire the phone inventory during development from raw “unsupervised” utterances, we have created “unsupervised” ASR systems that were submitted and evaluated at the 1st Zero Resource Speech Challenge (ZRS challenge) (Versteegh et al., 2015).
### 3.2 Methods
#### 3.2.1 Articulatory Phone Recognition
The articulatory phone recognition module consists of 2 parts depending on how speech production information is represented:
- **phonerec**: speech production is represented in the form of actual measurements of vocal tract movements, collected through instruments such as the electromagnetic articulograph (Richmond et al., 2011);
- **pce_phonerec**: vocal tract movements are initially described by discrete linguistic features and actual measurements are not used.
In this module, prior information of speech production is built by learning, during training, an acoustic-to-articulatory mapping that allows to recover vocal tract movements, i.e., reconstructed articulatory features (AFs), from the acoustic signal (Badino et al., 2012, 2016). The reconstructed AFs are then appended to the usual input acoustic vector of the DNN that computes phone state posterior probabilities, i.e, the acoustic model DNN (see Figure 1, which shows the simplest strategy). Additionally, our code allows to apply autoencoder (AE)-based transformations to the original AFs in order to improve performance. AEs are a special kind of DNN that attempts to reconstruct its input after encoding it, typically through a lossy encoding. More details and evaluation results can be found in (Badino et al., 2016).
In this module, AFs are derived (through a DNN) from linguistic discrete features (referred to as phonetic context embedding). They are used as secondary target for the acoustic model DNN within a multi-task learning (MTL) strategy (Caruana, 1997). This strategy forces the DNN to learn a motor representation without the need for time-consuming collection of actual articulatory data. Our approach outperforms strong alternative MTL-based approaches (Badino, 2016).
3.2.2 Unsupervised/Developmental ASR
zerorchallenge is the module building the unsupervised/developmental ASR systems we submitted to Task1 of the ZRS challenge at Interspeech 2015 (Versteegh et al., 2015). The goal of the challenge was to compare systems that create new acoustic representations that can discriminate examples of minimal pairs, i.e., words differing only in one phoneme (e.g., “hat” vs. “had”), while identifying as a single entity different examples of a same word. Specifically, we focused on extracting discrete/symbolic representations, which equals to automatically discovering the inventory of (phone-like) sub-words of a language. Our core strategy is based on AEs (Badino et al., 2014), as shown in Figure 2. The provided scripts build 2 novel systems, one based on binarized AEs and one on Hidden Markov Model Encoders (HMM-Encoders) (Badino et al., 2015).
A binarized AE is an AE whose encoding layer nodes are binary. At each time step, it transforms a vector of real-valued acoustic features into a vector of binary units which in turn is associated to a positive integer corresponding to a discovered specific sub-word.
The HMM-Encoder combines an AE with a HMM. An approach solely based on AEs ignores the sequential nature of speech and inter-subword dependencies. The HMM-Encoder was proposed to specifically address these potential weaknesses.
3.3 Code description and example of use
All code is written in Matlab and uses the Parallel Processing Toolbox to allow fast DNN training with GPUs. All modules were tested in Matlab 2013a and 2015a.
3.3.1 Articulatory Phone Recognition
phonerec. The file ploclassify.m allows to train and test articulatory phone recognition systems. It requires the inivar.m configuration file where it is possible to define, e.g.: the type of AFs through cmotortype (e.g., AE-transformed AFs or “plain” AFs), the hyperparameters of the acoustic model DNN (parnet_classifier), and of the acoustic-to-articulatory mapping DNN (parnet_regress).
The folder demo contains 2 examples to build and evaluate a baseline (audiol_motor0_rec0) and an articulatory phone recognition system (audiol_motor3_rec1) on the mngu0 dataset (Richmond et al., 2011). The dataset used here (available at https://zenodo.org/record/836692/files/bioRec_Resources.tar.gz, under /bioRec_Resources/phonerec_mngu0/) is a preprocessed version of the mngu0 dataset.
pce_phonerec. This articulatory phone recognition system is trained and evaluated by running mtkpr_pce.m. It can be compared with an alternative MTL based strategy proposed by Microsoft researchers (Seltzer and Droppo, 2013), by running the script mtkpr_baseline.m. All systems are trained and tested on the TIMIT dataset, which unfortunately is not freely available. Training on different datasets would require some small dataset-dependent modifications to the look-up table used to extract discrete linguistic features from phone names.
Our HMM training code is a modified version of code from K. Murphy’s BayesianNet toolbox, available at https://github.com/bayesnet/bnt.
Figure 1. An example of articulatory phone recognition. Here the simplest strategy available in phonerec is shown. \( o_t \) is a vector of acoustic features, while \( s_t \) is a phone state.
We have created a Python+Tensorflow implementation the DNN training proposed in this module which will be soon available.
3.3.2 Unsupervised/Developmental ASR
We provide scripts that receive as input one of the datasets provided by the ZRS challenge, train one of the unsupervised ASR systems (on the training utterances), and return the testing utterances in a new discrete representation with a positive integer at each time step. We additionally provide the 3 datasets from the ZRS challenge already transformed to be processed by our scripts (available at [https://zenodo.org/record/836692/files/bioRec_Resources.tar.gz](https://zenodo.org/record/836692/files/bioRec_Resources.tar.gz), under /bioRec_Resources/zerochallenge/). The output format allows to evaluate the output file with the tools provided for the challenge (Versteegh et al., 2015).
3.3.3 Utilities
All utilities used by the phonerec, pce_phonerec and zerorchallenge are in:
- netutils. Contains functions to train and run DNNs, e.g.: standard DNN training, Deep Belief Network-based DNN pretraining (Hinton et al., 2006), MTL training, DNN forward pass (i.e., to evaluate a DNN), deep auto-encoder training, including training of some AEs we have recently proposed specifically for speech.
4 CONCLUSION
In this paper we have described the codebase that allows to easily train deep neural network based automatic speech recognition systems and run them within YARP. As an additional contribution we provide tools to experiment with recognition systems that are inspired by recent influential theories of speech perception and with systems that partly mimic the learning setting of an infant who has to learn the basic speech units of a language.
CONFLICT OF INTEREST STATEMENT
The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.
AUTHOR CONTRIBUTIONS
Conceived and designed the ASR systems: LB, GM, BH, AM.
Wrote the code: LB, BH, AM.
Wrote the paper: BH, LB.
The authors acknowledge the support of the European Commission project POETICON++ (grant agreement No. 288382) and ECOMODE (grant agreement No. 644096).
REFERENCES
Richmond, K., Hoole, P., and King, S. (2011). Announcing the electromagnetic articulography (day 1) subset of the mngu0 articulatory corpus. In Proc. of Interspeech (Florence, Italy)
|
{"Source-Url": "https://bhigy.github.io/files/higy_frontiers_2018.pdf", "len_cl100k_base": 5811, "olmocr-version": "0.1.50", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 30044, "total-output-tokens": 7569, "length": "2e12", "weborganizer": {"__label__adult": 0.0005903244018554688, "__label__art_design": 0.0007014274597167969, "__label__crime_law": 0.0006914138793945312, "__label__education_jobs": 0.0010881423950195312, "__label__entertainment": 0.00037479400634765625, "__label__fashion_beauty": 0.000244140625, "__label__finance_business": 0.00022864341735839844, "__label__food_dining": 0.0004906654357910156, "__label__games": 0.000949859619140625, "__label__hardware": 0.0021190643310546875, "__label__health": 0.0015192031860351562, "__label__history": 0.0003745555877685547, "__label__home_hobbies": 0.00012159347534179688, "__label__industrial": 0.0006384849548339844, "__label__literature": 0.000823974609375, "__label__politics": 0.0005927085876464844, "__label__religion": 0.0007486343383789062, "__label__science_tech": 0.365966796875, "__label__social_life": 0.0001914501190185547, "__label__software": 0.016754150390625, "__label__software_dev": 0.603515625, "__label__sports_fitness": 0.0004220008850097656, "__label__transportation": 0.0007390975952148438, "__label__travel": 0.0002390146255493164}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28567, 0.0379]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28567, 0.49725]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28567, 0.8898]], "google_gemma-3-12b-it_contains_pii": [[0, 689, false], [689, 3429, null], [3429, 6547, null], [6547, 9899, null], [9899, 12983, null], [12983, 15934, null], [15934, 19041, null], [19041, 22593, null], [22593, 24052, null], [24052, 24846, null], [24846, 27982, null], [27982, 28567, null]], "google_gemma-3-12b-it_is_public_document": [[0, 689, true], [689, 3429, null], [3429, 6547, null], [6547, 9899, null], [9899, 12983, null], [12983, 15934, null], [15934, 19041, null], [19041, 22593, null], [22593, 24052, null], [24052, 24846, null], [24846, 27982, null], [27982, 28567, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28567, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28567, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28567, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28567, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28567, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28567, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28567, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28567, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28567, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28567, null]], "pdf_page_numbers": [[0, 689, 1], [689, 3429, 2], [3429, 6547, 3], [6547, 9899, 4], [9899, 12983, 5], [12983, 15934, 6], [15934, 19041, 7], [19041, 22593, 8], [22593, 24052, 9], [24052, 24846, 10], [24846, 27982, 11], [27982, 28567, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28567, 0.07595]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
8f97ea159613cd79df6db514392bdd5b7692992a
|
An Intelligent System for Commercial of Information Products Distribution Based SEO and Sitecore CMS
Bohdan Rusyn[0000-0001-8654-2270], Liubomyr Pohreliuk[0000-0003-1482-5532], Oleg Kapshii[0000-0002-7528-2968], Jarema Varetskyy[0000-0002-7528-2968], Andriy Demchuk[0000-0001-6942-9436], Ihor Karpov[0000-0003-4885-5078], Aleksandr Gozhyj[0000-0002-3517-580X], Victor Gozhyj[0000-0001-8359-2045], Irina Kalinina[0000-0001-8654-2270]
1-4 Karpenko Physico-Mechanical Institute of the NAS Ukraine
5-6 Lviv Polytechnic National University, Lviv, Ukraine
7-9 Petro Mohila Black Sea National University, Nikolaev, Ukraine
rusyn@ipm.lviv.ua, liubomyr@inoxoft.com, kapshii@ipm.lviv.ua, varetskyy@ipm.lviv.ua, Andrii.B.Demchuk@lpnu.ua, shadlksen@gmail.com, alex.gozhyj@gmail.com, gozhyi.v@gmail.com, irina.kalinina1612@gmail.com
Abstract. The purpose of the intellectual system for Commercial of Information Products Distribution Based SEO and Sitecore CMS is to provide unique content based on the personalization approach and the tags use. The object of research is the use of neural networks to create a recommendation tag and marketable personalization tools. The subject of the study will be e-commerce, which is an integral part of e-business. For example, e-commerce or sales, with the help of mobile communication tools, electronic information and advisory services, and others. E-commerce includes, but is not limited to, e-commerce, which involves hosting its own online web resource, with corporate resource management, marketing. Providing a convenient site is key, because online stores can help customers find the things they are looking for in a more versatile way. This allows visitors to manage their own buying experience, which helps to increase customer loyalty and makes them more inclined to return to the site for more purchases, which in turn greatly facilitates trade. The technologies of artificial intelligence will provide customers with better services and individual impressions. They also maximize the marketing efforts of the company, minimizing the need to spend money on ineffective advertising campaigns.
Keywords: Information Resource, Information Products, SEO, Information Technology, Text Monitoring, Information Personalization, Information Products Distribution, Sitecore CMS
Copyright © 2020 for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0).
1 Introduction
Personalization is a method of displaying targeted, relevant content for users based on their characteristics and behavior, such as location, gender, or previous visits [1]. With personalization, you can make sure that the right content reaches the right users, for example by showing, hiding or configuring content [2].
Among other things, you can use personalization to [3]:
- Show other content for users based on their geographic location [4].
- Hide user registration form that has previously filled out the form [5].
- Edit text on a banner website based on a user's site link [6].
2 Substantiation of the Implemented System
2.1 Dynamic Display of Content with Terms and Personalization
Conditional visualization is a piece of content that is displayed when a predefined condition [7]. You can use conditional shades to control how visitors view and interact with the website [8]. Examples of conditional play include [3]:
- Showing other content for visitors based on the rule that checks their geographic location [4].
- Hide the registration form for visitors who previously filled it [5].
- Changing the text on a website banner based on a visitor's site link [6].
Conditional playback is often used as a synonym for personalized content [9]. This, however, is not synonymous personalization [10]. Personalization refers to a broad process of delivering targeted, relevant content to users. Personalization includes both adaptive personalization’s, that is, the dynamic change of the content of the website based on user behavior, and rule-based personalization, which includes the creation and implementation of personalization rules that provide conditional reproduction.

Conditions are set for conditional visualization in "Editor's Rule Set". The set rules editor uses rules based on logic to determine whether the condition is true [11]. You can identify actions such as conditional rendering that takes effect if the condition is valid or occurs. The condition associated with the action is called a rule [12].
You can access the code editor rule from the event editor. You can also access it using the Content Editor and the Marketing Management panel, but usually conditional corrections are created in the experienced editor [3, 13].
**Content profiles** are categories that are defined for tracking user behavior when moving over a website. A content profile can help you understand the behavior, actions, and interests of users. Profile content consists of three main elements [14]:
- Profile keys are attributes of the categories that you want to track;
- Profile values are numeric values assigned to different profile keys;
- Profile cards are the saved profile key combinations and the values that apply to the content.
You can also create personal properties to show typical users who are also assigned profile cards. Users can be used to personalize the rules. Creates content profiles, profile keys, profiles, and people in the marketing center. The profile value for the items is assigned in the experienced editor [15-19].
**Profile keys** describe different aspects of profiles. Assigning profile numeric values to their profile keys, and then using profile values to monitor user interaction with the website. Sitecore has some predefined profiles that already have profiles assigned to them. You can also create your own profile keys [3, 20-23].
**Profile value.** When Users navigate through the website and assign the content profile values that are defined for each item, they visit [3, 24-27]. These values are accumulated, when a user is targeting a site and they help create a contact profile. All the information that users collect about - the pages they browse, the goals they are performing and the way they use it to navigate through the site - will help identify the areas of the website that needs to be refined. You can also use this information for the user segment and create customization rules. This information is for sale. For example, if a user in certain categories has reached a high profile, this may indicate that it is a potential sales opportunity [28-31]. Then you can enter them into the CRM system as a potential buyer or send them an e-mail.
**Profile Cards** contain saved profile keys and profile values. You can use profile cards to assign standard profile values to items on a website [3, 32-34].
**Personalities.** When configuring profiles for content you can create personages. Individuals are fictitious characters that represent certain types of users within the target demographic group. Persons describe life, age, habits, preconditions, interests and the profession of a fictional character who can use the site in a certain way. You can create profile cards that describe the way a person consumes content on a website.
Many business areas are trying to find new ways to debug and personalize. Many can come up with new tests for the system and web-solutions. However, to develop those that will increase the real value of the business, much harder. So, let us look at four examples where different types of businesses have received significant and rapid results through testing or personalization. Each of these methods is a kind of possible
personalization approach. Each of these approaches is based and can be used based on customization and Sitecore available resources Personalization [35-38].
2.2 Testing the result
Answers to the question: What message offer will have the greatest impact? The problem is that the tests, which were the team made, were basic and they did not know much about their segments [1-6, 39-41].
Thus, the team has returned to the A / B Sitecore embedded test to better understand what content is best suited to business results. They checked four options for a homepage suggestion and received the results that you see in the image below [1-6].

One option it was clearly lagging behind, so they took it and continued to test others. It was strange how much the same proposal was changed when the way of submission was changed. In the end, the winner was ahead with a big gap, which allowed the company to begin the strategy of changing the offer for other content with high profitability. It also gave them a vision for shaping upcoming proposals on different channels in order to maximize the impact of personalization [1-3].
**Personalization based on geolocation.** An example may not be the name of a company based in all US states, it wanted to personalize its audience, depending on where they are located. Therefore, they create individual components on key impact pages for the western, central and eastern regions. This is a simple example, but it is also one of the easiest ways to get a quick win. Visitor location can be tracked in real time; because while your content is ready for different cities/countries, you have a personalized personalization solution [1-3, 42-47].
**Personalization based on visitor profile.** In this case, the business can be convinced that on their sites investors are looking at the prospect, investors, job seekers, media professionals and partners visit the site [3]. Thus, the team set up profiles and used predefined categories to determine which group the visitor belongs. Built-in algorithms capture the intentions of individual visitors in real-time when they passed through the content of the site. Then, using the smart personalization of the homepage for each user category, they changed the image of the banner and called for feedback to focus on performance as companies with an individual approach. These
changes not only gave the team more potential customers, but newly defined categories helped them focus their personalization strategy on the rest of the site [48-51].
**Personalization based on the stage of flipping content.** In this example, the company tried to register traffic within its site on the eve of a major event [3]. The team began tracking the movement of early visitors, tracking all of the electronic sections they were interested in before they confirmed their registration on the event. In this way, the team had a clear idea of which sites were weak, where they left the visitors interested but not informed, and were informed, but not motivated to continue. This approach can also be used to create clear personalization strategies based on the visitor's closeness to the registration [52-57].
### 3 Using WordNet Language Database
Home Project WordNet - http://wordnet.princeton.edu, w Dunham is a linguistic database that includes large number synonyms that are associated with each other, are all used for the neural network. I turn on the Brett library and sample programs for this section in the src-jaws-wordnetdirectory in the zip file. WordNet's vocabulary database is a current research project that includes many years of professional linguists. Ownership of WordNet over the last ten years has been easy, mainly using a database for defining synonyms (called sunsets in WordNet) and considering possible parts of a word. We will use open source Java libraries WordNet. There are also good open source client applications for viewing WordNet's lexical database, links on WordNet's website [58-59].
### 4 Assign a Special Profile Value to the Element
When visitors are moving through a website, they are assigned profile values that we have identified for each item they visit [1-3]. These values are accumulated when a visitor navigates the site and they help create a visitor's profile [1]. Usually, profile cards or saved set of profile values are used to apply profile values to content. However, some items may not match the profile card you created. In this case, you can assign special profile values for this item. You can also assign custom profile values to multiple items at once with the search function in the content editor [1].
Please note that only special profile items can be assigned, if the "Select profile" dialogue box is set to "Lone" in the "Authorization option" field [1].
To set custom profile values for a content item, you need [1]:
1. In editor of experience go to the page element or content to which you want to assign a profile value.
2. In the Optimization group on the Profile Settings tab, you need to click Connect Profile Maps.
3. In Find the profile key, you want to select and click on the profile editor Edit.
4. On the Select Profile Link tab, click the Customize button to activate the settings. This allows you to create a custom profile card.
5. In the section, Settings Click the drop-down arrow for each profile and select the values that you want to assign to the content item.
6. To save the changes and assign the selected profile values to the content item, click the button OK.
5 Assign a Special Value to a Profile for Multiple Items
To assign a custom profile value to several items [1]:
1. You need to select an object or product.
2. In the search box enter * to get all the items on the list.
3. Click the drop-down arrow to the left of the search box and select "Search Operations".
4. In the "Search Operations" section, click the Apply Profiler button.
5. In the Profile Cards window in the Settings section, click the drop-down arrow for each profile and select the values that you want to assign to the content elements.
6. You need to click the button to save the changes and assign the selected profile values to the content elements OK.
6 Withdrawal Object from the Text
In this section, we will look at the names of people and places in the text [1]. This can be useful for automatically adding news tags to people and the names of the places contained in the articles. The feature for identifying names and places in the text is the data in the test file data/propername.seris a special Java data file containing hash
tables for people and places names. These data are read in the constructor of the Names class:
The value of hash tables is used as follows:
```java
while (keySet.hasMoreElements()) {
Object key = keySet.nextElement();
System.out.println(key + " : " + placeNameHash.get(key));
}
```
Which will deduce the following:
- Mauritius : country
- Port-Vila : country_capital
- Hutchinson : us_city
- Mississippi : us_state
- Lithuania : country
The following example uses the isPlaceName, isHumanName, and getProperNames methods:
```java
System.out.println("Los Angeles: " + names.isPlaceName("Los Angeles"));
System.out.println("President Bush: " + names.isHumanName("President Bush"));
System.out.println("President George Bush: " + names.isHumanName("President George Bush"));
System.out.println("President George W. Bush: " + names.isHumanName("President George W. Bush"));
```
Here is the code to search for verbose names:
```java
public boolean isPlaceName(String name) {
return placeNameHash.get(name) != null;
}
```
Versions of these APIs that handle names containing a few words are a bit more complex, we need to construct a string of words between the initial and final indexes and check if this new line value is a valid key in the hash tables of people names or place names. Here is the code to search for verbose names:
This same scheme is used to check the verbose names of people. The top-level `getProperNames` utility is used to search for human and local names in the text. The code in `getProperNames` is easy to understand.
7 Example of Use WordNet Libraries
An example of a WordNetTest class finds different word values for a given word and prints this data to standard output. We modify this code somewhat in the next section, where we will combine WordNet with the part of the speech tag in another example program. Access to WordNet data using Brett’s library is simple, so we will spend more time actually looking at the WordNet data itself. Here is an example of an application that shows how to use the API. Class designer connects to WordNet data files for reuse:
```java
public WordNetTest(){
database = WordNetDatabase.getFileInstance();
}
```
Here JAWS method returns speaker to synonyms:
```java
public List<Synset> getSynsets(String word){
return Arrays.asList(database.getSynsets(word));
}
```
```java
public static void main(String[] args) {
PropertyNames constant . DIRECTORY is equal to "wordnet.database.dir". It's a good idea to make sure you have this Java property set, if the value is displayed as zero, fix the way to set up Java properties or just install it:
```
System.setProperty(PropertyNames.DATABASE_DIRECTORY,
"/Users/markiv/temp/wordnet3/dict");
wordNetTest tester = new wordNetTest();
String word = "bank";
List<Synset> synset_list = tester.getSynsets(word);
System.out.println("\n" + "Process word: " + word);
for (Synset synset : synset_list) {
System.out.println("\nsynset type: " +
SYSET_TYPES[synset.getType()].getCode());
System.out.println(" definition: " + synset.getDefinition());
// word forms are synonyms:
for (String wordform : synset.getWordForms()) {
if (wordform.equals(word)) {
System.out.println(" synonym: " + wordform);
}
}
System.out.println("\n");
}
private wordNetDatabase database;
private final static String[] SYSET_TYPES = {"", "noun", "verb"};
Using this example of the program, we can see that the word "bank" has 18 different "values", 10 nouns and 8 verbs:
Worked word: bank
Synset type: noun
Definition: sloping land (especially the slope beside a body of water)
Synset type: noun
Definition: a financial institution that accepts deposits and channels
the money into lending activities
Synonym: depository financial institution
Synonym: banking concern
Synonym: banking company
Synset type: noun
Definition: a long ridge or pile
Synset type: noun
Definition: an arrangement of similar objects in a row or in tiers
Synset type: noun
Definition: a supply or stock held in reserve
for future use (especially in emergencies)
Synset type: noun
Definition: the funds held by a gambling house
or the dealer in some gambling games
Synset type: noun
Definition: a slope in the turn of a road or track; the outside is higher than
the inside in order to reduce the effects of centrifugal force
Synonym: camber
Synonym: camber
As an example in this work, we will use 2 and 3 approaches and define in Sitecore CMS some of the rules for the system. To do this, use the Sitecore Rule Set Editor. It is a tool that applies the rules of logic to control the content. The rule set editor can be used to create a conditional rendering for personalization and contact management. The correct editor has three basic elements: terms, actions and rules. The ruleset editor combines the action conditions to create rules that can be used to personalize, run scripts, create steps in interaction plans, and more.
8 Implementation of personalization in Sitecore
As an example in this work, we will use 2 and 3 approaches and define in Sitecore CMS some of the rules for the system. To do this, use the Sitecore Rule Set Editor. It is a tool that applies the rules of logic to control the content. The rule set editor can be used to create a conditional rendering for personalization and contact management. The correct editor has three basic elements: terms, actions and rules. The ruleset editor combines the action conditions to create rules that can be used to personalize, run scripts, create steps in interaction plans, and more.
**Terms** consist of logical statements that determine whether the condition is true. For example, the place where an item is blocked by me is true if I blocked this item. Sitecore has a number of default terms that you can use, but you can also apply your own terms. We use the location of the user, we will determine the country of origin.
**Actions** are logical steps that are performed when one or more conditions in the rule are true. For example, you can enter a condition for registered contacts that hides the registration form if it has been filled in before. Usually is created actions that implement the conditional playback of a website for contacts that meet the criteria of the condition. You can also specify actions that hide or show content if the condition is fulfilled. Sitecore has a number of actions by default, but you can also implement your own actions. In our example, let's put the content of the blocks on the home page. And based on this and the previous item create item.
Rules bind one or more actions with one or more conditions. To do this, you need to define your terms and conditions before the rule can be implemented. You can also use logical operators such as 'and' and 'or' to create a combination of several conditions and actions. For example, you can create a rule that hides a content item from contacts in North America. The terms of this rule check the geographic location of the contacts, as well as if they are from the US, Canada or Mexico, the relevant pages of the website will not be displayed. After several passes through the website, you can see page transitions in the following chart:

Fig. 9. Output statistics for collecting information on user profile and its navigation on site [1]
Profiles creation opportunities are theoretically unlimited. After using the Chrome browser as one unique client, and purchasing activity on the site, we will review the results of the user profile.

Fig. 10. Output statistics for user profile activity [1]
In general you’ve decided to define these profiles; it depends heavily on the sector. It should always ask yourself the question, which relates to your customers, which is the functional possible and practically possible.
In a practical example, the above is as follows:
- Let's give you an example of a short article for learning the neural network:
Fig. 11. An example of an article that is presented as input data for the study of the neural network AutoRecommendTags.exe
- Let's launch the AutoRecommendTags console program .exe to teach the neural network to get the source data in the form of a table of proximity to the list specified in the tag system for content:
Fig. 12. Intermediate Neural Network Learning Outcomes
- Let's evaluate the source data:
9 Conclusions
The system of commercial distribution of information products in the future will be able to bring real income to its owner, which will be in demand among users of the World Wide Web. It should also be noted that the topic of Internet commerce in the context of e-business is more than ever relevant in our time, the time of rapid development of information technology, as to me the future of commerce on the Internet. It is already very popular to order any copyrighted information products. Therefore, who will understand this trend in the market of commerce in general, and will successfully be able to fit into it - will receive serious dividends.
References
1. Sitecore Documentation: Access all the latest Sitecore documentation. Available at: https://doc.sitecore.com
|
{"Source-Url": "http://ceur-ws.org/Vol-2604/paper52.pdf", "len_cl100k_base": 5044, "olmocr-version": "0.1.49", "pdf-total-pages": 18, "total-fallback-pages": 0, "total-input-tokens": 42518, "total-output-tokens": 10037, "length": "2e12", "weborganizer": {"__label__adult": 0.00037789344787597656, "__label__art_design": 0.0007638931274414062, "__label__crime_law": 0.0004489421844482422, "__label__education_jobs": 0.002910614013671875, "__label__entertainment": 0.00018036365509033203, "__label__fashion_beauty": 0.00022172927856445312, "__label__finance_business": 0.01013946533203125, "__label__food_dining": 0.00038051605224609375, "__label__games": 0.0008168220520019531, "__label__hardware": 0.0010747909545898438, "__label__health": 0.0004301071166992187, "__label__history": 0.00033926963806152344, "__label__home_hobbies": 0.00015473365783691406, "__label__industrial": 0.000579833984375, "__label__literature": 0.0004925727844238281, "__label__politics": 0.00033354759216308594, "__label__religion": 0.00036215782165527344, "__label__science_tech": 0.06781005859375, "__label__social_life": 0.00014412403106689453, "__label__software": 0.1104736328125, "__label__software_dev": 0.80078125, "__label__sports_fitness": 0.00019156932830810547, "__label__transportation": 0.000522613525390625, "__label__travel": 0.0002701282501220703}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 36199, 0.02341]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 36199, 0.25013]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 36199, 0.8051]], "google_gemma-3-12b-it_contains_pii": [[0, 2450, false], [2450, 4207, null], [4207, 7751, null], [7751, 10157, null], [10157, 12862, null], [12862, 13712, null], [13712, 14387, null], [14387, 15734, null], [15734, 17027, null], [17027, 18782, null], [18782, 19978, null], [19978, 20982, null], [20982, 22372, null], [22372, 22786, null], [22786, 25205, null], [25205, 28925, null], [28925, 32614, null], [32614, 36199, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2450, true], [2450, 4207, null], [4207, 7751, null], [7751, 10157, null], [10157, 12862, null], [12862, 13712, null], [13712, 14387, null], [14387, 15734, null], [15734, 17027, null], [17027, 18782, null], [18782, 19978, null], [19978, 20982, null], [20982, 22372, null], [22372, 22786, null], [22786, 25205, null], [25205, 28925, null], [28925, 32614, null], [32614, 36199, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 36199, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 36199, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 36199, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 36199, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 36199, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 36199, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 36199, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 36199, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 36199, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 36199, null]], "pdf_page_numbers": [[0, 2450, 1], [2450, 4207, 2], [4207, 7751, 3], [7751, 10157, 4], [10157, 12862, 5], [12862, 13712, 6], [13712, 14387, 7], [14387, 15734, 8], [15734, 17027, 9], [17027, 18782, 10], [18782, 19978, 11], [19978, 20982, 12], [20982, 22372, 13], [22372, 22786, 14], [22786, 25205, 15], [25205, 28925, 16], [28925, 32614, 17], [32614, 36199, 18]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 36199, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-25
|
2024-11-25
|
8e203332deac181c317378039f65ce7a88acaae1
|
Service and Resource Discovery Supports over P2P Overlays
Emanuele Carlini
IMT Lucca, Italy, and ISTI-CNR
Pisa, Italy
e.carlini@isti.cnr.it
Massimo Coppola, Patrizio Dazzi,
Domenico Laforenza, Susanna Martinelli
Institute of Information Science and Technologies ISTI-CNR, Pisa, Italy
{m.coppola, d.laforenza, p.dazzi, s.martinelli}@isti.cnr.it
Laura Ricci
Computer Science Dept.
University of Pisa, Italy
ricci@di.unipi.it
Abstract—We describe the main architecture and the design principles of the Service/Resource Discovery System (SRDS), a component of the XtreemOS Operating System. XtreemOS is a Linux extension that enables management and exploitation as single platform of computational resources provided by federated Virtual Organizations. The SRDS provides scalable and fault-tolerant directory services supporting many of the platform functionalities, ranging from dynamic resource location and job control to system and application-oriented directory services.
The key challenge of the SRDS design is to provide the common metaphor of the directory service, meeting the scalability requirements of a Grid-aware Operating system, and at the same time enjoy extendability and configurability, especially with respect to the quality of service provided. The SRDS design combines different peer to peer structured overlay networks, exploiting their peculiar strengths. We describe the implementation and our design of the namespace abstraction as implemented on top of multiple overlay networks. Finally, we show test results of the SRDS on top of a subset of the Grid5000 platform.
I. INTRODUCTION
Exploiting a large amount of geographically scattered computing resources has been made technically feasible in recent years, thanks to the development effort spent in the Grid communities [1]. Nevertheless, daily exploitation of more and more distributed resources in a dynamically changing environment quickly becomes unpractical, due to the number of low-level tasks that have to be performed.
XtreemOS (http://www.xtreemos.eu, [2]) is a research project funded by European Commission, aiming at producing an Open-Source, Grid-enabled Operating System. The XtreemOS approach consists in developing a whole Operating System abstraction layered on top of the computing resources, so that the end-users no longer need to confront with middlewares. POSIX applications shall be transparently run over remote resources, and a specific API is available to developers willing to exploit the advanced services provided by the platform in Grid-aware applications.
XtreemOS goes beyond the experiences made with Grid middlewares and looks at the concrete challenges presented by scalable management of large computational platforms, dispersed among countless administrative domains. XtreemOS goal is to exploit the convergence of results in the SOA and Cloud computing research fields. In forming Virtual Organizations (VOs), XtreemOS allows to federate resources from multiple institutions and that spread over geographic networks. Large clusters, single workstations as well as mobile devices can cooperate through a common security and authorization infrastructure [3].
It is obvious that such a system has to provide efficient interconnections across its components, and allow the exploitation of individual system nodes hiding the effects of scale. Providing highly available and scalable mechanisms that allow communication, information spreading and retrieval is one of the tasks of the project. This includes the implementation of the Service/Resource Discovery System (SRDS), a directory service with resource location features suited to multi-VO environments.
Peer-to-peer (P2P) networks are almost a perfect match for these requirements, as they sport fault tolerance, scalability, low overhead. While their adoption is straightforward, exploiting them efficiently in the general case is less obvious. The SRDS has several kinds of clients, both modules of XtreemOS and applications, and a varied set of tasks (e.g. locating resources, providing...
generic directory services, range-based and multidimensional constrained queries).
No single P2P approach can cope with the diversity of requirements, and still provide always the optimal tradeoff. This is especially true as in some cases the balance between the acceptable overhead and the functionalities needed is also application-dependent. In order to provide extensibility (ease to support new XtreemOS modules) as well as configurability (allow modules and applications to choose the best tradeoff) we designed the SRDS architecture following a layered approach, where the upper layer is a facade module used as an “extendible API”, the intermediate layer allows to modularize the retrieval algorithms, and the lower layer integrates under a common abstraction different P2P overlays.
In section II we discuss related results in the literature. The rest of the paper is structured according to the SRDS architecture: in section III we define the ADS structure, section IV defines the information management level and section V describes the DHTs used in the current SRDS implementation. We then discuss in section VI the namespace feature we adopted and its implementation strategies within DHT overlays. Section VII outlines the range-query support we have developed, which exploits an optimized publication algorithm, section VIII follows with preliminary performance results on a Grid platform. Section IX summarizes our contribution and outlines our development roadmap and future research work.
II. RELATED WORK
Several proposals for P2P platforms exploiting a large amount of geographically scattered computing resources have been presented in recent years. OpenDHT [4] is a large scale Distributed Hash Table, deployed on the Planet Lab platform, a geographically dispersed volunteer-based computing platform. OpenDHT tackles several challenging problems related to the definition of a DHT service on a massively distributed computing infrastructure as basic service shared among a large number of different applications and services. The cited work introduces the concept of namespace to distinguish data from different services/applications. It implements namespaces by embedding a two dimensional quadtree in the underlying Bamboo DHT. Further issues are the definition of a proper authentication support for the nodes joining the DHT, as well as defining a fair allocation policy of the DHT storage among competing clients and a mechanism to prevent client starvation.
The work [5, Jin et al.] proposes a directory service built over the Chord DHT infrastructure which acts as a rendezvous network connecting multiple VO on a Grid. Only a single node of each VO can become a DHT node, and acts as a bridge to link the local VO into the DHT ring. The DHT Proxy mediates between the local VO and the remote ones by publishing and deleting information from the dispersed repository, as well as by performing queries across VOs.
Some recent proposals mix structured and unstructured overlay networks to define a directory service support. For instance in the PARIS semantic overlay network [6] local groups of peers are organized in an unstructured overlay. In each group, the peers with the best connectivity are selected to join a DHT which enables communication between peers belonging to different groups.
The problem of defining of a hierarchy of namespaces within a flat DHT is strictly related to the definition of the SRDS developed within XtreemOS. Several proposals [7]–[11] of embedding structures within a flat DHT like Chord [12] or Pastry [13] have been recently presented. Diminished Chord [9], introduces subgroups in the Chord ring by embedding a binary tree in the Chord ring. A simple interface is defined to join a subgroup identified by X and to search a key within X. Crescendo [10] divides the identifier assigned to each node into a suffix which identifies a namespace and a prefix defining the identity of the node within the group of peers identified by the namespace. The choice of the suffix to identify namespaces enables the definition of a hierarchy within the DHT without renouncing to the properties of flat DHTs, like load balancing and uniform distribution of the peers. Crescendo [7] defines a hierarchical DHT over a Chord ring where logical hierarchy of nodes reflects their partitioning into different groups.
Along with namespaces management, the definition of a support for range queries is another key aspect of the SRDS. Some proposals exploit Space Filling Curves [14] to map points from a d-dimensional space of attributes over a flat 1-dimensional space, other ones are based on the definition of hierarchical structure over the DHT. Last but not least, there are approaches are based on the linearization of data by means of a locality preserving hashing function [15]. As shown in Sect VII, the SRDS exploits the last approach and develops it further.
III. THE ADS ARCHITECTURE
In order to address the challenges we mentioned in the Introduction, we designed and implemented the Service/Resource Discovery System (SRDS): a coherent framework for providing directory services which also
supports resource lookup and exploitation. In this Section we present the SRDS overall architecture giving a bird-eye-view of its main components and of the interactions between them. The main contribution of the SRDS to XtreemOS consists in providing to applications and system components general-purpose directory services which include the capability of searching for and selecting services and computational resources. SRDS performs a wide range of different tasks, ranging from simple key-based queries to range-based queries over dynamic attributes, while providing a storage service level (e.g. reliability) that is customizable according to the needs of each XtreemOS module that is an SRDS user. The submitted queries can be hard to resolve, as they can potentially involve range constraint over attributes, dynamic information on resources, and multiple fitting criteria expressing the user needs.
The problem is particularly challenging, indeed. If on the one hand efficient implementations of simple directory service functionalities over very large set of nodes are thoroughly studied, on the other hand the possibility to formulate/invoke more complex queries is still considered an open research issue. This is especially true when dynamically variable information has to be managed.
In order to allow efficient management of such a wide range of queries, the SRDS is designed to exploit a combination of different P2P approaches, so to grant the best implementation tradeoff in each situation and not to be restricted to any single solution.
The architecture is layered and modularly decomposed. From the development point of view, the two main modules are the Application Directory Service (ADS), and the Resource Selection Service (RSS). The SRDS module is in charge of most of the query pre-processing and controls a configurable set of DHT overlays, while the RSS provides a P2P overlay specifically designed [16] to allow scalable resource location in large overlays. Both the ADS and the RSS overlays are established on the set of computing resources managed by the SRDS, each machine generally belonging to several overlays.
A. Architecture Layers
The overall architecture and the SRDS and ADS functional layers are depicted in Figure 1. We will not discuss in depth the upper Facade layer, whose purpose is to provide easy-to-extend multiple interface protocols, including Java-RMI, HTTP and DIXI developed inside XtreemOS project. DIXI, based on the SEDA protocol, is an event-driven communication framework, allowing intra-service communication that is independent from service implementation. Some of these protocols are routinely employed in the XtreemOS system, other ones, like RMI, are solely used for testing and debugging purposes.
The intermediate Query-Provider (QP) layer contains a set of modules devoted to query translation, that implement the complex functionalities needed by the users in terms of simpler primitives provided by the overlay managing libraries. By providing interpretation algorithm, we can afford to implement arbitrarily complex functionalities, beyond those provided by the particular P2P overlays that we exploit. An example of complex functionality is the Job Directory Service (JDS), a directory service for XtreemOS applications running on the grid. The JDS is implemented as a set of data structures within a basic DHT, and the algorithms managing the queries (direct and indirect ones) as well as updates to those structures belong to the Query-Provider layer.
The main purpose of keeping Job information within an overlay is to decentralize and decouple it from any specific machine. DHT built-in replication and the design of the Job management System (JMS) protect from resource and JMS faults, and allow transparent migration of job control across different JMS instances (e.g. taking over application steering from XtreemOS mobile devices).
Another example is the mechanisms employed to locate resources within the platform, which is explained later in this section.
Below the previous level we find two main modules providing actual data access. The Information Management layer provides a common interface to DHT-like overlay networks. This layer is described in Sect. IV, and beside constituting a common interface to create, configure and access different overlays, it also provides a Namespace abstraction on top of (multiple) DHTs. The DHTs currently employed in XtreemOS are described in
The second module in this layer, and the second main component of the SRDS, is the RSS, a hierarchically structured overlay network developed within the XtreemOS project. The RSS is described below.
B. Main SRDS Blocks
Overall, we can see that the ADS is heavily modularized and targeting complex functionalities over dynamically changing attributes (e.g. free memory), employing “flat” P2P overlays to store information. On the contrary, the RSS has been designed to manage constant-value attributes (e.g. memory installed on a machine) with very high scalability in a large overlay. The SRDS merges these two profiles in order to maximize its efficiency, in particular to address the resource location problem in a scalable way. Being a performance-critical operation, resource location queries are executed as a two-phase information selection process, in which the RSS and the ADS respectively act as a “machete”, which quickly cuts away most unfitting resources, and a “bistoury” that carefully removes those violating more complex requirements and dynamic constraints.
a) RSS: The RSS answers to multi-dimensional range queries over static attributes, returning a list of resources identifiers that match the query. By static we mean a small set of constant-valued attributes, known at overlay initialization time. On the contrary, it is foreseen that resources may leave (e.g. due to failures) and join the platform dynamically. The query is performed by a specifically designed, structured P2P overlay and a matching distributed search algorithm. A full description of the approach, developed at the Vrije Universiteit Amsterdam, as well as its validation are reported in [16]. In contrast with other P2P approaches that rely on delegation of resources, in RSS each node represents its own attributes in the overlay. The solution enjoys properties that speed up basic resource location. There is no replication overhead and no possible data inconsistency (e.g. when rebooting after an hardware upgrade). Node failures need not be accurately detected by other nodes, and no specific repair operation overhead is necessary to reconstitute the overlay. The query algorithm is designed to avoid creating imbalanced workloads. The result of a query is a large set of resource identifiers, larger by a specified fraction than the amount of resources needed to satisfy the query.
b) ADS: Beside simple query primitives to filter out the RSS results or DHT-like access, ADS provides specific access functions, that are tuned to solve range queries over dynamic resource attributes. Dynamic attributes are those that can dynamically change their values, like CPU load. Queries contain predicates over the static and dynamic attributes of the resources (e.g. we want a certain set of software and hardware resources to be currently available at the site). Solving range queries over dynamic attributes is inherently less scalable than answering queries about static values. Extensions of Distributed Hash Table (DHT) techniques and to dynamic attributes and complex queries are employed. However, in order to improve the efficiency of the refining selection process, the ADS exploits a problem-size reduction, leveraging the candidate set for the query that is provided by the RSS. Once the set of candidates has been narrowed acting on basic attributes, it is feasible to exploit DHT-based techniques to apply the more complex constraints. The ADS can also create an application-specific “directory service” using the resource identifiers received by the RSS, those related to the resources (possibly) involved in the application execution.
IV. INFORMATION MANAGEMENT LAYER (IML)
The interface of the Information Management Layer (IML) is the common ground for DHT operations within ADS. The IML maps operations received by the higher level modules to concrete ones, providing a DHT layer interfaces that hides implementation peculiarities of each overlay. In particular, the IML is required to map the abstract concept of namespace (a user-allocated separate space of keys) to the DHT layer.
Consider the abstract operations received by the IML layer:
\[ \text{operation}_{QP} = \{ \text{op}, \text{key}_M, \text{value}_M, \text{Nspace}, \text{ClientType}, \text{ClientId} \} \]
At the IML level the namespace (Nspace) holds all information that, at the more abstract levels, might have been conveyed by any parameter for the sake of disambiguating the meaning of the key. The namespace defines thus the context in which the key is used, making explicit information that is implicit in the SRDS primitive invoked, in the client type or identity.
The specific name space is provided by the calling QP module (in charge of the SRDS primitive invoked by the user). Different ways of implementing the key spaces at the DHT layer will be discussed in the next section.
The abstract operation is mapped to a concrete operation of the DHT layer defined as follows:
operation$_{DHT}$ = \{ op, key$_D$, value$_D$, auxInfo \}
While value$_M$ is directly mapped to value$_D$, because values are provided by upper level modules and go uninterpreted in IML, key translations may happen as a result of namespace implementation. For instance, to ensure uniqueness of key$_D$ in the DHT space it may be defined by a concatenation of the namespace unique id, the actual key, and a unique ID function of the client, thus providing client separation properties whenever needed. When client separation is not needed, the ClientType and ClientId information is not exploited.
The auxInfo field provides hints to the DHT implementation about the best tuning of the overlay, whenever the tuning can be performed dynamically. It encodes inferred information from the namespace and the other parameters about the hash functions, data expiration timeouts and so on (e.g. some DHTs provide authorization mechanisms by means of user-defined secrets).
V. DHT IMPLEMENTATIONS
The DHT layer hosts different DHT implementation libraries providing low-level support for both the basic functionalities defined by the IML layer, like put/get operations. The DHT layer also wraps and provides non-standard features like namespaces, implementation details of secret-based authentication and expiration of requests. This level has to allow a certain degree of customization, concerning for instance the hash function used, or the replication degree. Customization is needed in order to tune the DHT for different usage patterns, and to enable the ADS to support complex queries and dynamic attributes. We first describe the two DHT supports currently adopted in the ADS implementation, and in the next sections we describe the solution exploited by the ADS to support namespaces and multi attribute range queries.
A. Scalaris
Scalaris [17] is a P2P overlay that offers transaction-based access to the basic DHT operation. Transactional behaviour is useful when criteria of atomicity are needed to ensure data consistency. For example, the internal DHT key space that register namespaces inside SRDS must be updated avoiding concurrent interferences. The Scalaris internal architecture is also layered. A low-level DHT provides basic put and get, a second layer on top provides availability of data by symmetric replication. Symmetric replication partitions nodes into classes and distributes same item replicas always on nodes of different classes. A third layer implements ACID transactional data accesses on groups of read and write operations.
B. Overlay Weaver
Overlay Weaver (OW, [18]) is an implementation of various P2P overlays which aims at separating high level services such as DHT, multicast and anycast from the underlying key-based routing (KBR) level. The OW routing layer architecture follows the KBR concepts but leaves behind the KBR monolithic approach, decomposing the routing layer in a set of independent modules, (e.g. communications, routing and query algorithms). The routing module is defined by three layers: the routing layer (bottom), the service layer and the application layer (top).
VI. NAMESPACE SUPPORT WITHIN THE ADS
As far as it concerns the namespace implementation, two different approaches may be adopted. They are sketched, with reference to the Chord DHT [12], in Fig.2. The two approaches can also be merged to achieve a better tradeoff.
In the implementation of Figure 2(a), a single DHT is used to implement the IML functionalities. Providing a separate instance of the ADS for each application is still possible, as more instances of the ADS can share the local DHT ring instance. In this case, namespace information is used to dynamically select hashing and replication characteristics for the given set of keys. We can map namespaces to additional parameters of the DHT implementation that optimize its behaviour, provided that the DHT allows us to dynamically choose...
those parameters. An example is tuning the hash function
to enhance support of range queries, e.g. by choosing a
linear affine function, or a space filling curve mapping,
in order to map locality for a given set of keys to locality
over the DHT overlay.
As a concrete example of a single ring supporting multiple
spaces, let us consider a distributed directory storing the network coordinates of the nodes of the
system. Network coordinate embedding systems [19]
embed latency such as Round-Trip-Times between nodes
into some geometric space so that unmeasured RTTs can
be estimated using distance computation in that space.
The network coordinates of each are stored by the ADS
in the underlying DHT, which should support both direct
and inverse queries. The QP module managing the task
defines three distinct namespaces: IP, X and Y. The first
one enables to retrieve the network coordinates paired
with a node whose IP is known. The X and Y namespaces
support inverse queries where the Key is respectively
the value of the X and Y coordinate of the host in the
cartesian space. Inverse queries are submitted by nodes
searching for their nearest neighbours in the networks,
where the neighborhood is proportional to the estimated
latency. A mechanism to support range queries is defined
in these namespaces, in order to support those queries
and find all the hosts belonging to a portion of the
cartesian space.
The main drawback of a single-ring based solution is
that it will not be possible to tune all of its parameters ac-
cording to the namespaces, e.g. P2P ring repair strategies
will have to be common. An alternative solution is shown
in Figure 2(b) where a different ring is paired with each
namespace. Ring creation can happen on-demand, and all
parameters and policies of the DHT ring are customized
for its specific use at ring set-up time, that is when that
specific overlay network is created. In XtreemOS, rings
dedicated to essential key spaces always remain active,
while smaller rings supporting application specific tasks,
or temporary Virtual Organizations, can have a shorter
lifespan (that of an application or a VO) as well as a
lower initialization cost. In this solution the required
amount of state and communication effort scales linearly
with the number of rings. The need of running intensive
communication protocols independently for each applica-
tion would lead to a significative waste of bandwidth.
The current version of the ADS merges the two
approaches, and exploits two different rings, one based
on Scaleris and one on the Chord DHT [12] provided by
Overlay Weaver [18]. A set of namespaces can be defined
on the same DHT, although in the current version of the
system the namespaces are still statically defined.
VII. RANGE QUERIES WITHIN ADS
The ADS supports multi attribute range queries by
exploiting the REMED approach [20], based on the
MAAN approach [15]. MAAN builds up a publication
and query mechanism over a Chord DHT [12]. A data
object published by the ADS is defined as a collection
of attribute-value pairs. Each attribute is coupled with a
function that maps values to keys in the DHT space.
Following [15] the key is obtained using a static
locality preserving hash function, and the publication
process is based on replicas of the same object to be
stored under the keys of all its attribute values.
A provider node publishes a data object, described by
a set of attributes values \((a_1, v_1)\ldots(a_k, v_k)\), by inserting
in the DHT ring the whole object description, for each
different attribute \(a_i\), at the position given by \(H(v_i)\).
Hence object descriptors are spread and replicated into
the overlay by a factor equal to the number of attributes.
A generic multi-attribute range query is structured like
a set of pairs attribute-constraint. Each constraint is a
range of values the attribute must lie within.
Given an attribute constraint \([l, u]\), the resources that
satisfy it lie in the contiguous portion of DHT space,
bounded by \(H(l)\) and \(H(u)\), as a consequence of \(H\)
being a locality preserving hashing function.
The constraint corresponding to the smallest portion
of DHT space is called the most selective, and its attribute,
called dominant. If \([l, u]\) is the range associated to the
most selective constraint, in order to resolve a lookup
query the query is first sent to the node managing \(H(l)\)
(the lower bound value). The request is then forwarded to

the nodes in the range \( H(l) \) to \( H(u) \), traversing them all and accumulating on the way the identifiers of resources that satisfy all query constraints. When the query reaches the node handling \( H(u) \), the set of matches computed for the query is returned to the query initiator.
We developed the REMED optimized approach [20] on top of the MAAN basic publication/query process, to be applied in the ADS resource location to enhance the handling of dynamic attributes. Two optimizations of the basic publication/query process has been defined.
The first REMED optimization pairs each node with a soft-state cache of the routing results obtained during the publication phases. We reuse routing results discovered in previous iterations to reduce the number of messages over the network. In figure 3 we see that with respect to the standard MAAN approach, REMED collects through reply messages from target nodes that allows to skip routing for attribute values managed by recently visited nodes.
The second strategy defines the popularity of an attribute as the frequency with which it is chosen as dominant. The popularity of a published object, that is its the popularity according to its attribute values, strictly depends on the distribution of queries submitted to the system. As a consequence, the popularity of attribute values can also vary during system lifetime.
We defined a dynamic adaptive solution, where we update with lower frequency resources associated with low popularity attributes (i.e. rarely used in query resolution), and continuously refine popularity estimates in a distributed fashion. Popularity is estimated locally at target nodes, and gathered by caching information provided by the target nodes via reply messages, see figure 3. Cached information is then exploited according to the temporal locality of the dynamic attributes.
For example, if we consider a scenario where an unique attribute is dominant for all the queries, the updates for all the other non-dominant attributes become useless. As a more concrete case, updates are less frequent for those replicas which are rarely used because of the values of some of their attributes. On a large platform, machines with a small memory installed are likely to be unpopular, but if many queries start to concentrate on them, they will be updated in a more and more timely manner.
VIII. EXPERIMENTS
The SRDS, along with all its subcomponents, with the exceptions of Scalaris, is implemented in Java. Java is a suitable from a performance standpoint, as the main overhead is due to network latencies, and it ensures straightforward compatibility with other Java-based XtreamOS components surrounding the SRDS, including the RSS and the DIXI framework.
SRDS has been extensively under testing since soon after the beginning of the XtreamOS project. We tested SRDS on a range of different platforms. Simulations of thousands of nodes have been done for evaluating the range-query resolution algorithm [20]. The whole SRDS has been tested both on small-size clusters and over Grid5000 platform, with up to 500 nodes on several sites across France. Tests have regarded both extensive latency measurements and functionality validations.
Figure 4 shows the SRDS behaviour when all nodes provide information every 30s, and a large fraction of them run queries every 100ms. Nodes belong to one or two different clusters of the same Grid5000 site.
To further test the scalability of the SRDS we measured the latency of a subset of JDS operations (Figure 5). Here nodes belong to two different clusters of a Grid5000 site. The complexity of the measured opera-
tions varies, but is rather homogeneous, e.g. RequestJob is a single DHT get, while AddJob requires a sequence of put/get operations. The test has been repeated with different network sizes and the time interval between each request is 200 milliseconds. The measurements include also the delay of the RMI interface (implemented in the ADS Facade) used to deliver requests to single nodes. Along with the JDS data, all the nodes performed publications of different data over the DHT at a fixed rate (every 30 seconds), in order to realistically simulate a loaded overlay.
IX. CONCLUSIONS AND FUTURE WORK
We described SRDS, the service and resource discovery support developed for the XtreemOS [21] distributed operating system. It provides scalable and customizable information query support over large platforms, exploiting a combination of different P2P approaches to enhance flexibility and run-time configurability of the system.
We are currently evaluating the functionalities of SRDS for different XtreemOS clients and on large computing platforms. We plan to investigate a set of solutions for the the dynamic creation of namespaces, leveraging the transactional features of the Scalaris DHT. We also plan to study further strategies for the support of multi-attribute range and neighborhood queries, both with respect to efficiency and to the use of customized hashing functions to improve query performance and load balancing.
ACKNOWLEDGMENT
The authors acknowledge the support of Project FP6-033576, Building and Promoting a Linux-based Operating System to Support Virtual Organizations for Next Generation Grids (2006-2010).
REFERENCES
|
{"Source-Url": "http://hpc.isti.cnr.it/~dazzi/pdf/Carlini09ICUMTsrds.pdf", "len_cl100k_base": 6602, "olmocr-version": "0.1.49", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 27035, "total-output-tokens": 8518, "length": "2e12", "weborganizer": {"__label__adult": 0.00030517578125, "__label__art_design": 0.0004456043243408203, "__label__crime_law": 0.00039005279541015625, "__label__education_jobs": 0.00083160400390625, "__label__entertainment": 0.00014734268188476562, "__label__fashion_beauty": 0.00017309188842773438, "__label__finance_business": 0.0006051063537597656, "__label__food_dining": 0.0003609657287597656, "__label__games": 0.00069427490234375, "__label__hardware": 0.001979827880859375, "__label__health": 0.0005397796630859375, "__label__history": 0.000518798828125, "__label__home_hobbies": 0.00011074542999267578, "__label__industrial": 0.0005807876586914062, "__label__literature": 0.0003387928009033203, "__label__politics": 0.0004303455352783203, "__label__religion": 0.0005173683166503906, "__label__science_tech": 0.27685546875, "__label__social_life": 0.00014519691467285156, "__label__software": 0.0562744140625, "__label__software_dev": 0.65673828125, "__label__sports_fitness": 0.0002276897430419922, "__label__transportation": 0.00058746337890625, "__label__travel": 0.0003216266632080078}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 37239, 0.0089]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 37239, 0.41717]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 37239, 0.89235]], "google_gemma-3-12b-it_contains_pii": [[0, 4070, false], [4070, 9228, null], [9228, 13703, null], [13703, 18672, null], [18672, 22605, null], [22605, 27653, null], [27653, 31307, null], [31307, 37239, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4070, true], [4070, 9228, null], [9228, 13703, null], [13703, 18672, null], [18672, 22605, null], [22605, 27653, null], [27653, 31307, null], [31307, 37239, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 37239, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 37239, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 37239, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 37239, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 37239, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 37239, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 37239, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 37239, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 37239, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 37239, null]], "pdf_page_numbers": [[0, 4070, 1], [4070, 9228, 2], [9228, 13703, 3], [13703, 18672, 4], [18672, 22605, 5], [22605, 27653, 6], [27653, 31307, 7], [31307, 37239, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 37239, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-25
|
2024-11-25
|
736600fdba3125b88445bbdce561a0bc318a567c
|
x86 Network Booting: Integrating gPXE and PXELINUX
H. Peter Anvin
rPath, Inc.
<hpa@zytor.com>
Marty Connor
Etherboot Project
<mdc@etherboot.org>
Abstract
On the x86 PC platform, network booting is most commonly done using software that follows the Preboot Execution Environment (PXE) specification. PXELINUX from the SYSLINUX Project and gPXE from the Etherboot Project are popular Open Source implementations of key PXE components.
In this presentation, we will describe how these two projects were able to jointly develop an integrated PXE-compatible product that provides additional network booting capabilities that go well beyond the PXE specification. We will also discuss some of the organizational challenges encountered during this collaboration between two Open Source projects with different priorities, design goals, and development strategies.
1 Motivation
Open Source software development by definition allows and encourages code sharing and collaboration between projects. There are, however, costs associated with these endeavors, and these costs must be weighed against potential benefits associated with using code developed by another project.
In the case of improving integration between gPXE and PXELINUX, developers from SYSLINUX and the Etherboot Project were motivated to collaborate because they believed there might be significant benefits to leveraging work already done by the other project. Although the process of creating better interoperability between products required significant communication and effort, it was a useful and rewarding exercise for both development teams.
To understand how these two Open Source projects reached this point of collaboration we will examine the history of network booting on the x86 PC platform, as well as the development journey each project took prior to this collaborative effort.
2 The PC Platform: Ancient History
Network booting has been implemented in various forms for many years. To appreciate how it evolved it is instructive to examine the early days of PC computing when standards were few, and achieving consensus between vendors on any technical innovation was even more difficult than it is today.
The x86 PC platform has a direct lineage to the original IBM PC 5150 released in 1981. This machine, an open platform, and its successors, the 1983 IBM XT and the 1984 IBM AT, were widely copied by a number of manufacturers. The PC industry largely followed IBM's technical lead until the disastrous 1987 attempt at reclaiming their initial monopoly position with the closed platform PS/2 line erased their technical and marketplace leadership positions in the industry.
As a result, for the first half of the 1990s there was no clear path for new standards to become accepted on the PC platform, and PCs were becoming little more than massively sped-up versions of the IBM AT. Thus, even as new media such as networking and CD-ROMs became available to the platform, there was little support for booting from anything other than the initially supported floppy and hard disk, although PCs could optionally use an expansion card carrying proprietary booting firmware.
TCP/IP networking, as something other than a niche product, came late to the x86 PC platform. For many years, memory limitations when running MS-DOS and its derivatives meant that simpler, proprietary network stacks were used; the primary ones being NetBIOS from IBM and Microsoft, and IPX from Novell.
The response of early network card manufacturers, to the extent they supported booting from networks at all, was simply to provide a socket into which a ROM (usually an EPROM) could be inserted by the end user. This ROM had to be preprogrammed with firmware specific
both to the network card and the network protocol used; as a result, these ROMs were frequently expensive, and few PCs were ever so equipped. To further complicate the situation, the size of ROMs varied widely depending on the card. Some cards supported as little as 8K of ROM space, greatly limiting the amount and complexity of boot software that could be supplied.
In the early 1990s, as the use of TCP/IP became more prevalent, some manufacturers provided TCP/IP-based booting solutions using the then-standard BOOTP and TFTP protocols, often based on downloading a floppy image to high memory (above the 1 MB point addressable by DOS.) These solutions generally did not provide any form of post-download access to the firmware; the downloaded floppy image was expected to contain a software driver for a specific network card and to access the hardware directly.
By the mid 1990s, the PC industry, including IBM, was seriously suffering from having outgrown IBM AT standards. In January 1995, Phoenix and IBM published the “El Torito” standard [3] for booting PCs from CD-ROM media. Support for this standard was initially poor, and for the rest of the decade most operating systems that were distributed on CD-ROM media generally shipped with install floppies for booting PCs that lacked functional CD-ROM booting support.
3 NBI and PXE: Network Booting Strategies
As the cost of network interface cards (NICs) dropped dramatically in the early 1990s, the cost of a network boot ROM could be a substantial fraction of the cost of the NIC itself. The use of OS-dependent, user-installed ROMs as the only method for network booting had become a significant limitation. In the Open Source world, this issue was further complicated by the need to supply a physical piece of hardware, since a software-only distribution would require end users to have access to an expensive EPROM burner to program the software into an EPROM.
In 1993, Jamie Honan authored a document titled “Net Boot Image Proposal” [4] which defined image formats and methods for downloading executable images to a client computer from a server. A key feature of Jamie’s proposal was the specification of Network Boot Image (NBI) file format, “a vendor independent format for boot images.” This may have been the first attempt in the Open Source world at specifying an OS-independent method for network booting on the PC platform.
To keep NBI loader code uncomplicated, a utility called mknbi was used to convert OS specific files such as kernels and initrds into NBI format for loading into memory. This simplified loader code because it only needed to load a single, uncomplicated image format. It did, however, require an extra step to convert OS images to NBI format prior to booting.
NBI was never used in the closed-source OS world. Instead, vendors continued to offer incompatible solutions, usually based on their respective proprietary network stacks.
In 1997, Intel et al. published the Wired for Management Specification (WfM) [5]. It included as an appendix a specification for the Preboot Execution Environment (PXE), a TCP/IP-based, vendor-neutral network booting protocol for PCs, which included an application programming interface (API) for post-download access to the firmware driver. The specification, as well as its current successor [6], both have numerous technical shortcomings, but it finally made it possible for NIC and motherboard vendors to ship generic network booting firmware. Higher-end NICs began to have onboard flash memory preprogrammed with PXE from the factory instead of providing a socket for a user-installable ROM. Motherboards began to have PXE firmware integrated into their BIOSes.
The PXE specification defines a set of software components (Figure 1) including a PXE Base Code (BC) stack, a Universal Network Driver Interface (UNDI) driver—both in ROM—and a Network Boot Program (NBP), which loads from a server. Of these components, only the UNDI is specific to a certain NIC. Just as with the Open System Interconnect (OSI) networking model, this model does not completely reflect the actual division into components, but is nevertheless useful as a basis for discussion.
The PXE approach is significantly different from the one taken by NBI. NBI simply loads a mknbi-prepared bootable OS image into memory with no further access to the ROM-resident network routines. In contrast, PXE BC first loads an NBP, which then loads a target
1 Some NBI-compliant ROMs would provide APIs to request additional services, but those APIs were never standardized.
OS using still-resident BC and/or UNDI stacks from the ROM using an API defined in the PXE specification.
These differences in approach allow PXE ROMs to contain simple, compact loader code while enabling more specific and capable second-stage loader code to load native OS image formats without pre-processing. Further, NBP code resident on a network server can be upgraded centrally to fix bugs or add capabilities. Added costs to this approach versus NBI include extra time and server load to transfer an NBP before the target OS image is loaded, and the need to maintain multiple components on the boot server. These costs have minimal impact when using modern servers and LAN hardware.
4 The SYSLINUX Project
The SYSLINUX [1] project was started in 1994 by H. Peter Anvin as a way to allow creation of Linux boot floppies without requiring Linux-specific tools. Until that point Linux boot floppies, universally required to install Linux on the PC platform, had been distributed as raw images to be written to a bare floppy disk. On an MS-DOS machine this meant using a tool called RAWRITE. The resulting floppy was an opaque object and was considered unformatted by most non-Linux operating systems.
The SYSLINUX installer (named by analogy to the MS-DOS SYS command) ran directly under MS-DOS and all data was stored in conventional files on an MS-DOS FAT filesystem. Since it was designed for running on floppies it had to be small (the 18K overhead from the FAT filesystem itself was a point of criticism in the early days): as of version 1.30 (November 3, 1996) the SYSLINUX binary was 4.5K in size. Even so, it contained a reasonably flexible configuration system and support for displaying online help; the latter was particularly important for install disks.
In 1999 Chris DiBona, then of VA Linux Systems, provided an early PXE-equipped system as a development platform for a PXE loader. Since the Intel PXE specification at the time specified that only 32K was available to the NBP it was decided that basing the PXE loader code on SYSLINUX—an existing, compact, configurable loader—would make sense. Thus, SYSLINUX 1.46, released September 17, 1999, included PXELINUX, a PXE network bootstrap program with a SYSLINUX-based user interface. Subsequently SYSLINUX acquired support for other media, specifically ISO 9660 CD-ROMs in El Torito “native mode” and hard disks with standard Linux ext2/ext3 filesystems.
As support for CD-ROM booting—and later, USB booting—on PCs became more universal, pressure to keep code size minimal waned since storage capacities were less restrictive. At the same time network administrators in particular requested a more configurable user interface. To avoid burdening the SYSLINUX core (written in assembly language and challenging to maintain) with additional user interface features, an API was developed to allow user interfaces to be implemented as independent, loadable modules. The first such interface was a very sophisticated system written by Murali Krishna Ganapathy, based on a text-mode windowing interface. Though very advanced and capable of almost
infinite customization, it turned out to be too difficult for most users to configure. To address this issue, the “simple menu system” (Figure 2) was implemented and is now used by most SYSLINUX users.
The API also allows support for new binary formats to be written as well as “decision modules” (boot selection based on non-user input, such as hardware detection). An 88,000-line library, derived from klibc, is available to developers to make module development easier and as similar to standard applications-level C programming as possible.
Historically SYSLINUX has focused on the PC BIOS platform, but as the bulk of the code has been migrated from the core into modules and from assembly language into C, the feature set of the core has become bounded. The intent is for the core to become a “microkernel” with all essential functionality in (possibly integrated) modules; this would permit the core to be rewritten to support other platforms such as EFI.
PXELINUX has not, however, implemented any protocols other than TFTP. The PXE APIs only permit access at one of three levels: TFTP file download, UDP, or raw link layer frames. No method to access the firmware stack at the IP layer is provided. This means that to support TCP-based protocols, such as HTTP, a full replacement IP stack is required.
It is worth noting that although a large number of people have contributed to SYSLINUX over the years, it has largely remained a one-person project. As of this writing there is a serious effort underway to grow the SYSLINUX project developer base. To facilitate this process the SYSLINUX project will participate in Google Summer of Code for the first time in 2008.
5 The Etherboot Project
In 1995 Markus Gutschke ported a network bootloader, Netboot, from FreeBSD. Netboot followed Jamie Ho-nan’s 1993 “Net Boot Image Proposal.” Since the first OS targeted for loading was Linux, mknbi was used to combine kernel and initrd images into a single NBI file before loading.
Since Netboot did not support his network card and Netboot drivers at the time had to be written in assembly language, Markus implemented a new driver interface allowing drivers to be written in C. He called his code Etherboot.
Markus released Etherboot 1.0 in 1995 and it proved to be popular enough that a small community called the “Etherboot Project” [2] formed to support and improve it with additional functionality and drivers. In late 1996 one of the group’s more active contributors, Ken Yap, took over leadership of the project.
In 1997, when Intel published the PXE specification, Ken began work on NILO, a first attempt at an Open Source PXE implementation. In 1998 Rob Savoye, with funding from NLnet Foundation, took over NILO development. For various reasons the project was unsuccessful, and development of NILO officially ceased in 2000 [7].
Etherboot development continued, however, and in 1999 Marty Connor became involved with the project, having discovered it through conversation with Jim McQuillan of LTSP (Linux Terminal Server Project). Marty ported several of Donald Becker’s Linux NIC drivers to Etherboot to provide support in Etherboot for popular cards of the day.
In 2000, Marty created rom-o-matic.net [8], a web-based Etherboot image generator that created customized Etherboot images on demand. This made it much easier for people to create and test Etherboot because no specific build environment or command line expertise was required. Usage and testing of Etherboot increased dramatically.
Another boost to Etherboot use came in 2001 when the Etherboot Project first exhibited in the .ORG Pavilion
at the IDG LinuxWorld Expo and invited LTSP to share their booth. Live demos of Etherboot network booting and LTSP thin clients sparked the interest of many potential users.
In 2002 Michael Brown first encountered Etherboot while trying to find a solution for booting wireless thin clients. He developed and submitted an Etherboot driver to support Prism II-based wireless cards, and became a regular contributor to the project.
About this time Marty became concerned that PXE was fast becoming a de facto standard for network booting since it was being included in a significant number of motherboards and mid-to-high-end NICs. Although there was strong opposition within the project to supporting PXE for technical reasons, he felt that unless Etherboot supported the PXE specification Etherboot would quickly become irrelevant for most users.
Added incentive to support PXE came in 2004 when Marty and H. Peter Anvin spoke about creating a complete, compliant Open Source PXE implementation to support PXELINUX. Later in 2004 Michael added partial PXE support to Etherboot, which was then capable of supporting PXELINUX though it lacked full PXE functionality.
In 2005 Marty and Michael created gPXE, a major rewrite of Etherboot with PXE compatibility as a key design goal. Soon after, Marty became the third Etherboot Project Leader and Michael became the project’s Lead Developer. Primary development energy was then redirected from Etherboot to gPXE.
In 2006 Michael, with help from Google Summer of Code student Nikhil C. Rao, added more robust and compliant TCP support to gPXE. This enabled Michael to add TCP-based protocols such as iSCSI, which in turn allowed gPXE to network-boot exotic operating systems such as Windows Server 2003.
In 2007 the Etherboot Project exhibited in the LinuxWorld Expo .ORG Pavilion for the 12th time, this time demonstrating gPXE booting of various OSes via HTTP, iSCSI, AoE, and other protocols. Michael and Peter created, coded, and demonstrated a first API for gPXE to PXELINUX integration.
As of 2008 rom-o-matic.net had generated over two million Etherboot and gPXE images, with a typical size of 40K for a ROM image containing support for DHCP, DNS, TFTP, HTTP, iSCSI, AoE, and multiple image formats including PXE, bzImage, Multiboot, and gPXE scripts.
A large number of people have generously contributed to the success of the Etherboot Project over the years. Many of their names can be found on the project’s acknowledgments web page [9]. There are also many users who contribute on the project’s mailing lists and IRC channel. Their help with documentation, testing, and support greatly contributes to the quality and popularity of Etherboot and gPXE.
6 The Strengths of Each Project
Given the primary focuses of the projects it is not surprising that each brings different strengths to the collaboration. gPXE supports a wide range of protocols, can be integrated in ROM rather than relying on shipped firmware, and supports other architectures; however, its user interface is limited. PXELINUX has advanced user interfaces and, because it is a part of the SYSLINUX suite, has cross-media support, but its protocol support is limited to TFTP.
Within the PXE concept model PXELINUX strictly acts as the NBP, whereas gPXE can act either as NBP, BC, or BC and UNDI combined depending on how it is configured and compiled. gPXE configured to function as BC and UNDI is most common when it is used in ROM or loaded from disk.
gPXE is also able to be loaded from a server as an NBP and then take over the functions of either the BC only, or the BC and UNDI combined, and then load another NBP such as PXELINUX to perform a target OS load. This configuration, referred to as “chainloading,” can be used either to substitute functionality from a partially working PXE stack or to get the enhanced capabilities of gPXE, either way without having to actually modify the ROM on the device.
7 Choosing a Strategy for Collaboration
Collaborative projects carry significant risks and rewards over single-team development. Because of this, potential costs and benefits should to be considered carefully before embarking on such a journey.
Rather than seeking to collaborate with the Etherboot Project, the SYSLINUX project could have implemented its own TCP/IP stack, HTTP client, and iSCSI and AoE initiators for PXELINUX. Alternatively, it could have reused the code from gPXE or used another Open Source TCP/IP stack, such as lwIP [10].
Collaboration, though requiring some additional development effort, had several potential advantages:
- Using gPXE’s protocol support would mean that SYSLINUX maintainers would not have to integrate and support additional code to support new protocols.
- Code improvements to either project could be of benefit to users of both projects.
- Users of both gPXE and PXELINUX could share a single user interface for accessing features.
In light of these potential advantages, the developers of both projects decided to explore ways of working together.
Popular strategies for collaboration between Open Source projects differ primarily based on whether it is the intention of one project to take over maintenance of code produced by another project or whether the projects intend to maintain separate code bases which interoperate based on well-defined interfaces.
Some common strategies for collaboration between projects are:
- **Componentization**, where one project’s code and development team simply becomes part of another project. The second project then ceases to exist as an independent project.
- **Aggregation**, where one project includes the other’s code as a component, possibly in modified form, but the second project’s code continues to be developed as a separately maintained project. In this model, the first project can be considered a consumer of the second project. This is particularly common with application programs that depend on libraries that are not widely available.
- **Cooperation**, where the two projects mutually agree on a set of APIs and independently implement their respective parts. The projects are maintained separately, and aggregation into a combined product is performed by the distributor or end user.
- **Stacking**, in which one project independently defines an interface available to all potential users of the code, which is completely sufficient (without modification) for the needs of the second project. In this case, the combination is strictly a case of the second project being a consumer of the first, and final aggregation is typically performed by the distributor or end user; this strategy is typified by widely used libraries.
Each of these strategies has advantages and pitfalls, based on the nature of the projects, the development teams, and any corporate entities that may be involved. The tradeoffs between these strategies can be quite different in the Open Source world over what they might be in analogous corporate environments.
### 8 Integration, so Far
Initial steps toward integrating gPXE and PXELINUX were taken in 2004 when Etherboot first became capable of acting as a PXE ROM (BC and UNDI combined). This allowed Etherboot to replace defective vendor PXE implementations, either by replacing the ROM or by chainloading, but did not provide any additional capabilities. Nevertheless, this approach has been widely used, especially with SiS900 series NICs, a briefly popular NIC with a notoriously buggy vendor PXE stack.
PXELINUX users had been requesting additional protocol support for quite some time, especially the ability to download via HTTP. Not only is HTTP, a TCP-based protocol, faster and more reliable than TFTP (based on UDP), but HTTP servers have better support for dynamic content, which is frequently desired for generating configuration files.
At LinuxWorld Expo San Francisco in 2006, SYSLINUX and Etherboot Project developers met to discuss the situation. At that meeting, the following constraints were established:
- The primary focus of gPXE is as ROM firmware. The continued utility of gPXE in ROM must be maintained.
• Extended protocol support must work in PXELINUX when it is loaded from a vendor PXE stack. Supporting extended protocols only with gPXE in ROM is not acceptable.
• Although gPXE already had support for extended protocols by accepting a URL via the PXE API’s TFTP (PXENV_TFTP_OPEN) routine, the PXE TFTP interface is inadequate for PXELINUX; a new API is necessary for PXELINUX to access functionality beyond what standard PXE APIs permit.
In electronic discussions afterwards, the following high-level plan was agreed to by both development teams:
• An extended PXE API for PXELINUX will be developed.
• A technique will be developed to aggregate gPXE and PXELINUX into a single binary to simplify deployment in existing PXE environments.
Unfortunately around this time both projects became distracted by other priorities: the Etherboot Project focused on providing new and improved network drivers, support for SAN protocols (iSCSI and AoE), and completing an initial gPXE release; the SYSLINUX project on user interface and module API improvements. A test version without the aggregate binary (and certainly not stable enough to be deployed in a real environment) was demonstrated at IDG LinuxWorld Expo 2007, but after that the collaboration languished for months.
Toward the end of 2007 improved protocol support was becoming a high priority for the SYSLINUX project, while Etherboot developers were pushing toward a mid-February initial release (gPXE 0.9.3). Over the holidays developers from both projects conducted a sizable joint development and debugging effort, implementing binary encapsulation support and tracking down a number of issues that occurred when gPXE was chainloaded from a network server, as opposed to running from ROM. Having more developers testing the code helped find bugs that only manifested on certain hardware and particular PXE implementations. Fortunately (for some meaning thereof), the combined team had access to a large and eclectic collection of troublesome hardware.
After the initial beta release of gPXE 0.9.3 on February 14, 2008, the original plan was reviewed by both development teams. As there had been significant changes in both code bases, the plan was revised as follows:
• An initial implementation will be based on the already implemented extended PXE API, plus any additions necessary.
• This API will be considered private and not guaranteed to be stable between revisions. Thus, the only supported use will be between gPXE and an embedded PXELINUX; if gPXE is used in ROM it should still chain-load the combined image.
• As SYSLINUX code has increasingly moved toward having most of its code in modules, with a well-defined application binary interface (ABI), the projects will eventually migrate to a model where gPXE implements the SYSLINUX module ABI directly; at that time the private API will be deprecated.
The third item on this list was accepted as a Google Summer of Code project under Etherboot Project mentorship for 2008.
More powerful functionality is possible when gPXE is also used in ROM (or provided on CD-ROM, USB stick, or floppy). gPXE can either be used as the native PXE stack on the system using its own network device drivers, or it can use the UNDI driver from the vendor PXE stack. With suitable configuration gPXE can download an initial NBP image from a specific URL set at compile time or saved in nonvolatile storage. This capability can be used to invoke a service facility with a very small investment in ROM; the only local network resources required are working DHCP and DNS. If the downloaded image is gpxelinux.0, a full range of PXELINUX modular functionality becomes available.
Ultimately SYSLINUX and the Etherboot Project decided not to combine code or development teams but rather to modify both of their code bases to support a jointly developed API (a cooperation). However, to make it easier for end users, the SYSLINUX distribution now contains a snapshot of gPXE sources so that the combined image can be built from a single download; in this sense, it is also an aggregation. However, the intent or the projects to emphasize the cooperative aspects of supporting a common API and to have the SYSLINUX combined source code tree have minimal differences from the primary gPXE distribution.
It is the desire of both projects that this will permit each project to retain its particular focus and identity, while giving end users access to functionally contained in both code bases.
As of April 15, 2008, the combined product is available in beta form as part of SYSLINUX 3.70-pre9. This distribution includes a slightly modified snapshot of the gPXE git repository (containing a few changes necessary for the usage model, but in need of cleanup before being fed upstream into the gPXE tree). When built, this produces gpxelinux.0, a combined binary, in addition to the conventional pxelinux.0. If loaded from a standard vendor PXE stack, gpxelinux.0 can be redirected to non-TFTP protocols via the PXELINUX Path Prefix DHCP option [11] or via explicit URL syntax in the configuration file. A DHCP option, in particular, allows even the PXELINUX configuration file to be acquired through non-TFTP protocols such as HTTP, making it much easier to generate configuration files dynamically.
As of the SYSLINUX 3.70-pre9 release, gpxelinux.0 is not yet a drop-in replacement for pxelinux.0 in all situations because some issues relating to chainloading another NBP remain. It is expected that these issues will be relatively easy to resolve.
9 Next Steps
At the time of this writing the primary collaborative development focus of the projects is to resolve a few remaining interoperability issues and to clean up SYSLINUX-local modifications to gPXE so that they may be integrated into the official gPXE source base.
The combined gpxelinux.0 image using the current approach is expected to be released with SYSLINUX 3.70. Over the summer of 2008 considerable progress on implementing the SYSLINUX module API in gPXE will hopefully be made. This effort will also serve as a trailblazing project for the “microkernelized” rewrite of the SYSLINUX core across all media.
10 Lessons Learned Along the Way
When integrating Open Source projects, especially ones developed outside the influence of a corporate or sponsorship structure, one must consider at least the following pitfalls and concerns:
- **Motivation:** For collaboration between two projects to succeed it is important that there be incentives for both of their user communities and de-
development teams. Without a shared sense of purpose, enthusiasm for the project may quickly wane on the part of one or both projects.
In the case of the SYSLINUX-Etherboot collaboration, both projects recognized the opportunity to leverage each others work and both were motivated to explore how they might productively work together. Understanding the motivations of other project participants was an important part of keeping the collaboration moving forward.
• Focus: The primary reason for combining two projects is that each brings different strengths to the table. It is likely that each project has development goals aimed toward improving its respective strengths. A goal related to facilitating code combination might therefore be relatively low on the priority of either one or both the parent projects! A good working relationship is likely to improve joint focus, but other driving forces may still prevail, such as funding issues.
Focus differences were a significant issue early in the SYSLINUX-Etherboot collaboration. Rather than completely executing the original project plan, each project ended up working more on other priorities, especially SAN support for gPXE and improved user interfaces for SYSLINUX. Not until late 2007 discussions did both projects agree on the priority of the joint development effort and commit to the shared goal of producing a test release in the March 2008 timeframe.
• Culture: Every Open Source project has a unique culture that generally depends on the preferences of the original or principal developers or administrators. Just as in a corporate collaboration or merger, culture clashes can manifest themselves as subtle but significant roadblocks to progress. In Open Source projects, such issues may include frequency and style of developer communication, review and commit policies, and coding style. In large projects, these processes are often more formalized than in smaller projects. Nevertheless, it is important to recognize, respect, and address differences between collaborative partners as they can significantly affect the success of the joint effort.
Whereas the SYSLINUX project has a single central maintainer responsible for all technical direction, Etherboot Project decision making is somewhat more distributed. This difference complicated some early discussions until it became clear that for actionable agreement to be achieved, all relevant Etherboot Project team members needed to be included in technical discussions.
• Credit where credit is due: These days many, if not most Open Source software developers are deriving their income either directly or indirectly from Open Source work. Others, such as students, may be concerned about future marketability. Still others may consider recognition a major driver for their Open Source involvement. Accordingly, recognition is very valuable currency in the Open Source world. A perception, true or not, that one project is trying to usurp credit for another project’s work is likely to create ill will and poor relations.
Discussions of credit can be sensitive, as some people may feel their concerns aren’t appropriate or valid. In the particular case of the SYSLINUX-Etherboot Project collaboration, both sides had concerns, but some went unvoiced for a long time. Although both sides had good intentions, these unresolved concerns slowed the collaboration considerably, until they were discussed and addressed as legitimate issues.
By recognizing that with the best intentions such issues can and do occur—even in a collaboration involving relatively small projects—one can significantly improve the chances for a successful and timely joint project.
Learning to work together benefited the code bases and development teams of both projects. Code changes needed to support jointly developed interfaces required optimization and auditing of critical code sections. In addition, communication, confidence, and trust between developers significantly improved during the process of working together to achieve a shared goal.
References
[1] SYSLINUX project web site,
http://syslinux.zytor.com/
[2] Etherboot Project web site,
http://www.etherboot.org/
January 25, 1995,
Proceedings of the Linux Symposium
Volume One
July 23rd–26th, 2008
Ottawa, Ontario
Canada
Conference Organizers
Andrew J. Hutton, *Steamballoon, Inc., Linux Symposium, Thin Lines Mountaineering*
C. Craig Ross, *Linux Symposium*
Review Committee
Andrew J. Hutton, *Steamballoon, Inc., Linux Symposium, Thin Lines Mountaineering*
Dirk Hohndel, *Intel*
Gerrit Huizenga, *IBM*
Dave Jones, *Red Hat, Inc.*
Matthew Wilson, *rPath*
C. Craig Ross, *Linux Symposium*
Proceedings Formatting Team
John W. Lockhart, *Red Hat, Inc.*
Gurhan Ozen, *Red Hat, Inc.*
Eugene Teo, *Red Hat, Inc.*
Kyle McMartin, *Red Hat, Inc.*
Jake Edge, *LWN.net*
Robyn Bergeron
Dave Boutcher, *IBM*
Mats Wichmann, *Intel*
Authors retain copyright to all submitted papers, but have granted unlimited redistribution rights to all as a condition of submission.
|
{"Source-Url": "https://www.kernel.org/doc/ols/2008/ols2008v1-pages-9-18.pdf", "len_cl100k_base": 7212, "olmocr-version": "0.1.50", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 31897, "total-output-tokens": 8265, "length": "2e12", "weborganizer": {"__label__adult": 0.0003917217254638672, "__label__art_design": 0.00032138824462890625, "__label__crime_law": 0.0002598762512207031, "__label__education_jobs": 0.0007405281066894531, "__label__entertainment": 0.0001049041748046875, "__label__fashion_beauty": 0.00016200542449951172, "__label__finance_business": 0.0005278587341308594, "__label__food_dining": 0.0002949237823486328, "__label__games": 0.0008573532104492188, "__label__hardware": 0.01497650146484375, "__label__health": 0.0003535747528076172, "__label__history": 0.0005698204040527344, "__label__home_hobbies": 0.0001653432846069336, "__label__industrial": 0.0007710456848144531, "__label__literature": 0.0001984834671020508, "__label__politics": 0.00018167495727539065, "__label__religion": 0.0004177093505859375, "__label__science_tech": 0.08807373046875, "__label__social_life": 8.296966552734375e-05, "__label__software": 0.030914306640625, "__label__software_dev": 0.8583984375, "__label__sports_fitness": 0.00023508071899414065, "__label__transportation": 0.000728607177734375, "__label__travel": 0.00020241737365722656}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 35917, 0.01701]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 35917, 0.35136]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 35917, 0.94106]], "google_gemma-3-12b-it_contains_pii": [[0, 3733, false], [3733, 8314, null], [8314, 11432, null], [11432, 15061, null], [15061, 19254, null], [19254, 23189, null], [23189, 26877, null], [26877, 29752, null], [29752, 34036, null], [34036, 35086, null], [35086, 35178, null], [35178, 35917, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3733, true], [3733, 8314, null], [8314, 11432, null], [11432, 15061, null], [15061, 19254, null], [19254, 23189, null], [23189, 26877, null], [26877, 29752, null], [29752, 34036, null], [34036, 35086, null], [35086, 35178, null], [35178, 35917, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 35917, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 35917, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 35917, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 35917, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 35917, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 35917, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 35917, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 35917, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 35917, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 35917, null]], "pdf_page_numbers": [[0, 3733, 1], [3733, 8314, 2], [8314, 11432, 3], [11432, 15061, 4], [15061, 19254, 5], [19254, 23189, 6], [23189, 26877, 7], [26877, 29752, 8], [29752, 34036, 9], [34036, 35086, 10], [35086, 35178, 11], [35178, 35917, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 35917, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-01
|
2024-12-01
|
5bc7f0a4e84275c1b91c3aadac5b35f7ad61d813
|
Developing Mobile Apps for Improving the Orientation Experience of First-Year "Third Level" Students
Mary O’Rawe
*Technological University Dublin*, mary.orawe@tudublin.ie
Nevan Bermingham
*Technological University Dublin*, nevan.bermingham@tudublin.ie
Mark Prendergast
*Technological University Dublin*, mark.prendergast@tudublin.ie
Trevor Boland
*Technological University Dublin*, trevor.boland@tudublin.ie
Barry Ryan
*Technological University Dublin*, barry.ryan@tudublin.ie
Follow this and additional works at: [https://arrow.tudublin.ie/tfschmtcon](https://arrow.tudublin.ie/tfschmtcon)
**Recommended Citation**
DEVELOPING MOBILE APPS FOR IMPROVING THE ORIENTATION EXPERIENCE OF FIRST YEAR THIRD LEVEL STUDENTS
Nevan Bermingham¹, Mark Prendergast², Trevor Boland¹, Mary O’Rawe¹, Barry Ryan¹
¹Dublin Institute of Technology (Ireland)
²Trinity College Dublin (Ireland)
Abstract
Smartphone usage by students has increased rapidly over the last number of years, and research points to an expectation for increased utilisation of mobile applications in third level educational environments. First year students have particular needs when they transition to third level as they can experience a number of personal, social and cultural difficulties. Orientation is a critical stage for these students and the earlier students have access to important orientation information the less stressful the initial stages of college are. At the Dublin Institute of Technology (DIT), the authors designed a bespoke mobile application tailored to the particular orientation and information needs of first-year students undertaking programmes in the DIT’s School of Hospitality Management & Tourism. The aim of the mobile app was to engage and orientate the students to their programme before they arrived on campus, and provide key information such as college floor maps and campus locations, contact details, tutorials, academic materials and social media links. This mobile app – entitled “DIT GetSmart!” - was released on Apple’s App Store and Google’s Play Store in August 2015 for free download by all incoming first year students joining the DIT’s School of Hospitality & Tourism undergraduate programmes. Mobile applications of this nature would generally require substantial financial investment and technological expertise. However, the authors utilised an online Hybrid App Development Platform that provides low cost development requiring little or no programming know-how to create and deploy quality mobile applications on Android and Apple smartphones and tablets in just a matter of weeks. The field testing of the app was evaluated through app usage and analytics.
Keywords: Bespoke Mobile Apps, Orientation, Engagement, First Year Experience, Retention
1 INTRODUCTION
Mobile operators have been driving the uptake of mobile data services, or the “mobile internet”, since the mid-1990’s. While mobile operators focused on a mobile version of the internet, Apple changed the eco-system with the release of the first iPhone in 2007, where the user could not only utilise the mobile internet, but could also download small standalone applications – generally referred to as apps – that utilised this connectivity to provide a service to the user. The Apple iPhone was different from its predecessors in that it had a large touch screen and was developed around the users access to the mobile internet [1].
Growth in Apple’s App Store led to Google to enter the market with its Android based phones and tablets. Whereas Apple developed the hardware and the operating software for their iPhones, Google’s strategy was to partner with established handset manufacturers to provide a large range of devices across many price points, and its success has seen an increase in market share and the rise of its own app store, called the Google Play Store [2].
The success of the Apple iPhone led to the release of the first iPad in 2010. With a similar interface to the iPhone, it had a larger 9.7” screen that could be used as a touch screen or with a stylus, had an “instant-on” interface and a relatively low cost compared to a PC. Its versatility allowed Apple to capture nearly 70% of the tablet market share within one year of its launch [3]. Other manufacturers followed Apple in creating Android and Windows based tablets, and while tablet sales have slowed in 2014, it is still a growth area [4]. Garner reported in 2015 that Android based devices had a market share of 80.7%, Apple iOS 17.7%, and other devices – including Windows and Blackberry – had a 1.5% market share, clearly showing that the smartphone and tablet market is dominated by Apple’s iOS based devices, and Google’s Android OS devices [5]
Research by the IEEE (Institute of Electrical and Electronics Engineers) in 2014 has shown that consumers are buying fewer desktop computers and adopting mobile technology instead [6]. With the development of 3G and 4G mobile technology, providing increased transmission speeds for mobile
consumers, the mobile internet has gradually turned into mobile broadband in turn driving increases in the uptake of mobile devices [7]. With this growth in mobile internet speeds and ubiquitous connectivity, mobile apps will become the official channel to drive information content and services to consumers, and users will increasingly interact with mobile apps on their devices [8].
1.1 Hybrid Apps
The range of smartphone devices with their different operating systems poses challenges for developing mobile applications, as they do not utilise a standard development platform [9]. Mobile apps are usually referred to as native apps, apps which are designed and built for one particular platform such as Apple’s iOS or Google’s Android devices. These native apps are built using specific programming languages such as Java to run on one type of mobile platform. Web-based apps are usually built to convey information with web languages such as HTML and CSS, but lack the functionality of native apps, such as access to the phones functions like location services [10]. While native apps have better integration with their device’s operating system, native app development across multiple mobile platforms can not only be time consuming and costly, they also require specific coding skills [9].
Hybrid apps have emerged to address these challenges. Hybrid apps – also known as cloud-mobile hybrids – have the advantage of being platform independent which mean one app can be deployed across many different mobile devices. Hybrid apps allow for the heavy computations to be done on the back end cloud based host system while the mobile device based front-end application presents the information like a native app. These front-end and back-end components are collectively considered as one single application from the point of view of the end-users functionality despite being in effect two independent applications [11].
Many web-based development environments that allow for building hybrid mobile apps have emerged with a low annual cost and have minimal requirement for coding skills. These web-based development environments allow app developers to create mobile applications via an intuitive graphical interface by selecting prebuilt modules that combine together into the app in an ‘à la carte’ fashion [12].
While hybrid apps have limitations, such as functionality is limited to only the modules that are available in the development environment, they allow for apps that are easy to create and deploy across multi-platform, that perform well, and have the same feel as a native app [12]. Hybrid app development platforms offer a promising cross-platform development solution for inexpensive building of generic mobile apps which can then be easily deployed to both the app stores of Apple and Google [13].
1.2 Student Adoption of Mobile Technology
Research has shown that higher education is changing to accommodate the high ownership rates of mobile devices among students for whom technology plays an important part in their lives [14]. The term “Net Generation” [15] has been used in literature to describe students entering third level education, with research indicating that this generation of student is technology savvy and their social networks have been established through the use of technology and the internet. These technology savvy students perceive technology to be a core part of their lives and have created a dependency on using this technology to feel connected to the world around them [16].
Research conducted by the Educause Centre for Analysis and Research reinforces this, and their study of 1.5 million students over 213 institutions across 45 US States found that students perceive the technology they use as embedded into their daily lives. The study also found that these students are generally inclined to have a favourable attitude to technology [17]. The Pew Research Centre’s Internet & American Life Project study suggests that college students are the most likely to be rapid adopters of smartphone and mobile technologies [18].
1.3 First Year Students
In transitioning to third level education students experience a major life change. This is particularly true if this transition involves a move away from their home. In addition to this transition to a new environment, students are also expected to perform academically whilst adapting to third level life. Reducing the stress experienced during this initial transition to college is central to supporting the student better adapt to their new academic life and remove potential causes of depression [19].
Research has indicated that mobile technologies can offer tangible advantages for students transitioning to third level by making it as easy for them to engage on their own terms with information and resources. By fostering new technology innovations third level educational organisations can ensure that the potential for enhanced student support can be fully exploited [20].
2 DEVELOPING BESPOKE HYBRID APPS
This paper will focus on the process for designing and deploying a bespoke hybrid mobile app to meet the information needs of third level first year students in the Dublin Institute of Technology’s (DIT) School of Hospitality Management and Tourism. The mobile app was designed to be freely available to all incoming students starting their undergraduate courses in this School in September 2015, approximately 410 new first year students. The aim of the authors was to show how such bespoke mobile apps can be developed using affordable online Integrated Development Environments (IDE’s) which can be deployed to the dominant Apple (iPhones, iPads) and Android mobile platforms in a matter of weeks. The key function of the app was to provide important information to the students about their campus and course in advance of their arrival by means of a custom built mobile app.
2.1 Development Platform – Como™
The first phase in the app design was to identify an online development platform and create a design team. The design team consisted of three individuals – the app designer, a graphic designer, and a content researcher. The app designer was the project leader and was responsible for the construction of the app and any technology decisions that needed to be made. The graphic designer was responsible for the app aesthetics and branding, as well as providing infographics to be used within the app, such as floor maps. The content researcher’s responsibility was for ascertaining what information was essential for first year students and providing up-to-date relevant information for the app. The inclusion of a graphic designer was considered essential, as there is evidence to suggest that with app design there is a correlation between the aesthetics of the interface and the perceived usability which can positively affect user’s impression of the app itself [21].
An evaluation was conducted of a sample of the various hybrid app Integrated Development Environments (IDE’s) available online, and after a review of their functionality and cost models, Como (www.como.com) was selected. Como offers an extensive range of modular functionality that can be easily incorporated into a hybrid app, while allowing for easy deployment to the Apple App Store and Google Play Store. Como did not have the functionality for creating Windows Phone based mobile apps, and while this is viewed as a missed opportunity for some students, the popularity of Windows Phones is much lower compared to Android and Apple devices. Como also allowed for pop-up notification to be sent to the app user’s phone, a feature that was deemed advantageous for connecting with students at the early stages of their orientation in first year. Most online hybrid mobile app IDE’s allow the creator to prototype and test their app’s functionality before deployment to an app store and before any payment is necessary.
2.2 Phase 1 – Design & Scoping
The initial stage of the design scoped out the requirements for the apps. It is important to note that some desired functionality was not possible using the Como IDE, such as messaging directly from the app, and that the scoping exercise was aimed at matching the requirements with the IDE’s available modules. Fig 1 outlines the basic requirements that were deemed essential orientation information for students which were included in the app design. A project plan was devises to outline the indicative timescales involved, and this is outlined in Fig 2. The app itself was entitled “DIT Get Smart!”, and would be available for download from the two Apple and Google app stores from August 2015, in advance of students arriving in the college for their first year programme.
2.3 Phase 2 – Development
The Como development platform interface provides modular components that encapsulate certain functionality, such as social media, contacts lists, email feedback, map, and each of these modules can be configured and “dropped” into the location on the app preview screen as shown in Fig 3. Each module can be organised in any order required on the app screen and its configuration edited to suit the content needed for that component.
Once the mobile app was built to meet the content requirements outlined in the scoping phase, the graphic designer created the colour scheme and icons to brand the app in line with existing web content for the DIT’s School of Hospitality Management & Tourism. While the Como development platform provides icons and colour templates, it was desirable to match the app’s look and design to existing material provided to students for orientation to create a sense of brand continuity and familiarity. A logo was designed and incorporated into the app, as well as the incorporation of existing social media into the app’s functionality, such as the School’s Facebook Page, YouTube Channel and Twitter Feed.
### 2.4 Phase 3 – “DIT GetSmart!” App Deployment
The Como development environment provides testing functionality in advance of any live deployment via a custom made app provided free by Como, called “MyDemo by Como”. Hence a pre-release prototype version of the “DIT GetSmart!” app could be distributed to the testers. The authors of the app employed five academic staff members within the School to download the app from their respective app stores to allow them to interact with a fully functional version of the app. This allowed for the testers to evaluate the user experience and to feedback on any errors in content or functionality which was then resolved by the app developer and content researcher.
In order to deploy an app to either the Apple App Store or Google Play Store, developer accounts need to be created. This involved setting up a Google Developers Account with a once-off registration fee (USD$25.00 as at 22nd July 2015). A separate Apple Developer Program account was needed for deployment to the Apple App Store, including a payment of an annual registration fee (EUR€99.00 as at 22nd July 2015). The deployment process also required the submission of screenshots of the app as well as a detailed description of functionality and an age rating. Fig 4 shows the indicative costs of deploying an app to both app stores.
<table>
<thead>
<tr>
<th>Item</th>
<th>Type</th>
<th>Cost (£) (on the 22nd July 2015)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Como Cost</td>
<td>Annual</td>
<td>€525</td>
</tr>
<tr>
<td>Google Play Store Deployment</td>
<td>Once-Off (USD€25)</td>
<td>€22</td>
</tr>
<tr>
<td>Apple App Store Deployment</td>
<td>Annual</td>
<td>€99</td>
</tr>
<tr>
<td><strong>Total</strong></td>
<td></td>
<td><strong>€646</strong></td>
</tr>
</tbody>
</table>
Fig 4 - Costs
There are key differences between the two app stores for deploying apps. Apple’s App Store has a different and more stringent approval and review process than Google’s Play Store. While the deployment process for Apple is open to any submission, there are multiple controls and filters in place before Apple will approve apps for release via their store. Hence Apple apps can have a longer...
deployment time than Google’s Play Store. The deployment times for a new app to Google’s live app market can vary, but are typically within a few hours. Deployment through the Apple App Store takes considerably longer due to Apple’s evaluation criteria for new apps, up to 28 days [22]. Como have included the functionality within their IDE to allow deployment of the app to both app stores directly from the Como IDE interface. Fig 5 shows the successfully deployed live “DIT GetSmart!” app on the Google Play Store.
Fig 5 – “DIT GetSmart!” Live App on the Google Play Store
3 EVALUATION
The authors of the app utilised the analytics functionality included in the Como IDE to evaluate the app usage. The limitations of these analytics is that the app is freely available on the Apple and Google App Stores, so its anonymised data includes usage that may not be the target first year third level students in the School it was designed for. However, the analytics provide useful download and usage statistics that can be correlated with student feedback.
Fig 6 shows the download frequency of the app. As expected, the week before and the initial week of the first year orientation, either side of the 26th of September 2015, were peak download times.
Fig 6 – App Downloads by Month
The total number of downloads over the period 1st August 2015 to the 31st December 2015 was 361. The apps analytics reported that 70% of the downloads were on an Apple iOS device (iPhone or iPad) and the remaining 30% on a Google Android device, suggesting Apple devices iPads were more popular with the students.
The most used features of the app reported in the analytics indicates where the student information requirement was in the initial stages of orientation. The top features in order of usage popularity were College Information, College Floor Plan Maps, the Staff Directory, the Academic Calendar, Individual Course Information, and Campus Location Maps. The number of page-views also suggests that students went back to these same features many times, perhaps suggesting that students will seek
information when the need arises and as often as they need it. Fig 7 shows the breakdown of these page views.
Fig 7 – Page-views by App Feature
4 DISCUSSION
In this paper, the authors have shown that mobile applications are growing in usage, and in particular among the first year third level student demographic. Ownership of smartphones among third level students is high and these students are increasingly using smartphones and mobile devices as part of their everyday lives in college. These students are eager to engage with their third level institutes through their mobile devices, and have an expectation that educational organisations use these technologies to provide them with the relevant information at crucial times in their lives, such as in the transitional stages to third level education.
Hybrid app development platforms offer both academics and educational organisations a cost effective opportunity to easily deploy mobile apps that can provide a rich source of information for first year students to acculturate and prepare them for third level. The design and deployment time of hybrid apps is much shorter than with traditionally coded native apps, and hence offer the possibility for the non-technical developer to create an interactive vehicle for information on a mobile device with little difficulty.
By incorporating existing social media functionality into the app with essential orientation information, the student can avail of a feature rich “one-stop-shop” app for all their first year information needs, especially in advance of their arrival on campus.
4.1 Future Work
The process of deploying the “DIT GetSmart!” app for first year students is currently being evaluated through student feedback in the form of focus groups and questionnaires to gauge the app’s effectiveness at improving the orientation experience of first year third level students. This feedback will be used at a later stage to improve the app for the next iteration and for incoming first year students in September 2016. Further research is needed to gauge the performance of the hybrid app model when compared to the native app design approach to understand if the cloud based nature of hybrid apps hinders the user experience.
REFERENCES
[3] J. Sclafani, T.F. Tirrell, O.I. Franko, Mobile tablet use among academic physicians and
|
{"Source-Url": "https://arrow.tudublin.ie/cgi/viewcontent.cgi?article=1085&context=tfschmtcon", "len_cl100k_base": 4239, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 26610, "total-output-tokens": 5940, "length": "2e12", "weborganizer": {"__label__adult": 0.0008034706115722656, "__label__art_design": 0.001617431640625, "__label__crime_law": 0.0005545616149902344, "__label__education_jobs": 0.197998046875, "__label__entertainment": 0.0002486705780029297, "__label__fashion_beauty": 0.000637054443359375, "__label__finance_business": 0.001946449279785156, "__label__food_dining": 0.0010023117065429688, "__label__games": 0.0011911392211914062, "__label__hardware": 0.004138946533203125, "__label__health": 0.0014019012451171875, "__label__history": 0.0009031295776367188, "__label__home_hobbies": 0.00032138824462890625, "__label__industrial": 0.00057220458984375, "__label__literature": 0.0008864402770996094, "__label__politics": 0.0003986358642578125, "__label__religion": 0.0009717941284179688, "__label__science_tech": 0.0237884521484375, "__label__social_life": 0.0003709793090820313, "__label__software": 0.027435302734375, "__label__software_dev": 0.72998046875, "__label__sports_fitness": 0.0006132125854492188, "__label__transportation": 0.0014448165893554688, "__label__travel": 0.0006322860717773438}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25279, 0.04049]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25279, 0.12693]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25279, 0.93215]], "google_gemma-3-12b-it_contains_pii": [[0, 893, false], [893, 5281, null], [5281, 9897, null], [9897, 14025, null], [14025, 15189, null], [15189, 17522, null], [17522, 19618, null], [19618, 22198, null], [22198, 25279, null]], "google_gemma-3-12b-it_is_public_document": [[0, 893, true], [893, 5281, null], [5281, 9897, null], [9897, 14025, null], [14025, 15189, null], [15189, 17522, null], [17522, 19618, null], [19618, 22198, null], [22198, 25279, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 25279, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25279, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25279, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25279, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25279, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25279, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25279, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25279, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25279, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25279, null]], "pdf_page_numbers": [[0, 893, 1], [893, 5281, 2], [5281, 9897, 3], [9897, 14025, 4], [14025, 15189, 5], [15189, 17522, 6], [17522, 19618, 7], [19618, 22198, 8], [22198, 25279, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25279, 0.06061]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
55c307d0a4f0458811bfb77ee1b041649a5e4595
|
<table>
<thead>
<tr>
<th>Title</th>
<th>Assessing the role of open source software in the european secondary software sector: a voice from industry</th>
</tr>
</thead>
<tbody>
<tr>
<td>Author(s)</td>
<td>Morgan, Lorraine</td>
</tr>
<tr>
<td>Publication Date</td>
<td>2005-06-09</td>
</tr>
<tr>
<td>Link to publisher's version</td>
<td><a href="http://kb.cospa-project.org/retrieve/2126/62.pdf">http://kb.cospa-project.org/retrieve/2126/62.pdf</a></td>
</tr>
<tr>
<td>Item record</td>
<td><a href="http://hdl.handle.net/10379/1513">http://hdl.handle.net/10379/1513</a></td>
</tr>
</tbody>
</table>
Assessing the Role of Open Source Software in the European Secondary Software Sector: A Voice from Industry
Pär J Ågerfalk, Andrea Deverell, Brian Fitzgerald, Lorraine Morgan
University of Limerick, Limerick, Ireland
{par.agerfalk | andrea.deverell | brian.fitzgerald | lorraine.morgan}@ul.ie
Abstract – This paper addresses the open source software (OSS) phenomenon from an industry perspective and reveals a number of complexities surrounding the role of OSS in the secondary software sector. It presents the research results of an international workshop which was hosted with the explicit intention of extracting the voice of key industrial stakeholders. The data was gathered and analysed using a qualitative approach which revealed the key strengths and weaknesses of OSS from an industrial perspective. This formed the foundations for developing a framework describing the emerging commercial incarnation of OSS (we refer to this as Open Source Software, Inc.) The paper concludes that the European secondary software sector recognise the benefits of leveraging OSS but are aware of key issues pertinent to such an end.
I. INTRODUCTION
The open source software (OSS) phenomenon has been around for quite some time now1. However, the image of OSS is undergoing a transformation. OSS has emerged as something quite different from its Free Software antecedent, not just ideologically, but also practically. Free Software was originally perceived as largely an ideological phenomenon within the domain of software engineering. However, the open source movement pragmatically shifted the centre of gravity towards a more business-friendly and hybrid concept, and OSS is now rapidly changing into a viable alternative to proprietary software also in commercial settings2.
The OSS phenomenon is, without doubt, innovative in a number of respects [1]. It has, for example, appeared on the software engineering scene as an apparently revolutionary paradigm shift which addresses the three central problems of software development: projects exceeding budget and schedule and software products being of poor quality. In tackling these issues, often referred to as ‘the software crisis’, the OSS development model is somewhat at odds with conventional software engineering wisdom. For example, it often does not map to current software development lifecycle models, it encourages redundant tasks and seems to turn ‘Brooks Law’3 on its head [2].
However, since OSS products are freely available for public download and OSS processes encourage extensive collaboration, there is an obvious element of shared cost and risk. The cost issue is thus immediately addressed. From the point of view of development speed, the collaborative, parallel efforts of globally-distributed codevelopers have allowed many OSS products to be developed much quicker than conventional software. In terms of quality, many OSS products are recognised for their high standards of reliability, efficiency and robustness, and the OSS phenomenon has produced several ‘category killers’ (i.e. products that remove any incentive to develop any competing products) in their respective areas, such as the Apache HTTP server and the Sendmail mail routing application. The OSS model harnesses the most scarce resource of all – talented software developers. The resulting peer review model, comprising extremely talented individuals, serves to ensure the quality of the software produced. There is also growing evidence to support the claim that OSS can help to address, or even alleviate, the software crisis. For example, Forrester Research have reported that 56% of the world’s 2500 largest organisations use one or more OSS products. These are organisations with considerable internal resources who choose OSS products based on technical quality and the radically different nature of software ownership created by open source terms of distribution.
From a broader business perspective, several innovative business models and new business opportunities have emerged as a result of the OSS phenomenon, and many organisations have begun to capitalise on this. In terms of competitiveness, the OSS phenomenon has created a new service market for commercial enterprises to exploit and there are several examples whereby these companies have innovatively forged competitive advantage. Since purchase price and license fees are not a factor, OSS companies have to compete predominantly in terms of customer service. Since OSS counters the trend towards proprietory monopolies, the OSS model inherently promotes competitiveness and an open market. Also, by having access to source code, traditional barriers to entry which militate against new entrants are lowered.
Although much of the recent OSS debate has focused primarily on desktop applications (Open Office, Mozilla Firefox, etc.), the origins and strengths of OSS have been in the platform-enabling tools and infrastructure components that underpin the Internet and Web services; software like GNU/Linux, Apache, Bind, etc. This suggests that OSS may have a particularly important role to play in the secondary software sector; i.e. in domains where software is used as a component in other products, such as embedded software in the automotive sector, consumer electronics, mobile systems, telecommunications, and utilities (electricity, gas, oil, etc.). With a focus on the...
secondary software sector, different vertical issues, such as embedded software and safety critical applications, are brought to the fore. The differences in how horizontal issues play out across different vertical sectors can be dramatic. For example, the nuances of the software development context in the banking sector are very different from those which apply in the consumer electronics or telecommunications sectors. A vibrant European secondary software sector provides fertile research ground for studying the potential benefits of OSS from a commercial perspective.
With this backdrop, the CALIBRE project\(^6\) has set out to investigate the role of OSS for the European secondary software sector. CALIBRE is conducting a thorough investigation of the role of OSS for European industry the output of which will be an industry-research roadmap. This will enable coordination of industry and academic research interests in this area. A means to achieve this is the establishment of the the European Industry Open Source Software Policy Forum, CALIBRATION. Through a series of workshops and conferences, this forum will investigate and create policy on the role of OSS for European industry, concentrating particularly on the secondary software sector. One of the ideas behind CALIBRATION is for it to serve as an arena where OSS researchers and practitioners can meet to scrutinise research findings as well as generate ideas and empirical data. The forum also represents a crucial step towards assisting the dissemination of open source software to the European secondary software sector.
A first step in organising such an arena would be to create a better understanding of the industry’s current views of and expectations from OSS. This paper is the result of such an enquiry: to assessing the role of OSS in the European secondary software sector – by enabling and facilitating an industry voice.
The paper proceeds as follows. Section II describes the research method adopted in this study. Section III develops a number of themes that characterise what the European secondary software sector itself sees as the potential benefits and threats in the adoption of the OSS model. Section IV builds on these insights and articulates a framework of the role of OSS in a commercial environment; a phenomenon we refer to as Open Source Software, Inc.\(^7\) Finally, Section V concludes the work and points at some future research directions.
II. RESEARCH METHOD
The research approach adopted is inspired by Grounded Theory, particularly as it has evolved through the work of Strauss and Corbin \(6\) and the ‘six thinking hats’ approach by De Bono \(7\). Grounded Theory enables a loosely structured approach and facilitates the establishment of real sentiments and experiences on a particular subject area; in this case the role of open source software in the European secondary software sector. The ‘six thinking hats’ approach encourages informants to think creatively from different perspectives involving both positive and negative thinking and was used as a way to facilitate and focus data collection.
The data was collected at the launch event of the CALIBRATION forum (see above) in The Hague, The Netherlands, on the 19th of September 2004. In order to enable dynamic discussion and the gathering of relevant feedback from attendees at the conference, an industry workshop was facilitated. The participants in the workshop, forming the source of data, were industrialists from multinationals and small and medium enterprises, public sector representatives, and academic researchers from a variety of European academic institutions. Some of the participants were invited, based on a shown commitment to OSS, while other were self-selected\(^6\).
Participants were divided into 7 teams, each with a maximum of 10 members. Each team was given two conceptual ‘thinking hats’ (a summary of each hat is provided in Table I). Findings were captured on ‘Post-it notes’ and subsequently organised on flip charts with the assistance of team facilitators. Each team’s task was to ‘assess the role of open source software for the European secondary software sector’ from the perspectives given by the different hats (see Table I).
The data collected at the workshop was subsequently analysed inspired by the Grounded Theory techniques of open and axial coding. This means that raw data were ‘grouped’ in themes to form topical concepts, which were then abstracted into more generic categories. The analysis was performed in two major phases. The first phase focused on expressed strengths and opportunities vis-a-vis threats and weaknesses.
<table>
<thead>
<tr>
<th>TABLE I</th>
<th>DESCRIPTION OF CONCEPTUAL ‘THINKING HATS’ USED IN THE DATA COLLECTION</th>
</tr>
</thead>
<tbody>
<tr>
<td>Yellow</td>
<td>This hat finds reasons why something will work and why it will offer benefits. It can be used in looking forward to the results of some proposed action. It can also be used to find something of value in what has already happened.</td>
</tr>
<tr>
<td>Black</td>
<td>This is the hat of judgement and caution. The black hat is used to point out why a suggestion does not fit the facts. The black hat must always be logical.</td>
</tr>
<tr>
<td>Red</td>
<td>This hat covers intuition, feelings and emotions. The red hat allows the thinker to put forward and intuition without any need to justify.</td>
</tr>
<tr>
<td>Green</td>
<td>This is the hat of creativity, alternatives, proposals, what is interesting, provocations and changes.</td>
</tr>
</tbody>
</table>
\(^6\)In fact, most ‘voices’ heard during the workshop were self-selected. These people are presumably those that at least want to believe that OSS can bring substantial benefits to their organisations.
\(^7\)In Europe the term ‘libre software’ is often used instead of free and/or open source software. Consequently, we have sometimes used the term ‘Libre Software, Inc.’ to denote the same phenomenon.
This first phase was driven by the way the thinking hats structured the data collection. Hence, the thinking hats also served partly as a descriptive analytic framework. The yellow hat is biased towards strengths and opportunities, while the black hat is biased towards threats and weaknesses. The red and green hats, on the contrary, are not biased in the same ways but provided emotionally based and creative suggestions in both directions.
In the second phase, this initial understanding was used as a basis for identifying higher level categories. These categories together form a framework that describes the potential role of OSS in a commercial environment – Open Source Software, Inc. being the top-level category.
In order to validate the results and to ensure that they adequately represents the experiences and sentiments of the participants, a follow up phase was undertaken (i.e. member checking). This follow up involved the presentation of key findings to the CALIBRATION industry group, who reviewed and approved the findings.
III. THEMES IN THE ROLE OF OPEN SOURCE SOFTWARE
This section summarizes key findings within three overall themes: opportunities, basic premises, and threats. The themes, and their main categories, are generated from the data but are likely also to be influenced by the focus imposed by the different hats (see above).
A. Strengths and Opportunities
One of the most pressing topics was, perhaps not surprisingly, that of intellectual property and patents. This issue was mostly discussed in terms of a threat and a fundamental premise for the success of OSS (see below). However, some participants felt less reason to worry believing that a solution was on the way. There was also wide debate on the use of the GPL with some feeling that licensing issues are not such a problem after all. Politically speaking it was felt that the current resentment towards proprietary software will speed up the adoption process of OSS. Its basic premise challenges deep rooted intellectual property rights.
Another key issue was development costs and time to market, and it was suggested that the reduction of time to market for new products and the overall cost to develop or buy is much less than those solutions offered by proprietary organisations. It was also put forth that wasteful duplication can be avoided.
An interesting issue that emerged is the tension between increased collaboration and increased independence. It was generally acknowledged that OSS allows for greater collaboration, between individual organisations, but also between industry and government. OSS, as a development model, enables the sharing of costs and benefits from a collective pool of knowledge. OSS was also viewed as a means for increasing innovation, and enabling the development of collaborative group wisdom. It offers far-reaching global and social benefits which are not always self-evident or fully understood. It also facilitates geographically-distributed software development. However, in the midst of this spirit of collectivism, it was suggested that OSS enables businesses to pursue their own strategies without being tied to suppliers or vendors, enabling a greater level of flexibility. Interestingly, this collaborative mode of operation seems to blur the separation between competitors and clients, which was regarded as something positive.
A topic related to the community-spirit of OSS and the belief that shared knowledge enables greater innovation is that of potentially increased job satisfaction, by many participants suggested as a key advantage of OSS. It was, furthermore, suggested that OSS will encourage the development of new jobs and opportunities for professionals. One team questioned if OSS was really that different, while others stated that the opportunity for cross-pollination between software developers was a fundamental advantage often emulating in software mutations which lead to innovative breakthrough. The aspect of innovation and breakthrough was put to the fore in a vision of OSS as enabler of increased research and development (R&D) in SMEs.
From a security and quality perspective attendees felt that OSS was a safe option, which is highly transparent and open to scrutiny. Participants also felt that OSS is both sustainable and reusable enabling better long term stability for software code.
B. Threats and Weaknesses
As indicated above, sorting out the issues surrounding intellectual property and patents was regarded key to the successful adoption of OSS; ‘who do I sue and who's going to sue me’, as one workshop participant put it. Another related obstacle is that some companies suggested that their legal teams do not understand OSS licences.
The lack of clear business models which appeal to industry at large are still not widely known or appreciated.
Key issues also related to the standardisation in relation to OSS which many participants felt was urgently needed but perhaps a little premature.
Furthermore, the lack of relevant skills, and a means to support OSS projects and the need for improved collaborative research tools to assist in the dissemination of OSS was reported to be a key issue.
While some participants felt that there was a clear future for OSS, others were somewhat more apprehensive. Comments such as ‘Love the idea, hate the consequence’, ‘Grass roots never grow trees’, and ‘OSS the white Unicorn will be crucified’ were collected and clearly exemplify the divide and strong feeling that are part of the OSS paradigm. It was generally felt that there is a strong need for real success stories to assist in the dissemination of OSS to general business. Questions such as when will OSS end and where will the next OSS leaders come from were also considered. Others believed that patents will kill software and that OSS is not converging but diverging into chaos.
IV. OPEN SOURCE SOFTWARE, INC.
The emerging commercial incarnation of OSS – Open Source Software, Inc. – naturally retains many of the characteristics of the ‘traditional’ OSS model. However, the commercial setting introduces a number of new complications. For example, the community-based development model may not be completely compatible with a corporate environment. Business strategy becomes a
central concern, and the very acceptance of OSS as a serious contender becomes a critical issue. Fig 1 shows these high-level factors that appear central to the success of Open Source Software, Inc., together with the required social, technical and legal infrastructural foundation on which to build it.
In the remainder of this section, we will briefly discuss each of these factors and look at how the Open Source Software, Inc. stakeholders choose to characterise them during the workshop, as reflected in Section III.
A. Technical Infrastructure
Since it constitutes the software technology as such, the technical infrastructure is a natural key foundation for OSS success. It is believed that the OSS model leads to the creation and adoption of open standards and increased software reuse, which are important factors in adoption of OSS. Other factors that were seen as OSS success-drivers are the perceived proven quality and increased control over the technical infrastructure.
However, there are issues related mainly to reliability that needs to be addressed. Especially since the secondary software sector brings OSS to previously unproven domains, such as safety-critical systems. There were also concerns raised about a perceived lack of support and, generally, about the issue of ensuring the longevity of OSS products. Proprietary software companies have tried to undermine OSS by claiming that long-term support of OSS products is uncertain due to the voluntary and self-selected nature of the community. Obviously, Open Source Software, Inc. need to prove them wrong.
Perhaps due to the general interest in and success of the OSS model, there are a multitude of projects and products to select from. This raises the question of how best to find a technical solution that is right for the current problem or project.
B. Social Infrastructure
The emphasis on social infrastructure is one of the main tenets of OSS. Leveraging the community-based model that underpins OSS development is thus key to a successful Open Source Software, Inc. Positive aspects of this is the potential of increased collaboration, and specifically joint R&D efforts. This is particularly important from an SME perspective since it may enable smaller companies, with limited resources to participate in cutting-edge research. Increased collaboration is also likely to lead to knowledge sharing and, in the end, shared costs regarding software development.
However, a basic foundation for such collaboration and sharing to happen is that companies find ways of building and sustaining OSS communities, and learn how to build trust within those communities. The relationship between commercial organisations and already established OSS communities will be a challenge for Open Source Software Inc. A model based on sharing obviously assumes that as a user of the community's results, you are also supposed to give something back. How and what to give back to 'the community' is often unclear.
A further concern regarding the social infrastructure has to do with whether or not it is at all meaningful to discuss Open Source Software, Inc. as a European venture. In many ways, OSS is an international phenomenon, and it seems to be important not to overlook possible global collaboration, especially with Asia and USA.
C. Legal Infrastructure
One of the most contentious legal banana-skin for Open Source Software, Inc. relates to software patents. Patents can make a good deal of sense in theory – as initiatives which stimulate publication of non-trivial ideas. Clearly, they can play a role in improving innovation and creativity, giving small players a chance, and consequently benefiting society as a whole. However, one can certainly disagree with their implementation in practice (even if it is difficult to separate theory and practice). Interestingly, some of the largest commercial OSS players are also supporters of patents. For example, IBM, HP and Sun are high-profile examples of companies who support software patenting but who have also provided significant benefit and support to OSS. The basic argument from these companies is that patents are necessary and important, and the real problem is that too many spurious patents have been granted which have actually served to stifle innovation. The guarantee of exclusively-held monopoly rights over a long period of time is clearly not suited to the spirit of the current IT era. Interestingly, it is not too much of a stretch to define OSS as publication of non-trivial ideas, with an explicit guarantee of continued availability, which seeks to protect the interest of the small players, for the overall betterment of society, as others learn from and improve on the original ideas. This shows how close OSS and intellectual property protection are at heart. However, the stimulation of innovation and creativity, which should be the fundamental rationale behind intellectual property protection, has failed miserably in the software area [8].
Hence, a solid legal infrastructure is undoubtedly an absolute key to the success of Open Source Software, Inc. On the positive side, there seems to be a strong motivation to solve the legal, licensing, and intellectual property rights problems. Emerging open standards are important in this respect and the general feeling is that legislation is eminent. There are still uncertainties about copyright legislation and EU policy regarding software patents.
Another problem is the 'ownership mindset' that prevails in many companies. People are simply used to think in terms of owning tangible assets, and there is a required conceptual move before sharing can become as strong a metaphor. Another potential problem is the lack of understanding of the OSS legal infrastructure within many organisations.
D. Corporate Environment
Leveraging the potential of OSS within a commercial setting means that it will have to adapt to and exist within a corporate environment, which could be quite different from the 'traditional' hacking culture often associated with the OSS movement. However, it is envisaged that this cultural cross-breed will lead to increased cooperation at the personal level, increased job satisfaction and more flexible forms of employment. The latter also relates to companies believing that the OSS model will help them recruit the best developers available.
Then again, there are a few corporate environment factors that seem to mitigate against the successful construction of Open Source Software, Inc. First of all, there is currently a lack of OSS expertise. Such expertise would thus be required in order to enable the recruitment of the best OSS developers. There is also a perceived resistance to change in organisations, where often a few enthusiasts advocate OSS and feel that they are not listen to by management.
The OSS movement is often portrayed as an extreme collectivist approach. For example, Bob Young, the founder of Red Hat, adapted the communist manifesto to characterise it as ‘from the programmers according to their skills, to the users according to their needs’ [9]. Although this purported collectivism has been questioned [2, 10] it still permeates the mainstream OSS discourse and indeed complicates the integration of the OSS model and the commercial environment.
This is also related to the meritocratic structure of OSS communities, which may not go well with traditional power and promotion hierarchies in commercial organisations. This makes one wonder where the next OSS leaders will come from? To date, a strong charismatic leader has often proved to be key to the success of OSS (such as Linus Torvalds in the case of Linux).
E. Business Strategy
For apparent reasons, the business strategy of Open Source Software, Inc. will be quite different from organisations built around a proprietary software model. Besides the potential benefits mentioned above, a basic incentive for adopting a OSS approach is to cut costs. The social infrastructure and the sharing mindset of OSS helps to lower barriers (not only in terms of R&D participation) and to reduce the risk involved in product development. Increased software reuse is also likely to lead to shorter time to market.
However, to some, the actual value of going open source is questionable, and there is an element of risk associated with a blind faith in OSS as finally providing us with the long awaited silver bullet7. There is also a perceived lack of coordination of Open Source Software, Inc. and a need for concrete and proven business models.
Again, the success of Open Source Software, Inc. depends on the ability to create sustainable OSS communities, which also affects business strategy. Due to the inherent risks involved in changing the business strategy towards OSS, there may be a need for maintaining a fall-back position, and perhaps adopt OSS incrementally.
F. Acceptance
In order for Open Source Software, Inc. to become reality, it must gain acceptance. Acceptance, in this case, is twofold. First, any company going open source run the risk of being rejected by the existing OSS community. Second, Open Source Software, Inc. must be able to win customers over to the OSS camp and be able to convincingly explain the many benefits and potential shortcomings.
Large commercial organisations are not always well perceived within the OSS community. However, OSS offers organisations the ability to appear progressive and 'open', thereby avoiding potential bad press and negative public opinion. However, it is increasingly important that the current enthusiasm surrounding OSS is harnessed and promoted through well documented success stories. That is if Open Source Software, Inc. is to be widely accepted as a realistic opportunity.
V. CONCLUSION
This paper has presented a study of the role of open source software (OSS) in the European secondary software sector. Data for the study was gathered in a workshop session during an industry research conference with key organisations.
From our analysis we can conclude that the European secondary software sector recognise the benefits of leveraging OSS, but are aware of key issues pertinent to its success. There are numerous pressing issues, such as intellectual property rights and patents. Other such issues include standardisation, the development of proven business models and the acquisition of skills required to successfully engage in OSS projects. These issues must be addressed before OSS can reach widespread adoption.
One of the most interesting potential benefits of OSS seems to be the possibility for SMEs with limited budgets to engage seriously in research and development. There are also benefits at both individual and organisational level from a strengthened identity and autonomy. At the same time, OSS facilitates contributing to a shared pool of knowledge and expertise in increased collaboration with both customers and competitors.
An integral part of this research was the development of a conceptual framework which reflects the basic factors that this research suggests will facilitate the successful emergence of OSS in a commercial setting (i.e. the success of Open Source Software, Inc.) Fundamentally, the social, technical and legal infrastructure must be in place in order to ensure the success of Open Source Software, Inc. Building on this foundation, companies will need to align their business strategies with a supportive corporate environment and ensure internal and external acceptance of the OSS model.
This research will continue to be a key element in the development of the European Industry Open Source Software Policy Forum, CALIBRATION. The continued academia-industry collaboration in this forum will serve as a basis for furthering our understanding of the industry’s OSS related needs and expectations and will help to refine and further develop the results presented in this paper. Further workshops, like the one from which the data for this paper is derived, are planned over the course of the next two years and will enable a detailed picture to be
7As suggested by Brooks, there are no silver bullets [4].
Proceedings of the First International Conference on Open Source Systems Genova, 11th-15th July 2005 Marco Scotto and Giancarlo Succi (Eds.), pp. 82-87
developed on the real challenges and advantages pertinent to the OSS phenomenon.
As a concluding remark we would like to draw attention to one workshop participant's suggestion that OSS needs a moon-project really to take off. Perhaps that is the case, and perhaps Open Source Software, Inc. can find inspiration in former US president John F Kennedy's famous Rice Stadium 'moon speech', 12 September 1962, which, in the context of OSS might have looked something like this: We choose open source software. We choose open source software, not only because it is free, but because it is hard, because that goal will serve to organise and measure the best of our energies and skills, because that challenge is one that we are willing to accept, one we are unwilling to postpone, and one which we intend to win.
VI. ACKNOWLEDGMENTS
This work has been financially supported by:
- the European Commission through the FP6 project CALIBRE (Co-ordination Action for Libre Software Engineering for Open Development Platforms for Software and Services), project no 004337
- the Science Foundation Ireland Investigator Programme, B4-STEP (Building a Bi-Directional Bridge Between Software Theory and Practice).
VII. REFERENCES
|
{"Source-Url": "https://aran.library.nuigalway.ie/bitstream/handle/10379/1513/Morgan_L_15-flaherty-paper.pdf?isAllowed=y&sequence=1", "len_cl100k_base": 6049, "olmocr-version": "0.1.53", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 27581, "total-output-tokens": 6784, "length": "2e12", "weborganizer": {"__label__adult": 0.0002646446228027344, "__label__art_design": 0.0003414154052734375, "__label__crime_law": 0.00036215782165527344, "__label__education_jobs": 0.002162933349609375, "__label__entertainment": 8.088350296020508e-05, "__label__fashion_beauty": 0.0001004338264465332, "__label__finance_business": 0.002681732177734375, "__label__food_dining": 0.00031113624572753906, "__label__games": 0.0006341934204101562, "__label__hardware": 0.0003767013549804687, "__label__health": 0.0002605915069580078, "__label__history": 0.00023317337036132812, "__label__home_hobbies": 5.829334259033203e-05, "__label__industrial": 0.0002312660217285156, "__label__literature": 0.0003018379211425781, "__label__politics": 0.0004711151123046875, "__label__religion": 0.0002579689025878906, "__label__science_tech": 0.00982666015625, "__label__social_life": 0.00011849403381347656, "__label__software": 0.033294677734375, "__label__software_dev": 0.947265625, "__label__sports_fitness": 0.0001455545425415039, "__label__transportation": 0.0002899169921875, "__label__travel": 0.0001577138900756836}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 33380, 0.01189]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 33380, 0.18184]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 33380, 0.9546]], "google_gemma-3-12b-it_contains_pii": [[0, 673, false], [673, 6073, null], [6073, 11986, null], [11986, 18271, null], [18271, 24084, null], [24084, 30589, null], [30589, 33380, null]], "google_gemma-3-12b-it_is_public_document": [[0, 673, true], [673, 6073, null], [6073, 11986, null], [11986, 18271, null], [18271, 24084, null], [24084, 30589, null], [30589, 33380, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 33380, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 33380, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 33380, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 33380, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 33380, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 33380, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 33380, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 33380, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 33380, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 33380, null]], "pdf_page_numbers": [[0, 673, 1], [673, 6073, 2], [6073, 11986, 3], [11986, 18271, 4], [18271, 24084, 5], [24084, 30589, 6], [30589, 33380, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 33380, 0.12381]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
92fe121e50813ada7c3aa6c9188797be0f48346d
|
PROCEEDINGS OF THE INTERNATIONAL CONFERENCE ON PARALLEL AND DISTRIBUTED PROCESSING TECHNIQUES AND APPLICATIONS
PDPTA'98
Volume I
Editor:
H. R. Arabnia
Associate Editors:
Rajkumar Buyya
R. A. Olsson
R. Pandey
X-H Sun
Las Vegas, Nevada, USA
July 13 - 16, 1998
CSREA Press
ARéVi :
A Distributed Virtual Reality Toolkit Based on
an Oriented Multiagent Language
V. Rodin, S. Morvan, A. Nédélec
Ecole Nationale d’Ingénieurs de Brest
Laboratoire d’Informatique Industrielle
Technopôle Brest-Iroise, CP 15
29608 Brest Cedex, France
e-mails:{rodin,morvan,nedelec}@enib.fr
Abstract ARéVi is a Distributed Virtual Reality Toolkit. ARéVi is built on our dynamic multiagent language, oRis. This dynamic language is particularly well adapted to the creation of co-operative applications. In fact, during an ARéVi session, this language allows the addition of new entities, and the modification of the behavior of an entity or a whole entity family. The modifications may either be introduced by the user or received by the network. In this article, we mainly present the co-operative characteristics of ARéVi which allow several applications (ARéVi sessions) to share the same 3D universe.
Keywords: Distributed Virtual Reality, Dynamic Multiagent Languages, Java Network Communication, Mobile Agents.
1 Introduction
ARéVi (Atelier de Réalité Virtuelle) is a platform for the development of applications in Distributed Virtual Reality. It is developed in C++ and its kernel is independent from 3D libraries. It may be used for rapid application development in distribution of “real time” 3D visualization, with or without the immersion of human operators. It may also be used for co-operative work applications or distributed applications integrating universes inhabited by agents whose behaviors are more or less complex. The behaviors of those agents are very precisely and simply described in oRis [1, 2], an agent-oriented object language.
The main two aspects of ARéVi are the agent distribution and the co-operation between agents. For example, ARéVi allows the creation of distributed simulations where the different agents are spread out on different nodes of a network. This particularly allows to:
- distribute the agent behavior calculations on several computers,
- make several human agents co-operate, each of them driving a particular application.
Besides, co-operation between software agents is possible, whether the agents are distributed or not. On each site participating to a distributed co-operative session of ARéVi, one can make “real agents” evolve among agent proxies or “ghosts” whose behavior is simpler than their “real agents” and are located on distant sites participating to the session.
At any time, an ARéVi application may either join or leave a collective simulation, bringing along or taking away its own agents. Eventually, when leaving a simulation, it may move its agents towards other applications which participate to the simulation. In fact, to move an agent, it is only necessary to transmit some oRis code through the network.
Finally, some applications may simply listen to events on the network, thus only moving agent's ghosts whose "real agents" participate to the application.
Our study is part of a large amount of research works in virtual reality and distributed simulation toolkit such as VR-DECK [3], DIVE [4], NPSNET/DIS [5, 6], and on 3D animation and interaction as VB-II [7], Virtual Studio [8].
These last years, concurrently to those studies, a great effort has been made by designers and publishers so as to improve the rendering algorithm and elaborate efficient graphic engines. Various commercial products can be found: World Toolkit (Sense8, 1991), dVISE (Division) or Clovis (MEDIALAB, 1995).
As far as standardization is concerned, we witness the emergence of a description standard for virtual reality applications: V.R.M.L. 2.0 [9], even though the behavioral or distributed aspects are not really taken into account yet. On the communication part, the next version of the IP protocol (IP v6) introduces the notion of flow and includes the multipoint in native, essential in Distributed Virtual Reality.
Therefore, a proposal for a new toolkit architecture for virtual reality has to be widely opened and as independent as possible from the rendering libraries, so as to be able to use the best solutions [10, 11]. It should be able to describe larger and larger environments, made up of agents with more and more complex behaviors.
Firstly, in the following part of this article, we will present our ARéVi platform and oris language. Then, we will describe the distributed aspects of our platform in details.
2 ARéVi and oRis
2.1 ARéVi Platform
ARéVi is a Distributed Virtual Reality platform. ARéVi lies in the Entity, Scene and Viewer concepts (see figure 1).

Figure 1: Entity, Scene and Viewer concepts.
The entities are identified agents in space, with a 3D representation. This representation includes animations (succession of consecutive representations) as well as several levels of details (reduction of the facets' number according to the distance from the camera). Then, the entities may be specialized (in an object programming sense) as cameras, lights or every other kind needed by the user [12].
In an ARéVi session, each entity is an agent. Therefore, we have built our ARéVi platform around our dynamic multiagent language, oris.
2.2 oRis Language
Multiagent formalism as well as the dynamic characteristics and generics of a language are specifically well adapted in a virtual reality system context.
Let's consider two kinds of existing languages: multiagents and "general" object oriented. Most multiagent systems, as described by Starlogo [13], are designed for a specific application and cannot be used in another context. On the opposite, general languages, for example Java, are by definition not specialized, they have some dynamic properties but not all those we require: in particular, the instance granularity is not present. In our ARéVi platform we want to be able to re-define a method not only on the class level, but also on the instance level at the same time, which means that the instance may have a very differ-
rent behavior from those defined in its original class.
To totally fulfill our needs, we have developed our own language: the oRis language which is a dynamic multiagent language [1, 2].
2.2.1 oRis concepts
Firstly, oRis is an object language: use of classes with attribute and methods. The syntax is close to C++. It embeds most of the language possibilities including multiple inheritance. It is also an agent language: every object with a main() method becomes an agent, or active object. This method is cyclically executed by the system scheduler and thus contains the entity behavior.
It has to be noticed that, during a simulation cycle the activation order of the different main() methods is randomly accessed.
2.2.2 oRis’s dynamic properties
oRis is also a dynamic language. It is able when executed to accept new code, define new classes and re-define methods on the class level as well as on the instance level. Then, it is possible to add on the instance level the definition of a new method which does not exist in the original class. All those possibilities make this dynamic language particularly well adapted to the creation of co-operative applications. In fact, during a session, this language allows the addition of new entities (planned or not when starting the session), the modification of behavior on an entity or an entire entity family. Those modifications may either be introduced by the user (through an HCI or a peripheral) or by the network.
2.2.3 oRis agents’ naming
The oRis language proposes the type “name of instance” which makes it possible for the differentiation of instances. This type is very similar to the notion of pointer to instances in C++. Actually, a value of the type “name of instance” is not an instance but something allowing to refer to it.
A value of the type “name of instance” is written as a class name followed by a dot and an integer representing an instance number which allows to make distinction between instances of the same class. For a given class, this integer is automatically incremented by the system when creating each instance with the new instruction. If you need to define yourself the instance name, you can use the oRis create() function. The creation doesn’t occur in the case of an instance already named.
2.2.4 oRis code examples
The following oRis code states the definition of a class A as well as the instantiation of three agents from this class:
```plaintext
// class A
class A{
void main(void);
}
void A::main(void){
println("I am ",this);
}
// instantiates creation execute{
new A; // --> A.1
create(A.4); // --> A.4
new A; // --> A.5
}
```
The result of two cyclical executions of the agent’s method main() are represented beneath:
```
I am A.4
I am A.1
I am A.5
I am A.1
I am A.5
I am A.4
...
```
During this execution, the following oRis code can also be introduced if defined by a user or received from the network. In this code we define a new class B, which inherits from class A, we instantiate an agent from this class and we also redefine dynamically the method main() of the pre-instantiate agent A.4.
class B : A {
void setB(int value);
int b;
}
void B::setB(int value){
b = value;
}
// instance creation from class B
execute{
new B; // --> B.1
}
// A.4 : main's method re-definition
void A.4::main(void){
println("I am an agent, my name is A.4");
}
Therefore, after the insertion of this code,
The results of two cyclical executions of the agent's method main() are represented beneath:
I am A.1
I am B.1
I am an agent, my name is A.4
I am A.5
I am A.1
I am A.5
I am B.1
I am an agent, my name is A.4
...
2.2.5 oRis/C++ coupling
oRis allows a deep coupling with C++ language. The programmer can specify a connection between an oRis class and a C++ class. The call of native reported oRis methods initiates the associated C++ methods.
Thanks to the oRis/C++ coupling, ARéVi offers the user predefined oRis classes (native methods) which correspond to 3D graphical classes libraries like OpenGL, OpenInventor on Silicon Graphics.
Moreover, thanks to the oRis/C++ coupling, oRis may be connected to other languages. For example, we are able to call Java for network communication.
3 Distribution in ARéVi
In its basic version, oRis authorizes different types of communications between agents located on the same machine: synchronous (direct method's call), peer-to-peer (message box) and diffusion (events emission towards agents).
Thus, we have developed a communication layer allowing communication among distant agents located on different machines.
Besides, on each collaborating site in a distributed ARéVi session, we have decided to make "real" agents (full behavior agents) evolve between proxies ("ghosts" of "real" agents having a simplified behavior) located on the other sites. The "real" agent management is made in oRis in order to take advantage of the possibilities given by the communication layer between agents on other sites. Agent migration is also made by simply transmitting some oRis code on the network.
3.1 Distribution of agents communication
In ARéVi, low level communications are performed thanks to Java programming language. The choice of this language may be penalizing when talking about performances (-20%), but it offers some very interesting development facilities in terms of simplicity (multi-threading), safety (pre-existing group of safe communication classes), HCI (JavaBeans), integration of multimedia processing (Java Media Players), high level network extension (servlets, RMI, alets), interoperability (CORBA's IIOP) and database connectivity (JDBC) (see figure 2).
Figure 2: Low level communications in ARéVi.
First of all, to launch an ARéVi session, it’s necessary to start on the Java Virtual Machine. Then, the ARéVi session has to be launch in the main Java thread. This architecture allows to very easily add new functionalities by setting them in new threads.
Moreover, because of oRis/C++ coupling, it is possible to write, in oRis, C++ native methods. With J.N.I (Java Native Invocation) we have another closing connection between Java and C++, and thus we are able to reach Java objects from oRis agents, through a pointer on the Java Virtual Machine. The whole communication is written in Java, the programmer only uses the oRis layer, where everything is agent. The C++ is acting as an interface from oRis to Java.
We have developed different communication classes (Unicast, Broadcast, Multicast), with each time, the notion of clients and servers. Each client and each server is a particular oRis agent. Therefore, by inheritance, any kind of agent can transmit or receive a message. Each message passing through the network is identified thanks to the transmitter agent’s name and IP address.
Those different functionalities allowed us to extend the communication basis classes between oRis agents. Thus, oRis agents on different machines may use both kinds of communications, asynchronous (peer-to-peer) or diffusion (emission of events towards the agents).
Today, we are working on the synchronous communication between distant agents (direct method’s call). For this, we are thinking about the use of R.M.I Java package (Remote Method Invocation) or a compliant CORBA 2.0 broker allowing us to use the Common Objects Services Specification (COSS) they are defining for distant method invocation.
3.2 “Real” and “ghosts” agents management
With the approach (agent/ghost) we use for the distribution of ARéVi sessions, co-ordination between “real” agents and his ghosts is made on a very simple way by writing oRis classes. Therefore, to distribute an agent, it only has to inherit the co-ordination classes.
3.2.1 “Real” and “ghosts” creation
When creating a shared real agent, an ARéVi application diffuses this creation to other applications involved in the co-operative session. It asks them to create a ghost (sending some oRis code). The created ghost will evolve thanks to its simplified behavioral model.
The oRis code sent for the creation of ghosts has to take into account the naming of oRis agents described in section 2.2.3.
In fact, in the case of simultaneous instantiation of two agents from class A on different hosts (IP 1 and IP 2), those agents can have the same name. Therefore, it is necessary to distinguish the ghosts from the agents. The solution is to create a ghost for each real agent.
This can be done by simple inheritance and diffusion through the network so that the names of created ghosts enclose the IP address of the host on which the agent has been created (IP1A.1 on host IP 2 or IP2A.1 on host IP 1).
Figure 3 presents the ghosts’ creation on hosts IP 2 and IP 3 of the real agent A.1 located on host IP 1.

This creation implies the emission of oRis code on the network. This code described hereafter contains, the new class (IP1A) statement deriving from class Ghost, the simplified model of real agent, and the order of creation of the ghost IP1A.1.
```java
class IP1A : Ghost {
// ghost's naming of an agent from // class A located on host IP 1
// instance creation of ghost IP1A.1
execute{
create(IP1A.1) // --> IP1A.1
}
}
```
To make it simple and fast, the code emission is made in multicast. But using a datagram transmission can induce a loss of information on the network. The fact that an order of ghost’s creation does not reach its destination may occur. We have set up a simple and reliable mechanism to solve the problem. Actually, when an application is ordered to update an unknown ghost, it asks the broadcasting application to send further information in peer-to-peer TCP (reliable mechanism).
### 3.2.2 “Real” and “ghost” behavior
“Real” agents have a developed behavior described in oRis. Ghosts have a simplified behavioral model which requires few calculation. Today, this model is a kinematical model (coordinates, position and orientation, speed and acceleration).
“Real” agents are aware of the model used by ghosts, which allows to practice some “dead-reckoning”: they only diffuse their state to their ghosts if this one is significantly different from the state predicted by ghosts. This action aims to reduce the traffic on the network.
When the difference is important between the agent’s real state and the state of the ghost predictive model, the agent transmits towards its ghosts an updating order (still by sending some oRis code).
Figure 4 presents the updating of ghosts from the session holding the real agent.

The oRis code sent to update a ghost’s position is very simple:
```java
// updating order of a ghost's position
execute{
IP1A.1 -> move (x,y,z);
}
```
The method called `move()` corresponds to a method common to every agent in an ARéVi session. It allows the modification of the agents’ position in 3D space.
### 3.2.3 “Real” and “ghost” interactions
During the interaction of the user or an agent with another agent, things will happen in a different way whether this latest is a real agent or a ghost:
- the real agent will treat the interaction,
- the ghost will send a request (in oRis) to its leading agent or, if it is able to do it, treat by himself the interaction.
In the ghost request mode to the leading agent, the communication uses the TCP mode. Therefore, the agent is able to send to its “master” an order to move. Then the “master” will transmit this order to the ghosts located on other hosts (see figure 5).
3.2.4 Agents’ migration
In our ARéVi platform we need to have the ability to move agents from an ARéVi session to another. These migrations can only be obtained if it’s possible to move our agent’s behavior on the network.
This may be easily done thanks to orIs because, to move an agent, it is only necessary to transmit, in TCP mode, some orIs code through the network described in a simple way as follows:
```java
// class A
class A{
// methods runnable by an A agent
// instance creation order
execute{
new A; // --> A.1
}
}
```
For ghosts’ renaming reasons we need to transmit in UDP mode the following orIs code:
```java
// class A
class IP2A : Ghost{
// ghosts’ renaming of an agent from
// class A located on host IP 2
// ghosts’ renaming order
execute{
IP1A.1.rename(IP2A.1);
}
}
```
The migration of agent A.1 from host IP 1 toward Host IP 2 is represented in figure 6.


4 Conclusion
The ARéVi platform, built around the orIs language, has been made for developing Distributed Virtual Reality applications. The existence of a dynamic multiagent language into the system allows us to create modular 3D universes; modularity is made possible by the lack of general controller and thus by the use of elementary “bricks” with their own goals (agents).
Thanks to orIs, we are also able to modify these 3D universes when a session is in progress; this may be done by introducing some orIs code by a user action (through an HCI or a peripheral) or by the network.
This essential characteristic of the orIs language allowed us to develop a group of communication classes (asynchronous, broadcast) and to move agents on the network. The development of a Distributed Virtual Reality application according to the “real” and “ghost” agent model adopted under ARéVi may be done by simple inheritance of existing classes. The classes we have developed allow proper
“ghosts” naming on the network and suitable interactions and updates between “real” entities and their “ghosts”.
5 Future works
Today, we work on the synchronous communication (call of methods) between distant agents. We are also studying the great possibilities given by the oRis language which makes feasible cooperative work prototyping according to specific configurations. For example, the distribution of an agent’s methods on different sites to manage load balancing between workstations and the number of connected users on the same distributed ARéVi session.
References
|
{"Source-Url": "http://labsticc.univ-brest.fr/~rodin/Publis/PDF/Rodin98a.pdf", "len_cl100k_base": 4683, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 9630, "total-output-tokens": 5779, "length": "2e12", "weborganizer": {"__label__adult": 0.0003974437713623047, "__label__art_design": 0.0004525184631347656, "__label__crime_law": 0.0003249645233154297, "__label__education_jobs": 0.0004982948303222656, "__label__entertainment": 0.00010395050048828124, "__label__fashion_beauty": 0.0001481771469116211, "__label__finance_business": 0.00022077560424804688, "__label__food_dining": 0.00035119056701660156, "__label__games": 0.0011692047119140625, "__label__hardware": 0.0011844635009765625, "__label__health": 0.0005631446838378906, "__label__history": 0.00029277801513671875, "__label__home_hobbies": 7.408857345581055e-05, "__label__industrial": 0.00046634674072265625, "__label__literature": 0.00022864341735839844, "__label__politics": 0.0002453327178955078, "__label__religion": 0.000492095947265625, "__label__science_tech": 0.05145263671875, "__label__social_life": 8.630752563476562e-05, "__label__software": 0.01035308837890625, "__label__software_dev": 0.9296875, "__label__sports_fitness": 0.00037479400634765625, "__label__transportation": 0.0004343986511230469, "__label__travel": 0.0002651214599609375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22383, 0.02929]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22383, 0.52523]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22383, 0.8922]], "google_gemma-3-12b-it_contains_pii": [[0, 275, false], [275, 3073, null], [3073, 6259, null], [6259, 9391, null], [9391, 11985, null], [11985, 15112, null], [15112, 17880, null], [17880, 19900, null], [19900, 22383, null]], "google_gemma-3-12b-it_is_public_document": [[0, 275, true], [275, 3073, null], [3073, 6259, null], [6259, 9391, null], [9391, 11985, null], [11985, 15112, null], [15112, 17880, null], [17880, 19900, null], [19900, 22383, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 22383, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22383, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22383, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22383, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 22383, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22383, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22383, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22383, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22383, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22383, null]], "pdf_page_numbers": [[0, 275, 1], [275, 3073, 2], [3073, 6259, 3], [6259, 9391, 4], [9391, 11985, 5], [11985, 15112, 6], [15112, 17880, 7], [17880, 19900, 8], [19900, 22383, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22383, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-08
|
2024-12-08
|
ab92122e93a6d9b2b62b42e8a40840149b64de47
|
Elementary transformation analysis for array-OL
Paul Feautrier
To cite this version:
HAL Id: hal-02102502
https://hal-lara.archives-ouvertes.fr/hal-02102502
Submitted on 17 Apr 2019
HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.
Elementary transformation analysis for Array-OL
Paul Feautrier
May 2007
Research Report N° 2007-28
Elementary transformation analysis for Array-OL
Paul Feautrier
May 2007
Abstract
Array-OL is a high-level specification language dedicated to the definition of intensive signal processing applications. Several tools exist for implementing an Array-OL specification as a data parallel program. While Array-OL can be used directly, it is often convenient to be able to deduce part of the specification from a sequential version of the application. This paper proposes such an analysis and examines its feasibility and its limits.
Keywords: Array-OL, multidimensional signal processing, program analysis
Résumé
Array-OL est un système de spécification de haut niveau spécialisé dans la définition d’application de traitement du signal intensif. Il existe plusieurs ateliers qui transforment une spécification Array-OL en un programme à parallélisme de données. Bien que Array-OL puisse être utilisé tel quel, il est souvent intéressant de pouvoir déduire ses paramètres d’une version séquentielle de l’application. Ce rapport propose une telle analyse et en examine la faisabilité et les limites.
Mots-clés: Array-OL, traitement du signal multidimensionnel, analyse de programme
1 Introduction
In the Array-OL formalism [1, 2], a program is a network of processes which communicate through shared arrays. A process is made of one or more parallel loops. At each iteration of these loops, a task (or elementary transform) is executed. The elementary transform may contain one or more loops, which are executed sequentially.
The execution of an elementary task can be decomposed into three steps:
- Move portions of the input array(s) (regions) to the local memory of the processor executing the task.
- Execute the elementary transform and generate portions of the output array(s).
- Move the results to the output array(s).
In order to simplify code generation, the input and output regions must move uniformly across the shared arrays. It is admissible that each elementary transform use only a subset of regularly spaced entries in the input and output regions. In the present version of the software, regions must not overlap, as this would precludes parallel execution of the outer loops. The useful elements of a region are collected in a pattern, which must be a rectangular parallelepiped of fixed size.
The Array-OL formalism may be used directly. The programmer is responsible for constructing the elementary transform, identifying the input and output regions, checking parallelism and specifying the regions parameters. Another possibility is to infer the Array-OL specification from a sequential version of the program. This requires the solution of three problems:
- Rewriting the sequential program in such a way that the outer loops have no dependences.
- Deducing the shape and size of the regions from an analysis of the array subscript functions.
- Rewriting the sequential code by substituting pattern accesses to the original array accesses.
This note is dedicated to a proposal for the solution of the second and third problems. The assumption is that one is given the sequential code, together with a list of input and output arrays, and an indication of which loop(s) are to be considered as the outer (repetition) loop(s).
2 Paving
Let $A$ be an input or output array and let its occurrences in the sequential code be numbered from 1 to $N$. Let $r$ be the counter(s) of the repetition loop(s), and let $j^k$ be the counter(s) of the inner loop(s) that surround occurrence $k$ of $A$. Let $e^k(r, j^k)$ be its subscript function. $e^k$ is a vector function whose dimension is the rank of $A$.
To be amenable to an Array-OL implementation, the subscript function $e^k$ must be affine in $r$ and $j^k$. A convenient way of checking this property consists in computing the two Jacobian matrices:
\[ P^k = \left( \frac{\partial e^k}{\partial r^\beta} \right) \quad B^k = \left( \frac{\partial e^k}{\partial j^k} \right), \]
checking that they do not depend on \( r \) or \( j^k \), and verifying the identity:
\[ e^k(r, j^k) = P^k r + B^k j^k + e^k(0, 0). \]
In Array-OL terminology, \( P^k \) is the paving matrix, and \( e^k(0, 0) \) is the origin of the paving. The elements of these entities may be numbers, or they may depend on constants, which must be given numerical values just before code generation. References with different paving matrices may be separated by arbitrary distance in the source or target array; it is not possible to group them efficiently; they must be implemented as separate channels.
In the following example:
```c
myTE( in[][], out[]){
for(i=0;i<7; i++) // boucle TE
{
for ( k=0;k<11;k++)
{
S=0;
for(j=0;j<100;j++)
{
S+= in[0][j+11] * in[i+1][k+j];
}
out[ i][k]=S;
}
}
```
there are two references to `in` with respective subscript functions \( e^1(i, k, j) = \begin{pmatrix} 0 \\ j + 11 \end{pmatrix} \)
and \( e^2(i, k, j) = \begin{pmatrix} i + 1 \\ k + j \end{pmatrix} \). The corresponding paving matrices are \( P^1 = \begin{pmatrix} 0 & 0 \\ 0 & 1 \end{pmatrix} \) and
\( P^2 = \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix} \). Hence, the two accesses must be handled separately.
In the following, I assume that accesses to \( A \) have been partitioned according to their paving matrix, and consider only one partition at a time. The size of the repetition space is deduced simply from the bound(s) of the elementary transform loop(s). In the Spear/DE implementation of Array-OL, there may be further constraints on the paving matrix (e.g. that it be a permutation of a diagonal matrix).
### 3 Pattern and fitting
A pattern is a compact specification of all the elements of an array that are accessed, with references having the same paving matrix, in one iteration of the external loop(s).
When discussing patterns, one has to consider three frames of reference (see Fig. 1). The first one is the original (input or output) array. Its dimension is the rank of the array,
Figure 1: Data access in Array-OL
noted |A|, and its coordinates are called *subscripts*. The shape of an array is always a (hyper-) rectangle.
The second frame of reference is the iteration space of the inner loops of the elementary transform. Its dimension is the number of loops enclosing the reference, noted $d^k$, and its coordinates are called *loop counters*. There may be as many iteration domains as there are references, or several references may share the same iteration domain. The shape of an iteration domain is arbitrary. The only requirement in the present context is to be able to construct its vertices, either because the iteration domain is rectangular, or because it can be expressed as a convex polyhedron with parameters in the constant terms only. The iteration domain of reference $k$ will be denoted as $D^k$ in what follows.
The third frame of reference is the pattern. According to Boulet [1] the pattern is always of rectangular shape. The pattern associated to reference $k$ is denoted by $T^k$ and its dimension is $p^k$. The associated fitting matrix, $F^k$, connects the pattern space to the array space and its dimension, accordingly, is $|A| \times p^k$.
The relation of these objects are as follows. Firstly, the local subscript function $f^k(j^k) = B^k j^k + e^k(0,0) = e^k(0, j^k)$ gives the coordinates of an array cell relative to the reference point $P^k_r$ which moves according to the paving matrix.
Next, the image $f^k(D^k)$ is the *footprint* of reference $k$. Its shape is arbitrary. The images of the vertices of $D^k$ by $f^k$ form a superset of the vertices of the footprint; a representation as a convex polyhedron can be recovered by one application of the Chernikova algorithm [3].
Lastly, the image of the pattern by the fitting matrix must enclose the footprint, and it must be feasible to retrieve a datum from the pattern instead of the original array. This implies that there exists a function $\phi^k$ from $D^k$ to $T^k$ such that for every iteration vector $j^k \in D^k$, $f^k(j^k) = F^k \phi^k(j^k)$. In the text of the elementary transform, $\phi^k$ must be substituted to $e^k$ in reference $k$ to $A$.
As one may see from this discussion, while the iteration domain and footprint are fixed once the sequential program is given, the choice of the pattern and fitting matrix are somewhat
arbitrary. There are two obvious solutions: in the first one, the pattern is the smallest rectangular box enclosing the footprint, the fitting matrix is the identity, and the subscript function is not changed. In the second solution, the pattern is isomorphic to the iteration domain (provided it is a parallelepiped), $B^k$ is the fitting matrix, and the new subscript function is the identity.
In signal processing applications, it is often the case that several references to the same array have similar subscript functions; constructing only one pattern for several references is an interesting optimization. However, this should not be obtained at the cost of a large overhead in the size of the pattern. In other word, the number of useless elements in the pattern must be minimized. Useless elements come from two sources:
- A subscript matrix which is not of full row rank: the pattern will have more dimensions than the footprint.
- A subscript matrix whose determinant is not of modulus one: there will be holes (unused elements) in the footprint. The inverse of the determinant gives an asymptotic evaluation of the ratio of useful elements.
The next section presents a method for computing a pattern and a fitting matrix in the general case (many references). This method can only be applied if all elements of the matrices $B^k$ and the vectors $b^k$ have known numerical values. Section 5 presents fail-soft solutions for cases in which these elements depend on unknown parameters.
4 The General Case
The basic observation is that a conservative estimate of the footprint can be obtained by computing the projection of each iteration domain by the associated subscript function, then constructing a convenient superset of the union of these projections. One practical method consists in projecting the vertices of the iteration domains. One then gathers all such projections, and constructs their convex hull by familiar (e.g., Chernikova’s) algorithms.
To reduce the size overhead, one should notice that a useful point for reference $k$ also belongs to the lattice which is generated by the column vectors of $B^k$. Hence, $B^k$, properly simplified (see later) could be used as the fitting matrix. However, in the case of several references, we have to combine several lattices into one, since each pattern has only one fitting matrix. As an illustration of this construction, consider the one dimensional case. A one-dimensional lattice is simply a set of regularly spaced points. Combining two lattices generates a lattice whose spacing is the gcd of the component spacings. The many-dimensional equivalent of the gcd is the construction of the Hermite normal form of the subscript matrices.
Let $\Lambda(B, b)$ be the lattice generated by $B$ with origin $b$, i.e. the set of points $\{Bx + b \mid x \in \mathbb{N}^d\}$. Let $L^1 = \Lambda(B^1, b^1)$ and $L^2 = \Lambda(B^2, b^2)$ be two such lattices. I claim that the union of $L^1$ and $L^2$ is included in the lattice $L = \Lambda([B^1 B^2 (b^2 - b^1)], b^1)$.
Proof Let $B^1.x + b^1$ be a point of $L^1$. We have:
$$B^1.x + b^1 = B^1.x + B^2.0 + (b^2 - b^1).0 + b^1$$
hence $B^1.x + b^1$ is in $L$. Similarly:
$$B^2.y + b^2 = B^1.0 + B^2.y + (b^2 - b^1).1 + b^1.$$
I conjecture that $L$ is the smallest lattice which includes $L_1$ and $L_2$. The proof is obvious if the $b$s are null. The general case is left for future work.
The construction can be extended to any number of component lattices. The resulting matrix is $[B_1 \ldots B_N(b^2 - b^1) \ldots (b^N - b^1)]$ and the origin is $b^1$. Furthermore, $b^1$ can be moved to the origin of the paving and hence taken as 0 when computing the fitting.
In case where $B$ has been obtained by mixing many references, it must be simplified before being used for an Array-OL specification.
The starting point of this simplification is the row echelon form of $B$. One can show (see the appendix) that there exists two unitary matrices $P$ and $U$ such that:
$$B = P \begin{bmatrix} H & 0 \\ C & 0 \end{bmatrix} U,$$
where $H$ is a square upper triangular matrix of size $r \times r$ with positive diagonal coefficients, $C$ is arbitrary, and both 0 represent null matrices of appropriate sizes. $r$ is the row rank of $B$. Furthermore, $U$ can be partitioned, row wise, in two matrices of size $r \times d$ and $(d-r) \times d$,
$$U = \begin{bmatrix} U' \\ U'' \end{bmatrix}.$$
Let $j$ be a point in the iteration domain of the inner loops. The corresponding point in the footprint is:
$$Bj = P \begin{bmatrix} H & 0 \\ C & 0 \end{bmatrix} \begin{bmatrix} U' \\ U'' \end{bmatrix} j = P \begin{bmatrix} H \\ C \end{bmatrix} (U'j)$$
One possible interpretation of this formula is that the pattern for the current reference is the image of its iteration domain by $U'$, and that the corresponding paving matrix is $P \begin{bmatrix} H \\ C \end{bmatrix}$.
In the body of the elementary transform, accesses to $Bj$ in the input or output array have to be replaced by accesses to $U'j$ in the pattern. It may be that the pattern computed in this way is not rectangular, in which case it must be “boxed” by computing the component-wise minima and maxima of its extreme points. The dimension of the pattern is $r$.
It is interesting to notice that this general solution reduces to one of the approximate methods above in special cases. If $B$ is unitary, then its row echelon form is the unit matrix. In that case, the pattern is the footprint, eventually extended to a rectangular box and the fitting matrix is the identity. Conversely, if $B$ is already in row echelon form, $P$ and $U$ are identities. The pattern is isomorphic to the iteration space, and $B$ is the fitting matrix.
5 The Parametric Case
Parameters occurs mostly in loop bounds. They may also appear as strides and, more seldom, in the coefficients of subscript functions.
In the Array-OL formalism, the repetition loops must be square. Hence, their bound may be extracted directly from the program text. The extraction of the paving matrix is a simple derivative computation, which is an easy task for a competent computer algebra system.
Similarly, the $B^k$ matrices are the result of a derivation, and may contain parameters. There are no restrictions on the inner loops. For the construction of the pattern, one needs to know the vertices of the inner iteration domain. There are three cases:
- The bounds are constant: they can be extracted even if parametric.
- The bounds are affine expressions in other loop counters and parameters: the vertices can be computed with the help of the polylib.
- In other cases, there is no way of computing vertices, but the user may supply a bounding box.
The computation of the row echelon form can be done only if the matrix is known numerically, except in two cases: the matrix is $1 \times 1$ (it is its own normal form) or $2 \times 2$.
The row echelon form of
\[
\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
\]
is
\[
\begin{pmatrix}
gcd(a,b) & 0 \\
\frac{cu + dv}{(ad - bc)/gcd(a,b)}
\end{pmatrix}
\]
where $u$ et $v$ are the integers such that $au + bv = gcd(a,b)$ whose existence is guaranteed by Bezout identity.
If none of these circumstance applies, the solution of last resort is to use one of the approximate schemes above. For instance, if the vertices of the inner iteration domain are available, it is possible, whatever the $B$ matrix, to compute the vertices of the footprints and to enclose them in a rectangular box. The paving matrix is then the identity.
\section{6 Extensions}
The Syntol tool computes dependences; it is thus possible to check that the repetition loops are actually parallel. One must take care that Syntol will find dependences if temporary scalars are used in the code of the elementary transforms. These scalars must be expanded or privatized at code generation time.
Overlap between patterns (or, rather, between footprints) is another concern. For input arrays, overlap is just a cause of inefficiency, since some arrays cells will be copied several times to processors. Overlap for output arrays are more dangerous since they may induce non-determinism. The existence of overlap may be tested provided one stays inside the polytope model (affine loop bounds and indexing functions, with numerical coefficients and linear parameters). In the same context, it is possible to quantify the overhead by comparing the size of the pattern and the size of the real footprint using the \texttt{barvinok} library [4].
\section{A Computing the row echelon form of a matrix}
For more details, see [3]. Let $B$ be an arbitrary matrix of size $p \times q$.
1. At any stage of the computation, we have constructed two unitary matrices $P$ and $U$ such that:
\[
B = PB'U, B' = \begin{bmatrix} H & 0 \\ C & D \end{bmatrix}
\]
where $H$ is lower triangular with positive diagonal coefficients. Initially, $P$ and $U$ are identity matrices, $H$ and $C$ are empty and $D = B$. Let $i$ be the index of the first row of $C$ and $D$.
2. If $D$ is null, the process stops.
3. If not, let $j$ be the index of some non zero row of $D$. Let $\pi_{ij}$ be the unitary matrix that permutes rows $i$ and $j$ of $B'$. Since $\pi_{ij}$ is its own inverse, one can write:
$$B = (P\pi_{ij})(\pi_{ij}B')U,$$
and the new $D$ has a non zero first row.
4. Let $k$ be the index of a negative element in the first row of $D$. Let $\sigma_k$ be the unit matrix with the $k$-th diagonal element set to $-1$. Since $\sigma_k$ is its own inverse, one can write:
$$B = P(B'\sigma_k)(\sigma_kU),$$
and element $k$ in the first row of $D$ is now positive.
5. If all elements in the first row of $D$ are positive, let $l$ be the index of the smallest element, and let $\pi_{il}$ be the matrix that interchange columns $i$ and $l$ of $B'$. Again:
$$B = P(B'\pi_{il})(\pi_{il}U)$$
and now the first element of the first row of $D$ is smallest.
6. Let $m > i$ be the index of some nonzero element in the first row of $D$. Set $\alpha = B'_{im}/B'_{ii}$. By construction, $\alpha > 0$. Let $\kappa_{im}(\alpha)$ be the identity matrix with $-\alpha$ added in position $(i, m)$. It is easy to see that the inverse of $\kappa_{im}(\alpha)$ is $\kappa_{im}(-\alpha)$. Hence:
$$B = P(B'\kappa_{im}(\alpha))(\kappa_{im}(-\alpha)U)$$
and element $B'_{im}$ has been replaced by $B'_{im} \text{ mod } B'_{ii}$.
7. If the only non-zero element of the first row of $D$ is the first element, then $i$ can be increased by 1.
These transformations must be applied until no further progress is possible (i.e. when in case 2). Matrix $B'$ is in the required form, and since all the elementary matrices $\pi, \sigma$ and $\kappa$ are unitary, the resulting $P$ and $U$ are unitary. In fact, $P$ is even a permutation matrix.
References
|
{"Source-Url": "https://hal-lara.archives-ouvertes.fr/hal-02102502v1/file/RR2007-28.pdf", "len_cl100k_base": 5103, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 26666, "total-output-tokens": 5847, "length": "2e12", "weborganizer": {"__label__adult": 0.0004050731658935547, "__label__art_design": 0.000705718994140625, "__label__crime_law": 0.0005044937133789062, "__label__education_jobs": 0.00061798095703125, "__label__entertainment": 0.00013387203216552734, "__label__fashion_beauty": 0.00019693374633789065, "__label__finance_business": 0.0003039836883544922, "__label__food_dining": 0.00045990943908691406, "__label__games": 0.0005998611450195312, "__label__hardware": 0.002758026123046875, "__label__health": 0.0007104873657226562, "__label__history": 0.0003666877746582031, "__label__home_hobbies": 0.00015556812286376953, "__label__industrial": 0.0010786056518554688, "__label__literature": 0.0002455711364746094, "__label__politics": 0.0004115104675292969, "__label__religion": 0.0007615089416503906, "__label__science_tech": 0.2374267578125, "__label__social_life": 0.0001233816146850586, "__label__software": 0.01059722900390625, "__label__software_dev": 0.73974609375, "__label__sports_fitness": 0.0004880428314208984, "__label__transportation": 0.0008950233459472656, "__label__travel": 0.00023794174194335935}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 20719, 0.02785]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 20719, 0.76537]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 20719, 0.8366]], "google_gemma-3-12b-it_contains_pii": [[0, 899, false], [899, 1000, null], [1000, 2184, null], [2184, 4832, null], [4832, 7127, null], [7127, 9486, null], [9486, 12737, null], [12737, 15638, null], [15638, 18514, null], [18514, 20719, null]], "google_gemma-3-12b-it_is_public_document": [[0, 899, true], [899, 1000, null], [1000, 2184, null], [2184, 4832, null], [4832, 7127, null], [7127, 9486, null], [9486, 12737, null], [12737, 15638, null], [15638, 18514, null], [18514, 20719, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 20719, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 20719, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 20719, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 20719, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 20719, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 20719, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 20719, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 20719, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 20719, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 20719, null]], "pdf_page_numbers": [[0, 899, 1], [899, 1000, 2], [1000, 2184, 3], [2184, 4832, 4], [4832, 7127, 5], [7127, 9486, 6], [9486, 12737, 7], [12737, 15638, 8], [15638, 18514, 9], [18514, 20719, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 20719, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
4d377811a43ff9e8466ffde6d0e14afb67b02227
|
Learning to play SLITHER.IO
with deep reinforcement learning
CS229 project report. Category: Theory & Reinforcement Learning.
Joan Creus-Costa
<jcreus@stanford.edu>
Zhanpei Fang
<zhanpei@stanford.edu>
Abstract
This project uses deep reinforcement learning to train an agent to play the massively multiplayer online game SLITHER.IO. We collect raw image inputs from sample gameplay via an OpenAI Universe environment as training data. We implement deep Q-learning with Huber loss, incorporating human demonstrations, reward shaping and prioritized replay in order to improve stability and successfully learn a policy. Our best model performs significantly better than a random policy, but worse than a human benchmark, achieving a median difference in score at the end of each episode of 54.
1 Introduction
Games have long been a benchmark of reinforcement learning (RL), beginning with the 1990s breakthrough in backgammon [Tesano, 1995] and evolving to video games with DeepMind’s pioneering work in deep reinforcement learning [Mnih et al., 2013, 2015]. Various papers have shown state-of-the-art performance in Atari games, as well as in more complex games such as Go. Video games are challenging—and therefore interesting—systems due to their high-dimensional visual input, high frame rate, and, in some instances (such as OpenAI’s work on Dota 2) their multiplayer nature.
SLITHER.IO is a massively multiplayer online (MMO) game in which players use a mouse to control a “snake” on a 2D map. The objective of the game is to maximize snake length by consuming multicolored food pellets while avoiding other players’ snakes; if the player’s snake’s head collides with the body of another snake, the player will die and their body disintegrates into pellets for others to consume.
The goal of this project is to achieve human-like performance using reinforcement learning on SLITHER.IO, which presents a good target due to the relative simplicity of its game mechanics, along with the possibility for complex emergent behavior. The massively-multiplayer nature of the game adds non-determinism and provides a clear benchmark with which to assess performance, relative to that of human players.
2 Related work
Reinforcement learning has been applied with great success to a wide variety of gameplay scenarios. RL is well-suited to solving the problem of how an agent can learn to make decisions and achieve goals in a complex, uncertain environment without too many prior assumptions about the system.
Deep Q-learning has in particular performed well in the video-game environment, as it is suited to problems with high-dimensional observation spaces and discrete and low-dimensional action spaces [Lillicrap et al., 2015]. The seminal work of [Mnih et al., 2013] used deep Q-learning to play classic Atari 2600 games, surpassing the performance of all previous algorithms and achieving performance comparable to that of a professional games
Preprint. Under review.
1For examples of some of these complex behaviors, see this list of player-devised strategies: [https://slitherio.gamepedia.com/Strategies](https://slitherio.gamepedia.com/Strategies)
This tour de force re-energized reinforcement learning with novel applications of deep neural networks, and many variations have emerged to address its shortcomings, such as Double Q-learning, which corrects the tendency of the original algorithm to overestimate Q function values [Van Hasselt et al., 2016]. A variety of policy gradient methods, such as DDPG [Lillicrap et al., 2015] have proven to be very successful in continuous and stochastic environments.
SLITHER.IO is part of OpenAI Gym’s Universe, a collection of environments with a wide variety of reinforcement learning tasks, primarily from retro video games or online games. As a result of this convenient packaging, previous work has tried to use various machine-learning methods to learn to play this game, though it has not become a standard benchmark like some other Gym environments, due to the inherent difficulties associated with a multiplayer Internet-based environment. Caudill [2017] combines hand-coded pre-processing of frames and deep Q-learning to achieve limited success in the early game, concluding that more training was required due to the game’s complexity. Miller et al. [2019] use neuroevolution methods to achieve higher scores, though performance is still an order of magnitude short of custom hand-coded expert systems. Another online implementation [Barnes] appears to attempt a variety of deep reinforcement learning methods, but no benchmarks were made available, and we were unable to successfully run their code to retrieve comparison metrics. Overall, the limited body of work we found is largely modelled after the recent successes in beating Atari games, sometimes using variations of vanilla DQN.
Finally, recent relevant literature have identified the need to train in a distributed fashion, in order to satisfy the rapidly-increasing training requirements of modern reinforcement learning, as a result of their model-free nature. Asynchronous actor-critic methods (A3C) are one of the most cited techniques, allowing for scaling to multiple threads on a single machine. However, adding more computation does not always result in convergence, and recent research has tried to aid reinforcement learning algorithms by providing expert human demonstrations to guide the learning [Mandlekar et al., 2018] [Hester et al., 2018].
3 Methods
3.1 Dataset and features
In order to interface with SLITHER.IO’s online servers, we use OpenAI Gym in concert with OpenAI Universe. OpenAI Gym is a Python API for developing and comparing RL algorithms, compatible with numerical computation libraries such as TensorFlow. The gym library provides a collection of test problems (environments) which can be used to implement RL algorithms; the environment’s step function implements the classic “agent-environment” loop. At each timestep, the agent chooses an action, and the environment returns an observation and a reward. Universe extends Gym to include a wider variety of environments, including Internet games such as SLITHER.IO. Unlike Gym’s simulated environments, Universe interacts with the real edition of the game on the Internet by simulating a virtual keyboard on a VNC remote desktop. Data gathering is therefore rate-limited due to the VNC’s running in real-time online.
Figure 1: Sample (cropped) frames from a random agent playing SLITHER.IO on the remote desktop spun up by OpenAI Universe.
Our input data are therefore the raw frames captured from the remote desktop (Figure 1), and reward signals which correspond to the change in length of the snake. We preprocess the 768 \times 1024 \times 3 (RGB) images by cropping them to 300 \times 500 \times 3 to only show the relevant part of the map, then resizing them to 150 \times 250 \times 3 to reduce the number of parameters. We perform frame-skipping from 60 to 5 frames per second, a more reasonable rate based on a rough approximation of a human’s bandwidth when playing the game; this improves storage requirements and has
---
[Brockman et al., 2016](https://gym.openai.com/)
[Brockman et al., 2016](https://github.com/openai/universe)
been shown to make learning easier by resulting in shorter episode lengths. The color values are scaled from an 8-bit range (0 to 255) to floating-point values (0.0 − 1.0).
Additionally, because the Markov assumptions do not perfectly hold, there is relevant information in the frame before the current one, as well as implicit information which makes learning easier. In order to encode this while avoiding the complexity of a fully recurrent model, we merely compute the difference between the current frame and the previous one on a channel-by-channel basis, which results in the addition of three channels (for a total of six) that range between −1 and 1.
3.2 Agent model
Our agent model is based on the model presented in [Mnih et al., 2013], modified to reflect differences in the input data. In particular, we begin with six channels, and then apply three convolutional layers with 64 filters on each layer, decreasing kernel size (8, 4, and 3) and decreasing stride (4, 2, and 1). We use batch normalization between each of the first three layers. In the end, a fully connected layer with rectified linear unit activations results in the estimated Q-values for each of four actions, corresponding to continuing straight, turning left, turning right, and traveling forward with a burst of speed (sprinting).
3.3 Training algorithms
We use vanilla deep Q-learning, which is a variant of traditional Q-learning in which the action-value function is learned using neural networks. The Q function tries to predict the value of taking a given action a in some state s. In traditional Q-learning, all pairs of states and actions (s, a) ∈ S × A are considered in a table and updated iteratively. For larger problems, such as this one—in which the input space spans close to a million variables—this is computationally unfeasible, and it is desirable to approximate Q with a neural network.
The algorithm we use is given in the appendix of [Mnih et al., 2015]. We use a deep convolutional neural network to approximate the optimal action-value function Q from pixels s:
\[ Q^*(s, a) = \max_\pi \mathbb{E}[r_t + \gamma r_{t+1} + \gamma^2 r_{t+2} + \ldots | s_t = s, a_t = a, \pi] \]
which gives the maximum sum of rewards r_t discounted by γ at each time-step t, achievable by a behaviour policy \( \pi = P(a|s) \). The Q-learning update at iteration \( i \) uses the Huber loss, defined relative to the interval \([-\delta, \delta]\) (with \( \delta = 1 \) in this case) around zero:
\[ L_\delta(a) = \begin{cases} \frac{\delta^2}{2} & \text{if } |a| \leq \delta \\ \delta |a| - \frac{\delta^2}{2} & \text{otherwise.} \end{cases} \]
This effectively uses mean squared error (MSE) for low error values and mean absolute error (MAE) for large values, so as to be less sensitive to outliers in the data compared to a purely-MSE approach.
We implement DQN along with various techniques outlined in the sections below using PyTorch [Paszke et al., 2017]. Besides checking for convergence of the Q function, we evaluate real performance by running the policy on the (networked) environment against other players, and measuring the median difference in length from the beginning until the snake dies (the mean is easily biased by both very lucky runs and early deaths due to random initialization) and the average reward collected per time step (200 ms). We compare those metrics to those achieved by an agent taking random actions as a baseline, and with the performance attained by a human.
3.4 Reward shaping
Due to the complexity of the game and the sample inefficiency of deep RL, we resorted to reward shaping [Ng et al., 1999] as a method to encourage or discourage various behaviors and hasten learning. The specific techniques were applied ad hoc after looking at the results of early training and observing its weaknesses.
Typically, the reward function returned by the environment is simply the difference in length of the snake, being \( > 0 \) if the snake becomes longer. However, the end of the episode is not associated with a negative reward—the episode simply ends. In order to disincentivize getting into scenarios that might result in the end of an episode—such as speeding head-on into the side of another snake—we manually apply this first reshaping of the reward function:
\[ r'_t = \begin{cases} -10 & T - t \leq 10 \\ r_t & \text{otherwise} \end{cases} \]
where \( T \) is the end of the episode. In other words, we apply a large negative reward for the last 2 seconds of every episode. Another reshaping we performed was subtracting 1 from the reward when trying to sprint (action 3) if
We consider a replay buffer of previous transitions collected by the agents, either fully random or under an $\epsilon$-greedy policy. This helps stabilize training, and makes it more efficient by taking random batches which are significantly less correlated than consecutive samples. Sample efficiency is also increased by allowing for reuse of transitions in the learning. Our entries in the replay buffer consist of tuples $(s_t, a_t, r_t, s_{t+1})$, where $s_t, s_{t+1} \in \mathbb{R}^{150 \times 250 \times 3}$, and $a_t$ and $r_t$ are the action and reward respectively. In order to maximize the size of the buffer and maximize its utility, we size it to be as large as possible while fitting in RAM, and apply a variety of tricks to minimize its size, including storing it as 8-bit values without converting to floating point, not storing $s_{t+1}$ explicitly, and only generating the delta-frame channels when a batch of samples is requested.
Additionally, inspired by Schaul et al. [2015], we do not sample from the replay buffer uniformly. Instead, using the intuition that transitions in which rewards happen are more important than rewards in which no rewards happen—and rewards are sparse enough that under a Huber loss, merely predicting always zero gives small errors and gradients for a small enough $\gamma$—we sample the transitions $e_t$ with a probability density given by:
$$p_t = \frac{1}{4} + \log \left( 1 + \sum_{i=0}^{K} |r'_{t-i}| \right)$$
with $K = 5$. This ensures a non-zero probability of seeing every transition, and assigns greater probability around the neighborhood of rewards, in a log scale accounting for the wide range of values. In future work we may try using the more commonly-used prioritized replay based on the error of the $Q$-function; the function above was considered due to its ease of computation.
### 3.5 Replay buffer
Mnih et al. [2013] introduce using an experience replay buffer which stores past observations and uses them as training inputs, to reduce correlations between successive samples and smooth over changes in the data distribution. We consider a replay buffer of previous transitions collected by the agents, either fully random or under an $\epsilon$-greedy policy. This helps stabilize training, and makes it more efficient by taking random batches which are significantly less correlated than consecutive samples. Sample efficiency is also increased by allowing for reuse of transitions in the learning. Our entries in the replay buffer consist of tuples $(s_t, a_t, r_t, s_{t+1})$, where $s_t, s_{t+1} \in \mathbb{R}^{150 \times 250 \times 3}$, and $a_t$ and $r_t$ are the action and reward respectively. In order to maximize the size of the buffer and maximize its utility, we size it to be as large as possible while fitting in RAM, and apply a variety of tricks to minimize its size, including storing it as 8-bit values without converting to floating point, not storing $s_{t+1}$ explicitly, and only generating the delta-frame channels when a batch of samples is requested.
### 3.6 Human demonstrations
Due to difficulty in learning a better-than-random policy, we implemented a variant of deep $Q$-learning from human demonstrations as introduced in Hester et al. [2018]. These are used to pretrain the $Q$-network and obtain a better initial policy, which improves the quality of the experiences observed and leads to faster training overall. In particular, for some number $H$ of randomly sampled human transitions (as in 3.5) we add the following term to the loss function:
$$J_E(Q) = \max_{a \in A} [Q(s, a) + l(a_E, a)] - Q(s, a_E)$$
Here $a_E$ is the expert action from the human demonstration, and $a$ is the action chosen by the policy network as the argmax. The margin function $l(a_E, a)$ is = 0 when $a = a_E$ (i.e. when they match) and = 1 otherwise, as in Hester et al. [2018]. We collect the demonstrations by writing a custom script which intercepts the user’s keyboard presses and feeds them to the environment. As such, the demonstrations are collected in the same manner as the rest of the experiences without distributional shift.
### 4 Results and discussion
Successful training of the deep $Q$-learning algorithm was highly nontrivial and required applying a variety of techniques to achieve a policy better than that of the random agent, indicating somewhat brittle and unstable training. Training happened on a single machine with 16 threads, 32 GB RAM, and an NVidia GTX 1060 GPU. In order to maximize the use of the machine, we developed multiple Python scripts to handle the different parts of the training. An agent program ran the environment—with multiple retries and automatic detection of soft failures of the virtual desktop—with an $\epsilon$-greedy policy (except during evaluation), periodically updated its weights from a specified file in the filesystem, and pushed compressed files with all of its transitions to a particular folder. A learner Python script performed iterations of deep reinforcement learning with PyTorch on the GPU by pulling from a replay buffer kept in RAM that periodically checked subdirectories for new compressed files with training data, and pushed its weights every 5,000 iterations to a file that the agents then read. This allowed multiple agents to collect data and therefore train more quickly.
Vanilla deep $Q$-learning did not successfully learn a good policy despite exploring a variety of hyperparameters (such as learning rates, neural network size, the target network update rate, $\epsilon$ or $\gamma$) and the techniques in Sec. 3.1–3.5.
We have demonstrated the use of deep reinforcement learning to learn a policy for the online game SLITHER.IO. While this leads to decent returns, it ultimately limits the achievable size. We hypothesize that such behavior could potentially be learned with more human demonstrations. An interesting behavior is the evolution of its use of sprinting, a move in the game that results in an immediate loss of size but gives a speed boost. The agent first learns to not use it at all—to avoid losing mass—but in the final policy it uses it occasionally (as humans do) to get out of an area without food and towards one with more pellets, which maximizes the discounted return. It also learns the basic mechanics of the game, turning around with spatial awareness and doing very coarse path planning to move towards food, which, while trivial for a human, is complicated to learn directly from pixels.
<table>
<thead>
<tr>
<th>Model</th>
<th>Median final score</th>
<th>Average reward</th>
</tr>
</thead>
<tbody>
<tr>
<td>Random policy</td>
<td>$3^{+1}_{-0.0}$</td>
<td>0.08</td>
</tr>
<tr>
<td>Human*</td>
<td>$145^{+8}_{-36}$</td>
<td>0.68</td>
</tr>
<tr>
<td>Pretrain on human demonstrations, $1.5 \times 10^4$ batches</td>
<td>$11^{+3}_{-3}$</td>
<td>0.14</td>
</tr>
<tr>
<td>... followed by $3 \times 10^4 \epsilon$-greedy batches</td>
<td>$54^{+16}_{-22}$</td>
<td>0.26</td>
</tr>
<tr>
<td>No human demonstrations, $1.5 \times 10^5 \epsilon$-greedy batches</td>
<td>$17^{+1}_{-8}$</td>
<td>0.10</td>
</tr>
</tbody>
</table>
Table 1: Comparison of results of our algorithm with a random policy and a human player. Score represents the difference between the initial and final length, and so is approximately 10 points lower than the score reported by the online scoreboard. Note that average reward is a less-noisy signal, because there are significantly more transitions than there are episodes. Median rather than mean score is used because it would otherwise be biased by a small number of good runs or early deaths depending on the initial position on the map. Error bounds on the median score are estimated using the bootstrap method of Efron [1982], computing the median and giving the difference between the 16th and 84th percentile, equivalent to 68% confidence intervals.
*Note that human play was benchmarked while using the constraints of the packaged environment (via a Python script written to intercept the keyboard), which is more difficult than normal play in a web browser due to input via keyboard arrows at 5 Hz, which is a far lower resolution than using a mouse at 60 Hz. The same human achieved a median score in the high hundreds or low thousands with a web browser.
As we can see in Table 1, even 150,000 iterations of $\epsilon$-greedy resulted in a median final score of only 17, compared to 3 for a random policy, and a very similar average reward. By comparison, with the setup as in Sec. 3, $\gamma = 0.95$, $\alpha_{Adam} = 10^{-4}$, and a batch size $B = 128$, pretraining on 50 human demonstrations with only 15,000 iterations with the additional cost term $J_E$ as in Sec. 3.6, yielded a better average reward and a comparable median final score as in the 150,000 iterations without. By taking this pretrained policy and executing otherwise the same $\epsilon$-greedy steps, the final policy we obtained was significantly better than either, with a median final score of 54, and an average reward more than three times higher than a random policy.
The comparison above shows the high impact that a mere 50 human demonstrations had on the learning speed and potential of deep reinforcement in this game. Together with other techniques, such as reward shaping and delta frame stacking, this allowed for the successful learning of a policy. Despite being better than a random policy or one learned by vanilla Q-learning, the performance still falls short of that of an experienced human player. We can explain these shortfalls with a qualitative examination of the videos generated during the evaluation of the final policy. The biggest difference between the learned policy and a human one is the general lack of offensiveness of the RL agent, which except for an occasional attack on other snakes plays a mostly defensive and evasive game. While this leads to decent returns, it ultimately limits the achievable size. We hypothesize that such behavior could potentially be learned with more human demonstrations. An interesting behavior is the evolution of its use of sprinting, a move in the game that results in an immediate loss of size but gives a speed boost. The agent first learns to not use it at all—to avoid losing mass—but in the final policy it uses it occasionally (as humans do) to get out of an area without food and towards one with more pellets, which maximizes the discounted return. It also learns the basic mechanics of the game, turning around with spatial awareness and doing very coarse path planning to move towards food, which, while trivial for a human, is complicated to learn directly from pixels.
## 5 Conclusions and future work
We have demonstrated the use of deep reinforcement learning to learn a policy for the online game SLITHER.IO. Overall, the results are statistically significantly better than a random policy, but they are still significantly below that of a human player, which is not unexpected given the high degree of complexity of the game and its real-time multiplayer nature. We explored the effect of a variety of techniques which can be used to lead to a good policy that vanilla DQN was unable to learn, including reward shaping, a custom priority replay buffer, and the addition of human demonstrations to pretrain the network, which resulted in our best performing agent. This further confirms results of the effects of human demonstrations in other environments, such as Atari games [Hester et al., 2018].
For future work, we would like to spend more time training and tuning hyperparameters, both of which take a long time due to the bottleneck of playing in real-time over a network; we believe that given enough time it should be possible to learn offensive tactics. Additionally, we would like to try more advanced models than the somewhat-standard deep Q-network, using instead asynchronous actor-critic methods in a distributed fashion.
Contributions
J.C.C. and Z.F. contributed equally to the project conception, setup of initial training data pipelines and writing of milestone. J.C.C. carried out deep Q-learning model generation, learning infrastructure and training, and human demonstrations. Z.F. led poster design and final write-up.
The code is available at https://drive.google.com/file/d/1iroTygoadpleutSNyx_tnM8ADleIYmy2/view?usp=sharing. For reproducibility: getting the Docker Python integration was tricky and due to Universe no longer being supported an old version of Gym had to be used that is incompatible with recent Python version, which can be fixed by editing a couple of lines in the library.
References
|
{"Source-Url": "http://cs229.stanford.edu/proj2019aut/data/assignment_308832_raw/26588099.pdf", "len_cl100k_base": 5418, "olmocr-version": "0.1.49", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 19234, "total-output-tokens": 6731, "length": "2e12", "weborganizer": {"__label__adult": 0.0013980865478515625, "__label__art_design": 0.00150299072265625, "__label__crime_law": 0.00140380859375, "__label__education_jobs": 0.0024871826171875, "__label__entertainment": 0.0007700920104980469, "__label__fashion_beauty": 0.0007867813110351562, "__label__finance_business": 0.0005359649658203125, "__label__food_dining": 0.001605987548828125, "__label__games": 0.048553466796875, "__label__hardware": 0.0028553009033203125, "__label__health": 0.0021152496337890625, "__label__history": 0.0012922286987304688, "__label__home_hobbies": 0.0003390312194824219, "__label__industrial": 0.00164794921875, "__label__literature": 0.0008783340454101562, "__label__politics": 0.0008749961853027344, "__label__religion": 0.0014123916625976562, "__label__science_tech": 0.337646484375, "__label__social_life": 0.00031185150146484375, "__label__software": 0.01123046875, "__label__software_dev": 0.57666015625, "__label__sports_fitness": 0.0016374588012695312, "__label__transportation": 0.0014925003051757812, "__label__travel": 0.0006823539733886719}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26928, 0.03648]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26928, 0.3559]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26928, 0.9104]], "google_gemma-3-12b-it_contains_pii": [[0, 3164, false], [3164, 7266, null], [7266, 11887, null], [11887, 17493, null], [17493, 23646, null], [23646, 26928, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3164, true], [3164, 7266, null], [7266, 11887, null], [11887, 17493, null], [17493, 23646, null], [23646, 26928, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26928, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26928, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26928, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26928, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26928, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26928, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26928, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26928, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26928, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26928, null]], "pdf_page_numbers": [[0, 3164, 1], [3164, 7266, 2], [7266, 11887, 3], [11887, 17493, 4], [17493, 23646, 5], [23646, 26928, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26928, 0.07447]]}
|
olmocr_science_pdfs
|
2024-11-27
|
2024-11-27
|
a3c22e933ad674025e76d810d8adc712d9724972
|
QIRAL: A High Level Language for Lattice QCD Code Generation
Denis Barthou, Gilbert Grosdidier, Michael Kruse, Olivier Pène, Claude Tadonki
To cite this version:
HAL Id: hal-00666885
https://hal.archives-ouvertes.fr/hal-00666885v2
Submitted on 14 Aug 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.
QIRAL: A High Level Language for Lattice QCD Code Generation
Denis Barthou
University of Bordeaux, Bordeaux, France
denis.barthou@laboratoire.fr
Gilbert Grosdidier
Laboratoire de l’Accélérateur Linéaire, Orsay, France
grosdidier@in2p3.fr
Michael Kruse
INRIA Saclay / ALCHEMY, Orsay, France
michael.kruse@inria.fr
Olivier Pene
Laboratoire de Physique Théorique, Orsay, France
olivier.pene@th.u-psud.fr
Claude Tadonki
Mines ParisTech/CRI - Centre de Recherche en Informatique, Fontainebleau, France
claude.tadonki@mines-paristech.fr
Abstract
Quantum chromodynamics (QCD) is the theory of subnuclear physics, aiming at modeling the strong nuclear force, which is responsible for the interactions of nuclear particles. Lattice QCD (LQCD) is the corresponding discrete formulation, widely used for simulations. The computational demand for the LQCD is tremendous. It has played a role in the history of supercomputers, and has also helped defining their future. Designing efficient LQCD codes that scale well on large (probably hybrid) supercomputers requires to express many levels of parallelism, and then to explore different algorithmic solutions. While algorithmic exploration is the key for efficient parallel codes, the process is hampered by the necessary coding effort.
We present in this paper a domain-specific language, QIRAL, for a high level expression of parallel algorithms in LQCD. Parallelism is expressed through the mathematical structure of the sparse matrices defining the problem. We show that from these expressions and from algorithmic and preconditioning formulations, a parallel code can be automatically generated. This separates algorithms and mathematical formulations for LQCD (that belong to the field of physics) from the effective orchestration of parallelism, mainly related to compilation and optimization for parallel architectures.
1 Introduction
Quantum Chromodynamics (QCD) is the theory of strong subnuclear interactions[13]. Lattice QCD (LQCD) is the numerical approach to solve QCD equations. LQCD simulations are extremely demanding in terms of computing power, and require large parallel and distributed machines. At the heart of the simulation, there is an inversion problem:
\[ Ax = b, \]
where \( A \) is a large sparse (also sparse and implicit) matrix, called Dirac matrix, \( b \) is a known vector and \( x \) is the unknown. To model reality accurately, \( A \) should be of size around \( 2^{32} \times 2^{32} \) elements at least. Current simulations on supercomputers handle sizes up to \( 2^{24} \times 2^{24} \) elements. High performance LQCD codes on multicores, multinode and hybrid (using GPUs) architectures are quite complex to design: performance results from the interplay between the algorithms chosen to solve the inversion and the parallelism orchestration on the target architecture. Exploring the space of algorithms able to solve the inversion, such as mixed precision or communication-avoiding algorithms, aggressive preconditioning, deflation techniques or any
combination of these is essential in order to reach higher levels of performance. Many hand-tuned, parallel libraries dedicated to LQCD, such as Chroma [5] or QUDA [2], propose building blocks for these algorithms, so as to ease their development. Parallelism does not stem from the algorithm themselves but from the structure of the sparse matrices involved in the computation. However, there are a number of shortcomings to the library approach: First, any significant evolution of the hardware requires to tune the library to the new architecture. This can lead to change the grain of parallelism (as an adaptation to cache sizes for instance) or change the data layout. Then, sparse matrices for LQCD, in particular the matrix $A$, have a very regular structure and library functions take advantage of it. Combining different algorithms, such as preconditioners, leads to structural changes in matrices that are not supported by these libraries. These two limitations hinder considerably the time necessary to develop a parallel/distributed code.
We propose in this paper a high-level Domain-Specific Language, QIRAL, to model LQCD problems and enable automatic parallel code generation. This novel approach makes possible the exploration and test of new algorithms for LQCD. Sparse matrices in LQCD can be structured using algebra operators on dense matrices and the key idea is to use this structure to express parallelism. This extends ideas proposed in SPIRAL [8], the library generator for DSP algorithms to more complex codes and matrices. The problem formulation is first presented in Section 2, then the language is described in Section 3 and its implementation in Section 4.
2 Lattice QCD Description
The principle of LQCD is to discretize space-time and describe the theory on the resulting lattice. The lattice has to contain a very large number of sites since it has to be fine grained and describe large enough volumes. LQCD exists since 1974. Huge progress in hardware, software and algorithms have been achieved, but it is not enough to really sit on the parameters of nature. The light quarks, “u” and “d” are still described by quarks heavier than in nature while the heavy “b” quark is described as lighter. This implies systematic errors in our results. To break this limitation, several orders of magnitudes will be needed in the computing power and related resources. It will demand new hardware with several level of parallelism, and make coding more and more complicated. Our goal is to provide tools helping to face this new situation.
The heaviest part in the LQCD calculation is to generate a large Monte-Carlo sample of very large files (field configurations) according to an algorithm named “Hybrid Monte-Carlo”. It is a Markovian process, every step of which takes several hours on the most powerful computers. The algorithm is complex but it spends most of its time in inverting very large linear systems which depend on the field configuration. Typically one will deal with matrices with billions of lines and columns. The second heaviest part in the calculation is to compute “quark propagators” which again boils down to solving large linear systems of the same type [7]. Therefore we will concentrate on this task. The matrices involved in these computation represent 4D stencil computations, where each vertex is updated by the value of its 8 neighbours. Their structure is therefore very regular, statically known, and it is used in the following section.
3 A High-Level Domain-Specific Language
QIRAL is a high level language for the description of algorithms and for the definition of matrices, vectors and equations specific to LQCD. The objective of the algorithmic part is to define algorithms independently of the expression of sparse matrices used in LQCD. The
\[ \text{Dirac} = I_L \otimes C \otimes S + 2 \times i \times \mu \times (I_L \otimes C) \oplus \sum_{s \in L} U(d[s]) \otimes (I_S + \gamma[d]) + \sum_{d \in D} ((J^d_L \otimes I_C) \oplus \sum_{s \in L} U(-d[s]) \otimes (I_S - \gamma[d])) \]
Figure 1: Definition of Dirac matrix on a Lattice \( L \) in QIRAL.
The objective of the system of definitions and equations is to define properties and structure sparse matrices in order to be able to find parallelism. While the algorithmic part uses straightforward operational semantics, the equational part defines a rewriting system.
For the sake of simplicity, QIRAL is a subset of \( \LaTeX \), meaning that the QIRAL input can be either compiled into a \( \text{pdf} \) file, for rendering purposes, or compiled into executable codes. Algorithms and definitions correspond to different predefined \( \LaTeX \) environments.
**Variables, Types:** Variables and constants used in QIRAL are vectors (denoted by the type \( V \)) of any length, matrices of any size (\( M \)), complex (\( C \)) or real numbers (\( R \)). Besides, counted loops are indexed by variables of type \( \text{index} \), iterating over a domain (denoted \( \text{indexset} \)). Index variables are potentially multidimensional, and integers are a particular case of index value. Functions of any number of argument of these types can be also defined. The size of a vector is defined through the size of its index set. The size of an index set can be left undefined. If \( V \) is the vector and \( IS \) is an index set, \( V[IS] \) denotes the subvector indexed only by \( IS \).
Matrices and vectors cannot be manipulated or defined element-wise. Instead, matrices and vectors are built using either constant, predefined values such as identity \( I \) (for the identity on an index set \( IS \)), or operators such as +, −, * and the transposition, conjugate, direct sum and tensor product. The tensor product \( \otimes \) and direct sum \( \oplus \) are defined by:
\[
A \otimes B = [a_{ij}B]_{ij}, \quad A \oplus B = \left( \begin{array}{c|c} A & 0 \\ \hline 0 & B \end{array} \right).
\]
These two operators define parallel operations and help defining the sparse matrices of LQCD.
**Definition and Equations:** All LQCD knowledge is given as a system of definition (for matrices and vectors) and a system of equations on these values. In particular, the structure of sparse matrices, explicitly defining where non-zero elements are located, is given in these definitions. This structure is then propagated in the algorithms. Figure 1 defines the sparse Dirac matrix. Declarations of index sets \( L, C, S, D \) are not shown here, as well as the declaration of the constant matrices used here.
The direct sums indexed by the vertices of the lattice \( (L) \) define block-diagonal matrices. These diagonals are then shifted by \( d \) or \( -d \) columns by a permutation matrix \( J^d_L \) (predefined).
**Algorithms, Preconditioners:** Many algorithms proposed for solving Equation 1 are Krylov methods. Figure 2 presents two algorithms in QIRAL. The first is a variant of the conjugate gradient and is representative of iterative methods. The second one, Schur complement method, is a preconditioner: Computing \( x \), solution of Equation 1 is achieved by computing two solutions to smaller problems.
The keyword \texttt{Match} helps to define the algorithm as a rewriting rule: Whenever the statement in the \texttt{Match} condition is found, it can be rewritten by the algorithm. For the \texttt{SCHUR}
QIRAL: A High-Level Language for LQCD Code Generation
Barthou et al.
preconditioner, this rewriting can be performed at the condition that the requirement is
filled: \( P_1 A P_1^T \) has to be invertible. Using identities defined through the equation system, the
rewriting system proves here that indeed, the requirement is valid, when matrix \( A \) is Dirac
matrix and \( P_1 \) is a projection matrix keeping only vertices of the lattice with even coordinates
(even-odd preconditioning). QIRAL is expressive enough to represent different variants of con-
QIRAL: A High-Level Language for LQCD Code Generation
Barthou et al.
Algo 1: Conjugate Gradient, Normal Resolution [CGNR]
<table>
<thead>
<tr>
<th>Input</th>
<th>( A \in M, h \in V, r \in R )</th>
</tr>
</thead>
<tbody>
<tr>
<td>Output</td>
<td>( x \in V )</td>
</tr>
<tr>
<td>Match</td>
<td>( x = A^{-1} \times h )</td>
</tr>
<tr>
<td>( r_0 )</td>
<td>( r, x, x \in V, \alpha, \beta, n_r, n_z, n_{z1} \in R )</td>
</tr>
<tr>
<td>( x = A^t \times r )</td>
<td>( p = x )</td>
</tr>
<tr>
<td>( x = 0 )</td>
<td>( n_x = (x \times z) )</td>
</tr>
</tbody>
</table>
| \( n_z = (r \times r) \) | while \((n_r \geq \epsilon) \) do
| \( Ap = A \times p \) | \( a = n_z / (Ap \times Ap) \) |
| \( x = x + a \times p \) | \( r = r - a \times Ap \) |
| \( x = A^t \times r \) | \( n_{z1} = (x \times z) \) |
| \( \beta = n_{z1} / (n_z) \) | \( p = p + \beta \times x \) |
| \( n_{z2} = n_{z1} \) | \( n_r = (r \times r) \) |
Algo 2: Definition of Schur complement method [SCHUR]
<table>
<thead>
<tr>
<th>Input</th>
<th>( A, P_1, P_2 \in M, b \in V )</th>
</tr>
</thead>
<tbody>
<tr>
<td>Output</td>
<td>( x \in V )</td>
</tr>
<tr>
<td>Match</td>
<td>( x = A^{-1} \times b )</td>
</tr>
<tr>
<td>( v_1 )</td>
<td>( v_1, v_2, v_3, v_4 \in V, D_1, D_2, D_12, D_21, D_22 \in M )</td>
</tr>
<tr>
<td>Require</td>
<td>invertible ( (P_1 \times A \times P_2^t) )</td>
</tr>
<tr>
<td>( D_{21} )</td>
<td>( D_{21} = P_2 \times A \times P_2^t )</td>
</tr>
<tr>
<td>( D_{11} )</td>
<td>( D_{11} = P_1 \times A \times P_2^t )</td>
</tr>
<tr>
<td>( D_{22} )</td>
<td>( D_{22} = P_2 \times A \times P_2^t )</td>
</tr>
<tr>
<td>( D_{12} )</td>
<td>( D_{12} = P_1 \times A \times P_2^t )</td>
</tr>
<tr>
<td>( v_1 )</td>
<td>( v_1 = P_1 \times b )</td>
</tr>
<tr>
<td>( v_2 )</td>
<td>( v_2 = P_2 \times b )</td>
</tr>
<tr>
<td>( x_2 )</td>
<td>( x_2 = (D_{22} - D_{21} \times D_{11}^{-1} \times D_{12})^{-1} \times (v_2 - D_{21} \times D_{11}^{-1} \times v_1) )</td>
</tr>
<tr>
<td>( x_1 )</td>
<td>( x_1 = D_{11}^{-1} \times v_1 )</td>
</tr>
<tr>
<td>( x = P_2 \times x_1 + P_2 \times x_2 )</td>
<td></td>
</tr>
</tbody>
</table>
Figure 2: Two algorithms. On the left: A variant of the conjugate gradient method; on the
right: A preconditioner, the Schur complement method.
Figure 3: Overview of QIRAL compilation chain
Rewriting System Generation: From its current \( \LaTeX \) implementation, the QIRAL input
is translated into a set of rewriting rules and equations, using Maude framework \[9\]. Maude
is a multi-purpose rewriting system, handling equational rewriting rules and reflection. More
precisely, definitions are translated by a first phase, \texttt{tex2maude} into equations (or conditional equations) and algorithms into rewriting rules. The output file contains domain specific definitions (e.g. the Dirac operator from Figure 1), the desired program (in our case $x = \text{Dirac}^{-1} b$), and all algorithms and preconditioners we want to apply.
Definitions have a semantic similar to a rewriting rule: the left hand side is rewritten into the right hand side. To ensure the existence of a normal form, the system of equation has to be convergent and confluent. So far, our implementation does not use a tool such as an automatic Church-Rosser Checker \cite{4}. Algorithms are translated into conditional rules, applied is their prerequisite are checked. The left hand side of the rule correspond to the \texttt{Match} clause and the algorithm itself is the right hand side.
This rewriting system is merged with another one defining general algebraic properties, code generation rewriting rules and code optimizations. The main phase of the QIRAL compiler is therefore described through rewriting system, following works such as Stratego \cite{11}. QIRAL is a static strongly type language, vectors and matrices are defined by their index sets. Type checking is the first analysis achieved by this main phase.
Applying Algorithms and Simplifications: The user provides the list of algorithms to compose and the initial program (here, we focused on the equation $x = \text{Dirac}^{-1} b$). Exploring different algorithms and sequences of algorithms boils down to change the list given to the QIRAL compiler. Checking that algorithm requirements is automatically achieved by the rewriting system, using the equational theory provided through the system of definitions. The equational system, using both equations coming from LQCD definitions and algebraic properties involving the different operators, simplifies terms that are equal to zero.
The result is a program where the matrix $A$ of the algorithms has been replaced either by the Dirac matrix, or by a matrix obtained through transformation by preconditioners.
Loop generation and parallelization: At this step, the initial statement has been replaced by the algorithm statements, directly using the Dirac matrix or a preconditioned version. Assignment statements are vector assignments: Values for all vertices of the lattice can be modified in one statement. Matrices are still described using tensor products and direct sums.
Loops are obtained by transforming all indexed sums, products into loops or sequences. For instance, the direct sum operator indexed by the lattice $L$ in the definition of Dirac matrix, in Figure 1 is transformed into a parallel loop over all elements of the lattice. This loop is parallel, due to the meaning of $\oplus$. As the lattice is 4D, either 4 nested loops are created, or one single, linearized loop is created. The choice depends on a parameter in the QIRAL compiler.
Some usual compiler transformations are then used, computing dependences, fusioning loops, applying scalar promotion and other optimizations. At the end of this phase, an OpenMP code is produced, essentially by identifying for parallel loops the set of private variables. These transformations are driven by rewriting strategies, using reflection in Maude.
Matching Library Calls: The resulting code still uses some high level operators on dense matrices, such as tensor products on dense matrices, matrix-vector product. These operators are then replaced by library calls. For this step, it is sufficient to define for each library the expression it computes, as a rewriting rule. We defined LION, a set of hand-written library functions used for validation purposes.
Finally, post-processing phase, mostly syntactic rewriting, transforms this output into a C function. This function is compiled with a program skeleton and a runtime that initializes data, calls the generated code and stores the result. Custom functions can also be defined here.
... while(nr > epsilon) {
#pragma omp parallel for private(ID30,ID31,ID43,ID44,ID56)
for(iL = 0; iL < L; iL++) {
ID31 = spnaddspn(matmulspn(tensor(U[uup(iL, dt)], gmsubgm(gmdiag(c1), G(dt))), p[sup(IDX, dt)]),
spnaddspn(matmulspn(tensor(U[uup(iL, dz)], gmsubgm(gmdiag(c1), G(dz))), p[sup(IDX, dz)]),
spnaddspn(matmulspn(tensor(U[uup(iL, dy)], gmsubgm(gmdiag(c1), G(dy))), p[sup(IDX, dy)]),
matmulspn(tensor(U[uup(iL, dx)], gmsubgm(gmdiag(c1), G(dx))), p[sup(IDX, dx)]))) ;
ID30 = cplmulspn(kappa, ID31) ;
ID44 = spnaddspn(matmulspn(tensor(U[udn(iL, dt)], gmaddgm(gmdiag(c1), G(dt))), p[sdn(IDX, dt)]),
spnaddspn(matmulspn(tensor(U[udn(iL, dz)], gmaddgm(gmdiag(c1), G(dz))), p[sdn(IDX, dz)]),
spnaddspn(matmulspn(tensor(U[udn(iL, dy)], gmaddgm(gmdiag(c1), G(dy))), p[sdn(IDX, dy)]),
matmulspn(tensor(U[udn(iL, dx)], gmaddgm(gmdiag(c1), G(dx))), p[sdn(IDX, dx)]))) ;
ID43 = cplmulspn(kappa, ID44) ;
...
Figure 4: Sample output C code produced for CGNR algorithm
since undefined operations from the QIRAL input appear as functions calls. One application is to call BLAS routines instead of letting QIRAL implement them. For instance one defines a rule that says $(C = A \ast B) = \text{dgemm}(A, B, C)$. At this stage, we are more concerned about the correctness of the output rather than the efficiency of the code, which will be the purpose of further steps. Automatically generated codes for different algorithms and preconditionings show different convergence speed, as shown in Figure 5.
Figure 5: Convergence speed for a lattice of size $4^4$ for different methods: Conjugate Gradient Normal Error (CGNE), Normal Resolution (CNRG), Biconjugate Gradient (BiCGSTAB), Modified conjugate gradient with preconditioning (MCR1).
5 Conclusion
This paper has presented an overview of QIRAL, a high level language for automatic parallel code generation of Lattice QCD codes. The language is based on algorithmic specifications and on mathematical definitions of mathematical objects used in the computation.
The contribution of this short paper is to show that a high-level representation makes possible the automatic generation of complex LQCD parallel code. Parallelism directly stems from the structure of sparse, regular matrices used in LQCD. While the initial matrix represents a stencil computation, QIRAL is able to manipulate more complex structures obtained through preconditioning for instance, unlike Pochoir [10]. The approach, similar to the one proposed by Ashby et al. [1] enables the user to define new equations and domain-specific definitions. The QIRAL compiler is able to keep such information through transformations resulting from preconditioners or algorithms. The tensor product and direct sum operators are translated into parallel loops and lead to OpenMP code generation. This way, algorithmic exploration, the key for higher levels of performance, can be freed from the constraints and costs of parallel tuning. Besides generation of distributed codes with communications is within reach. For heterogeneous architectures, such as Cell or GPUs, further work for automatic data-layout optimization is required, in order to reach levels of performance of previous works (such as [12] [6] [9] for the CELL BE and [2] for the GPU).
References
|
{"Source-Url": "https://hal.archives-ouvertes.fr/hal-00666885/file/paper.pdf", "len_cl100k_base": 5493, "olmocr-version": "0.1.53", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 27156, "total-output-tokens": 6729, "length": "2e12", "weborganizer": {"__label__adult": 0.0004167556762695313, "__label__art_design": 0.0004963874816894531, "__label__crime_law": 0.0005030632019042969, "__label__education_jobs": 0.000885009765625, "__label__entertainment": 0.00020575523376464844, "__label__fashion_beauty": 0.00026106834411621094, "__label__finance_business": 0.00032401084899902344, "__label__food_dining": 0.0005893707275390625, "__label__games": 0.0009760856628417968, "__label__hardware": 0.001941680908203125, "__label__health": 0.0009546279907226562, "__label__history": 0.0004830360412597656, "__label__home_hobbies": 0.00018644332885742188, "__label__industrial": 0.0011148452758789062, "__label__literature": 0.0003750324249267578, "__label__politics": 0.0005540847778320312, "__label__religion": 0.0009551048278808594, "__label__science_tech": 0.438232421875, "__label__social_life": 0.0001982450485229492, "__label__software": 0.011322021484375, "__label__software_dev": 0.537109375, "__label__sports_fitness": 0.0006308555603027344, "__label__transportation": 0.0009222030639648438, "__label__travel": 0.0002903938293457031}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24052, 0.02991]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24052, 0.64552]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24052, 0.82987]], "google_gemma-3-12b-it_contains_pii": [[0, 1024, false], [1024, 4066, null], [4066, 7880, null], [7880, 11434, null], [11434, 14157, null], [14157, 18201, null], [18201, 20365, null], [20365, 24052, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1024, true], [1024, 4066, null], [4066, 7880, null], [7880, 11434, null], [11434, 14157, null], [14157, 18201, null], [18201, 20365, null], [20365, 24052, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 24052, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24052, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24052, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24052, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24052, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24052, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24052, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24052, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24052, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24052, null]], "pdf_page_numbers": [[0, 1024, 1], [1024, 4066, 2], [4066, 7880, 3], [7880, 11434, 4], [11434, 14157, 5], [14157, 18201, 6], [18201, 20365, 7], [20365, 24052, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24052, 0.19014]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
836622186eb51da071d5864f1d8abf1df3e9d1f5
|
Architecture for Agile Provisioning of Financial Products and Services
Build products and services and deploy them as content in an appropriately architected system
14 April 2014
Agility
“Agility is a core competency”
“Companies must be flexible enough to customise their products [and services] for customers who expect special treatment, but they must also provide that special treatment from a common, standardized supply chain and business infrastructure”
Agility and change
How quickly you can adapt to change = agility
How quickly you can drive change into the market = agility
Change arises from leadership – your own or someone else’s!
Product/Service is the nexus of the Customer/Company relationship
Company offers benefits under defined conditions
Customer subscribes to benefits under agreed conditions
Agility in provisioning Products and Services is now the enterprise “front-line”
“With a strategic combination of standardization and flexibility, companies can more efficiently fulfil their promises to their customers”**
Standardised processes – enabler, constraint, or both?
- Standardised product definitions inhibit agility
- Reusing standardised generic processes aids agility
Processes can be standardised without compromising product agility
- To help product agility, standardised processes must be 100% product or service agnostic, requiring zero knowledge of the internal product structure
The Product or Service becomes CONTENT in a standardised system
Benefits of “Product-As-Content”/“Service-As-Content”
- **Strategic Alignment**: 100% alignment between business policies and systems
- **Agility**: Rapid product and service innovation to meet new market conditions
- **New Options**: Economic development of tailored products and services for finer grained, niche markets, or limited issue customised “Partner Products/Services”
- **ROI**: Reduce product/service development cost, time, and risk
Financial Products and Services are Agile ‘Content’ in a Standardised System
Build a financial product or service ‘factory’ for agile product development in a standardised framework
Overview
- **Empower business owners**
Enable independent “Product/Service” development by SME “Product Owners”
Products and Services are able to be modelled, built, tested, and deployed as discrete content within existing systems
- **Change in IT Focus**
Deliver/maintain highly engineered capabilities for use by products and services
Operate and manage products/services as content in suitably architected environment
- **Separation of responsibility**
Business defines + manages products/services within available system capabilities
IT provides capabilities to support product and service requirements
- **Product or Service structure, details, and behaviour can be managed using the IDIOM tools**
Details and behavior are controlled by IDIOM Decision Models
IDIOM Forms and IDIOM Decision Models manage user interaction
IDIOM Workbench is used for product testing and simulation on a large scale
**What is a Product or Service**
- “Product” and “Service” are broad terms implying a predefined process that is initiated by a specific customer request (the context) and closed by vendor acceptance and pricing.
- Requests are recorded as complete instances of the Product or Service and are managed within the Product/Service business policy defined life-cycle.
- Includes anything that can be sold, supplied, or allowed based on context specific information including for example:
- Insurance products (e.g. a policy)
- Lending products (e.g. a loan)
- Entitlements and program admissions (e.g. a benefit entitlement)
- Claims (e.g. claiming and entitlement from an insurance policy)
- Insurance Products are generally used as examples in this document – replace with ‘loan’ ‘benefit entitlement’ ‘claim’ etc. as appropriate to your business. Please read Product as implying Product or Service throughout.
What does a Product look like
- A set of business policies (rules) that define:
- What is being offered by way of the product (benefits)
- Conditions under which it will accept requests for the product (underwriting)
- Associated costs and terms (rating)
- Future life-cycle events, and their associated conditions, costs and terms (behaviour)
- **Context data**: a collection of factors that will be used by the rules to determine the business policy outcomes as above
- Assume the meta data format is the xml schema (xsd) (factor definitions)
- Assume the actual data is an xsd compliant xml document (factor values)
- Often 100s of factor definitions, many 1,000s of factor values per product instance
- Offer and acceptance imply pre and post processes for:
- Data capture, validation, aggregation, enrichment, and transformation
- Mappings to/from a range of internal and external systems
- Plus a set of interfaces to allow interaction with the external environment to collect and maintain the factors
Product Development Life Cycle - PDLC
A new, propitious “PDLC” for development and deployment of Products under SME control
Product Owners Use IDIOM Tools to Develop, Prove and Implement Product Strategies
- **Product Owners**
- **Operational Environment**
- UAT, Regression, Production
- **Departmental Test Harness**
- **Product Pre-Release**
- **Portfolio Data**
- **Simulation + What If + Large-scale Test Environment**
- “I” = IDIOM Decision Manager
- “F” = IDIOM Forms
- “W” = IDIOM Decision Manager Workbench
© Idiom Software Ltd
PDLC – develop new Products
- Product Owner/SMEs develop
- Definition of Factors – by updating the Schema
- All rules – by developing Decision Models
- . . . and test the Product’s underlying business policies
- Use the Workbench for full scale product simulation and testing
- Adjust and refine policies to ensure business objectives are met
- . . . before configuring Forms for End User interaction
- Define forms and forms behaviour – by developing IDIOM Forms and UI ‘session’ Decision Models respectively
- Then test and release to standard deployment process
- When complete, consistent, and correct, transfer to standard IT system test and UAT processes
© Idiom Software Ltd
PDLC – also use Product Configurations
- Build schema, rules, forms to manage product configurations (parameters)
Entire sub system for use by Product Owners
Product Owners explicitly build rules to respond to these configurations
- Product configuration ‘Forms’ are used to input and manage product parameters
Used by Product Owners, effective dated, and stored as ‘ProductConfigXML’
- Execution of Product rules always accompanied by Product Configuration document
Rules read ProductConfigXML document to access product parameters at runtime
E.g. rates, calculation methods, boundary conditions, etc
Technology Implications
- Product authors and IT infrastructure align around common Schema defined data structures
- Provides the data ‘sand-pit’ for product development
- The full scope of data must be instantiated whenever the rules run
- One common schema/set of schemas e.g. for insurance:
- Common policy details, perils, risks, terms etc
- Hierarchy of risk elements to cover increasingly specific risk data
- Each shared schema element to be matched with shared rules for reuse
- Store complete XML document as part of core DB design for data agility and complete auditability
- Use rules to dynamically map agile schema defined data to known standard elements that then map to fixed database columns
- Targets includes both external (incl 3rd party) and internal systems and databases
- Extract and process these elements with standard processes – they do not change unless the target system changes
Solution Architecture - Overview
Product as content, and the associated PDLC, both assume the existence of a generic application that is not ‘product aware’
Key Assumptions
- The ‘product’ will deploy as a self-contained ‘Product Engine’, which conceptually sits inside a customer specific generic application.
- The customer specific generic application:
- Provides all generic (standardised) application capabilities
- Requires no knowledge of the internal content of either the Product meta data or context data in order to operate (except where the meta data or context data is targeted directly for consumption by the application)
- Connects events and their context data with the correct rules for processing
- Directs the results of rules execution to all related systems to apply as appropriate in order to align with the final state of the context data
- Given agreement to an appropriate set of interfaces, the ‘product engine’ can be inserted into any application (including legacy), or operated as a service from a cloud environment or similar.
Features of the Customer Application (1)
- A generic application to provide capabilities for:
- Persistence
- Invocation of rules
- Invocation of forms, human interfaces (if applicable)
- Internal function invocation
- Integration with other systems and interfaces
- Polling service to generate time driven events
- User session management (if applicable)
- Authentication, authorisation
- Role based access to generic functions plus ‘Product instance’ search+select
- ‘Product instance’ search+select results in product specific actions
- External events are recognised by ‘hard-coded’ application response
- E.g. user selects product specific action; message arrives on queue; date/time reached, etc
- Application acquires context data and hands-off to the Product Engine for rules +/- or forms execution – without knowing anything about the product being processed
The Product Engine manages response in accordance with rules until rules determine the transaction is complete (a new valid state is reached)
Completion of rules processing includes creation of new context data for:
- Internal control and workflow (eg automated bring-ups, warnings, action lists)
- Database column values for insert into standard (fixed) database columns
- All relevant external system mappings (eg financials, legacy, workflow)
When the Product Engine returns the completed transaction ‘XML context data’ to the application:
- Database is updated: the context data is inserted as XML into one XML column; other column values are extracted from the XML and inserted natively
- Control data (bring-ups, warnings, action lists etc) are extracted and cleared and replaced in the database for this entity
- All external systems data is extracted and posted via respective integration components
Result:
- XML column holds current state of the product instance in 1 XML document
- All internal and external systems are synchronised with this new state
User Transactions - Summary
- Native user session management for:
- Authentication, authorisation
- Role based access to non-product specific functions incl product search/select
- Product search and select
- User selects non specific product action
- Application performs the action eg admin, activity lists, print queues, etc
- User selects “New” product instance
- Hand-off to Product Engine for rules controlled instantiation
- User selects existing product instance
- Present rules driven list of valid actions
- Actions may be generic (print, send, etc) or product specific (change, renew, cancel, etc)
- All product specific actions are handed-off to the Product Engine
‘Product Engine’ Concept Overview
Map to database column values
Bring ups for future events: renewals, cancellation, instalments etc
Actions, alerts
Synchronise external systems
Billing/GL
External Workflow
Legacy System
External Systems Interfaces
WebService
Queue
File
Call
DB Update
External Systems Mapping
Decision Models
Financials
Workflow
Legacy
Document Generator
Others?
External System Decision Models
Future Events
Database Index Columns
Control Data
Internal System Decision Models
Validation
Underwriting
Rating
Reinsurance
Others?
Core Business Processing
Decision Models
IDIOm Forms
Session Models
Transaction Cycle
On-Boarding: Mappings, Validations
Transaction Cycle
Proprietary
Industry Reference Data
Etc
Product Configurations
Control Model
(all rules execute in here as ‘decision models’)
Product Engine
© Idiom Software Ltd
Rules Apply throughout the Transaction Cycle
Decision Models need to be selected based on context and applied to many different areas of the policy underwriting and rating cycle.
Sample Pattern for Core Business Models
Control Model can dynamically aggregate rules components to service some risk types
Same function, different approach
The Control Model determines which rules run against the data elements
The product defined pattern of rules is matched by the existence of elements in the underlying XML document – if the element exists, then the rules run.
Proforma ‘Product Factory’ Database Design
Red: Pre-Configured Database Tables. EntityType (see below) is a table name in this database enabling generic use of BringUps and Actions.
Yellow: all ROWS are generated by Decision Models. Financial Entry is an example of data that is generated by Decision Models specifically for a known external system (columns are bespoke to that system).
Blue: ProductInstanceXML holds all context data for the product instance; standard known values are extracted on ‘Save’ to populate the other column values.
Green: ‘Product’ Definition Tables. Archetype holds source schemas for ProductConfigXML and ProductInstanceXML.
ProductConfigXML holds product parameters for the product.
ProductConfigXML holds product parameters for the product.
With Schemas, Rules, and Forms aligned as system ‘content’, new factors can be introduced by business owners ‘without coding’ by simply updating the ProductConfigXSD and the ProductInstanceXSD schemas.
This feature can be used to dynamically build user selected options into new product instances that are customised by the Product Configurations.
IDIOM Forms automatically recognizes and displays the new factors.
IDIOM Tools - Introduction
IDIOM Decision Manager
IDIOM Forms
IDIOM Decision Manager Workbench (DMW)
IDIOM Decision Manager
- IDIOM Decision Manager is a tool for graphically modeling and deploying business decisions - without programming!
- A tool for the policy maker, not the programmer
- IDIOM Decision Manager automates complex policy based decision-making at the enterprise level, deployable as industrial strength stand-alone components
- In day-to-day practice it is usually used by IDIOM trained analysts or SMEs working interactively with Product Owners.
Together they model the business/policy domain in terms of both data and decisions (see Decision Model slide:26) before moving on to define the underlying ‘Formula’ logic that binds them together (slide:27)
- Deployment as software components is fully automated and ‘without fingerprints’
This example is a real model drawn from a City Council implementation of policy that calculates financial contributions to be paid by property developers.
The policy is decomposed using a ‘mind mapping’ approach until we reach the atomic units that we call decisions (rounded boxes).
This ‘decision model’ is demonstrably aligned and integrated with the adjacent data model (left hand panel) - validating and strengthening both.
The atomic ‘decisions’ provide an easy entry point for specification of the underlying rule details via the Formulas.
Formula slide (next) calculates this decision value . . .
. . . and the Decision puts the value here
IDIOM Decision Manager (Formula Palette)
- The underlying rules details are easily captured using a ‘Lego’ like drag-and-drop development approach
‘More fun than playing golf’ according to the CEO of one of our largest customers
There is no scripting or coding required to build these formulas
- The rules can be tested immediately within the IDIOM Decision Manager palettes
- When finished, IDIOM Decision Manager generates computer source code (C# or Java) with a single button click
Callable by any application at run-time using any of a wide variety of simple interfaces and wrappers (in-line, dll, web service, queue service, many more)
Can also be published directly into the IDIOM Decision Manager Workbench
- At the same time it generates the model into business readable documentation (PDF)
IDIOM Decision Manager – Key Points
- IDIOM’s decision models do for policy decisions what data models do for data – a powerful abstraction that makes the underlying complexity visible and manageable
- The models allow internal data transformations and business rules to be intermingled within a single transaction
Business rules acting alone are severely limited in their ability to fully implement business policy – invariably, in-line data transformations are necessary to match the terminology* used in the policy statements
- Decision models that incorporate both data and rules behaviour enable a further critical capability that is unique to IDIOM Decision Manager – the models can be fully tested using real-world test cases directly in the builder palettes
No external technology or application support is required to empirically prove the correctness, completeness, and consistency of the models
- The decision models are converted into a form of ‘logical English’ and/or XML for complete transparency
In addition to the C# or Java program source code that fully automates the models!
* Personalised terminology is an ‘idiom’; hence the name of our company and product
Use IDIOM Decision Manager Workbench For:
- Routine testing for intended/unintended changes during development
- Unintended consequences can be a major cost
- Can run regression for every change, with expected outcomes masked
- Run daily during development, plus comprehensive release testing
- Verify business policy changes
- Execute new business policies (e.g. underwriting and rating, or claims) across existing portfolio
- Use further decision models to assess outcomes and verify that the changes are beneficial and as planned
- Routine verifications and investigations
- Develop models for portfolio investigation and reporting
- Full file pass to generate updates for new, low cost batch processes
- Production of masked test data from production sources
- Migration of data between unlike databases or versions thereof
Worked Example
Example Scenario: A Group Insurance Scheme Distributed via a Superannuation Fund to its Members
Scenario Outline
- Insurer provides basic insurance cover for all fund members
- Say, basic death cover
- Provided by auto processing existing member data in standard batch process
- Insurer offers an opt-in opportunity for members for more complex products
- Insurer offers up-sell based on existing member data
- Say, death/disability/trauma for all family members
- Member opts-in and provides additional details for immediate cover, or follow-up referral if needed
- Opt-in for all Products using a single Form accessed via a ‘Member Portal’
- Portal may be Fund, Administrator, or 3rd Party
- Form is defined by the Insurer
- Form includes Insurer’s validation, underwriting, rating rules tailored for the specific scheme/product instance
Assume Insurer has ‘Standard’ Capabilities (1)
All of these capabilities are reusable across all schemes (2 slides)
- A single XML Schema defines policy data for all scheme products
- Includes standard insured, policy, risk, cover and financial elements
- Includes standard workflow elements – bring-ups, warnings, actions
- Includes standard elements for updating Insurer’s back-end systems
- Includes standard elements for updating Member Administration systems
- Standard mappings to/from industry systems (SQL <> XML)
- In-bound member details are mapped to standard insurance elements
- Insurance and workflow elements are mapped out to Insurer’s internal systems
- Member updates are mapped back to Member Admin system (e.g. Acurity, Sonata, Blue Door et al)
IDIOM Mapper can be used for all mappings
- Standard business policy defined rules are built over the Schema
- Insurance rules provide standard validation, underwriting, rating
- Support rules generate financials, workflow, internal/external system elements
- Session rules dynamically morph the Form for required behaviour
Assume Insurer has ‘Standard’ Capabilities
- One umbrella Scheme management database for all Schemes
- The single XML Document describing insurance policy data is stored extant
- Workflow elements are extracted and put in tables for Insurer workflow
- Scheme Fund details, deployment details, batch transfer details et al are standard table data in this database for operational management of schemes
- Product Configuration
- Product configuration document (per product) contains parameters for validations, underwriting, rating (e.g. rates, allowable ages, calculation methods)
- All decision models understand and use the product configuration document
- Most versions of products, and many new products, can be created by simply cloning and updating an instance of the Product Configuration document
- Two IDIOM Forms
- One Form is to maintain the Product Configurations (Insurer use only)
- One Form is to access all of the Policy details (Insurer, Fund, Members???)
- The Policy Form morphs dynamically for individual scheme and user combinations under the control of decision models
Can the new Scheme be simply configured via a Product Configuration
Yes: Clone, update, and set up Scheme operational data. Finish! (hours)
NO: does it fit within the data available in the existing schema?
No: extend schema with new standard and/or scheme specific elements
Continue: adjust rules for scheme
Minor variations simply added to existing decision models (hours)
Build specific decision models for more substantial variations (hours to days)
Adjust the ‘control model’ to include any new decision models (minutes)
Update the existing Form
Only elements used by this scheme will appear in the Form – automatically
Provide new style-sheet if new styling required to align with Member Portal
If entirely new look+feel needed, clone and adjust Form or rebuild (days)
Set up Scheme operational data. Finish!
Test and Deploy
- Insurer testing using IDIOM Decision Manager Workbench
- Fund uses Workbench to copy and mask member test data for Insurer
- Insurer uses Workbench for full insurance life cycle testing of Batch processes
- Insurer uses Workbench for full insurance life cycle testing of Forms processes
- Test deploy the Form to Insurer test harness to test visuals + behaviour
- Deploy batch process with correct mappings and decision models
- Fund Administrator to run batch processes stand-alone, or embed in daily/monthly process, or run via IDIOM Workbench
- All rules now specific to the scheme but most simply reused
- Extract and transfer generated elements back to Insurer (backend) and Member Admin database by preferred method
- Deploy Form and link to external websites
- Deploy Form in a frame within existing Portal and redirect back to insurer system
- Or, generate and embed within the Member Portal (not connected to Insurer)
- System test and go live!
Summary
This architecture works – today there are millions of on-risk insurance policies being managed in the architecture as presented.
Business Benefits
- 100% alignment of strategic business policies and computer systems
- Business fully controls business policy and product/service development and deployment
- Much more efficient rules development; maximum rules reuse once developed
- Local ‘simulation workbench’ for testing products/services and their updates to assist product and business policy development
- Product changes verified against existing portfolio before release – no surprises
- And of course, maximum product agility in a standardised framework as promised
Thank You
Mark Norton
mark.norton@idiomsoftware.com
+64 21 434669
|
{"Source-Url": "http://www.idiomsoftware.com/DOCS/Download/de9bcb9d-f1e8-4149-883c-dafe088fdfb0.pdf", "len_cl100k_base": 4849, "olmocr-version": "0.1.50", "pdf-total-pages": 41, "total-fallback-pages": 0, "total-input-tokens": 55968, "total-output-tokens": 6527, "length": "2e12", "weborganizer": {"__label__adult": 0.0004189014434814453, "__label__art_design": 0.0008821487426757812, "__label__crime_law": 0.0005087852478027344, "__label__education_jobs": 0.0010347366333007812, "__label__entertainment": 9.53078269958496e-05, "__label__fashion_beauty": 0.0002117156982421875, "__label__finance_business": 0.018096923828125, "__label__food_dining": 0.00041031837463378906, "__label__games": 0.0007572174072265625, "__label__hardware": 0.000614166259765625, "__label__health": 0.0004198551177978515, "__label__history": 0.00020802021026611328, "__label__home_hobbies": 0.0001513957977294922, "__label__industrial": 0.0009293556213378906, "__label__literature": 0.00021505355834960935, "__label__politics": 0.0003151893615722656, "__label__religion": 0.00029468536376953125, "__label__science_tech": 0.007015228271484375, "__label__social_life": 8.529424667358398e-05, "__label__software": 0.032684326171875, "__label__software_dev": 0.93359375, "__label__sports_fitness": 0.0002918243408203125, "__label__transportation": 0.00064849853515625, "__label__travel": 0.0002510547637939453}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24436, 0.0043]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24436, 0.02749]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24436, 0.88685]], "google_gemma-3-12b-it_contains_pii": [[0, 181, false], [181, 998, null], [998, 2125, null], [2125, 2308, null], [2308, 3259, null], [3259, 4180, null], [4180, 5210, null], [5210, 5335, null], [5335, 5755, null], [5755, 6466, null], [6466, 7086, null], [7086, 8012, null], [8012, 8170, null], [8170, 9093, null], [9093, 9986, null], [9986, 11053, null], [11053, 11752, null], [11752, 12626, null], [12626, 12806, null], [12806, 13192, null], [13192, 13972, null], [13972, 14389, null], [14389, 14491, null], [14491, 15250, null], [15250, 15800, null], [15800, 15902, null], [15902, 15902, null], [15902, 16720, null], [16720, 17919, null], [17919, 17919, null], [17919, 17919, null], [17919, 18765, null], [18765, 18877, null], [18877, 19640, null], [19640, 20759, null], [20759, 21870, null], [21870, 22692, null], [22692, 23685, null], [23685, 23823, null], [23823, 24370, null], [24370, 24436, null]], "google_gemma-3-12b-it_is_public_document": [[0, 181, true], [181, 998, null], [998, 2125, null], [2125, 2308, null], [2308, 3259, null], [3259, 4180, null], [4180, 5210, null], [5210, 5335, null], [5335, 5755, null], [5755, 6466, null], [6466, 7086, null], [7086, 8012, null], [8012, 8170, null], [8170, 9093, null], [9093, 9986, null], [9986, 11053, null], [11053, 11752, null], [11752, 12626, null], [12626, 12806, null], [12806, 13192, null], [13192, 13972, null], [13972, 14389, null], [14389, 14491, null], [14491, 15250, null], [15250, 15800, null], [15800, 15902, null], [15902, 15902, null], [15902, 16720, null], [16720, 17919, null], [17919, 17919, null], [17919, 17919, null], [17919, 18765, null], [18765, 18877, null], [18877, 19640, null], [19640, 20759, null], [20759, 21870, null], [21870, 22692, null], [22692, 23685, null], [23685, 23823, null], [23823, 24370, null], [24370, 24436, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 24436, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24436, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24436, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24436, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24436, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24436, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24436, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24436, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24436, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24436, null]], "pdf_page_numbers": [[0, 181, 1], [181, 998, 2], [998, 2125, 3], [2125, 2308, 4], [2308, 3259, 5], [3259, 4180, 6], [4180, 5210, 7], [5210, 5335, 8], [5335, 5755, 9], [5755, 6466, 10], [6466, 7086, 11], [7086, 8012, 12], [8012, 8170, 13], [8170, 9093, 14], [9093, 9986, 15], [9986, 11053, 16], [11053, 11752, 17], [11752, 12626, 18], [12626, 12806, 19], [12806, 13192, 20], [13192, 13972, 21], [13972, 14389, 22], [14389, 14491, 23], [14491, 15250, 24], [15250, 15800, 25], [15800, 15902, 26], [15902, 15902, 27], [15902, 16720, 28], [16720, 17919, 29], [17919, 17919, 30], [17919, 17919, 31], [17919, 18765, 32], [18765, 18877, 33], [18877, 19640, 34], [19640, 20759, 35], [20759, 21870, 36], [21870, 22692, 37], [22692, 23685, 38], [23685, 23823, 39], [23823, 24370, 40], [24370, 24436, 41]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24436, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
4e5cf3cd0ed08dc90aeab285e22833aa74511e2a
|
Quiz 16.2: Layering
• Q1: True _ False _ Layering improves application performance
• Q2: True _ False _ Routers forward a packet based on its destination address
• Q3: True _ False _ “Best Effort” packet delivery ensures that packets are delivered in order
• Q4: True _ False _ Port numbers belong to network layer
• Q5: True _ False _ The hosts on Berkeley’s campus share the same IP address prefix
Review: Internet Protocol (IP)
• Internet Protocol: Internet's network layer
• Service it provides: “Best-Effort” Packet Delivery
– Tries it’s “best” to deliver packet to its destination
– Packets may be lost
– Packets may be corrupted
– Packets may be delivered out of order
![Diagram of IP network]
Review: Transport Layer (4)
- **Service**: Provide end-to-end communication between processes
- Demultiplexing of communication between hosts
- Possible other services:
- Reliability in the presence of errors
- Timing properties
- Rate adaptation (flow-control, congestion control)
- **Interface**: send message to specific process at given destination; local process receives messages sent to it
- **Protocol**: port numbers, perhaps implement reliability, flow control, packetization of large messages, framing
- Examples: TCP and UDP
Review: Internet Transport Protocols
- **Datagram service (UDP)**
- No-frills extension of “best-effort” IP
- Multiplexing/Demultiplexing among processes
- **Reliable, in-order delivery (TCP)**
- Connection set-up & tear-down
- Discarding corrupted packets (segments)
- Retransmission of lost packets (segments)
- Flow control
- Congestion control
- **Services not available**
- Delay and/or bandwidth guarantees
- Sessions that survive change-of-IP-address
Application Layer (7 - not 5!)
- **Service**: any service provided to the end user
- **Interface**: depends on the application
- **Protocol**: depends on the application
- Examples: Skype, SMTP (email), HTTP (Web), Halo, BitTorrent ...
- What happened to layers 5 & 6?
- “Session” and “Presentation” layers
- Part of OSI architecture, but not Internet architecture
- Their functionality is provided by application layer
Application Layer (5)
Five Layers Summary
• Lower three layers implemented everywhere
• Top two layers implemented only at hosts
• Logically, layers interacts with peer’s corresponding layer
Physical Communication
• Communication goes down to physical network
• Then from network peer to peer
• Then up to relevant layer
The Internet Hourglass
There is just one network-layer protocol, IP
The “narrow waist” facilitates interoperability
Implications of Hourglass
Single Internet-layer module (IP):
• Allows arbitrary networks to interoperate
– Any network technology that supports IP can exchange packets
• Allows applications to function on all networks
– Applications that can run on IP can use any network
• Supports simultaneous innovations above and below IP
– But changing IP itself, i.e., IPv6 is very complicated and slow
**Drawbacks of Layering**
- Layering can hurt performance
- E.g., hiding details about what is really going on
- Headers start to get really big
- Sometimes header bytes >> actual content
- Layer N may duplicate layer N-1 functionality
- E.g., error recovery to retransmit lost data
- Layers may need same information
- E.g., timestamps, maximum transmission unit size
---
**Goals for Today**
- Socket API
- TCP
- Open connection (3-way handshake)
- Reliable transfer
- Tear-down connection
- Flow control
---
**Socket API**
- Socket API: Network programming interface
**BSD Socket API**
- Created at UC Berkeley (1980s)
- Most popular network API
- Ported to various OSes, various languages
- Windows Winsock, BSD, OS X, Linux, Solaris, ...
- Socket modules in Java, Python, Perl, ...
- Similar to Unix file I/O API
- In the form of `file descriptor` (sort of handle).
- Can share same `read()/write()/close()` system calls
TCP: Transport Control Protocol
- Reliable, in-order, and at most once delivery
- Stream oriented: messages can be of arbitrary length
- Provides multiplexing/demultiplexing to IP
- Provides congestion and flow control
- Application examples: file transfer, chat
TCP Service
1) Open connection: 3-way handshaking
2) Reliable byte stream transfer from (IPa, TCP_Port1) to (IPb, TCP_Port2)
- Indication if connection fails: Reset
3) Close (tear-down) connection
Open Connection: 3-Way Handshaking
- Goal: agree on a set of parameters, i.e., the start sequence number for each side
- Starting sequence number: sequence of first byte in stream
- Starting sequence numbers are random
Open Connection: 3-Way Handshaking
- Server waits for new connection calling listen()
- Sender call connect() passing socket which contains server’s IP address and port number
- OS sends a special packet (SYN) containing a proposal for first sequence number, x
Client (initiator)
SYN, SeqNum = x
Active Open
connect() time
Server
listen()
Passive Open
Open Connection: 3-Way Handshaking
- If it has enough resources, server calls `accept()` to accept connection, and sends back a SYN ACK packet containing:
- Client's sequence number incremented by one, \((x + 1)\)
- Why is this needed?
- A sequence number proposal, \(y\), for first byte server will send
3-Way Handshaking (cont’d)
- Three-way handshake adds 1 RTT delay
- Why?
- Congestion control: SYN (40 byte) acts as cheap probe
- Protects against delayed packets from other connection (would confuse receiver)
General’s Paradox
- General’s paradox:
- Constraints of problem:
- Two generals, on separate mountains
- Can only communicate via messengers
- Messengers can be captured
- Problem: need to coordinate attack
- If they attack at different times, they all die
- If they attack at same time, they win
- Named after Custer, who died at Little Big Horn because he arrived a couple of days too early
- Can messages over an unreliable network be used to guarantee two entities do something simultaneously?
- Remarkably, “no”, even if all messages get through
- No way to be sure last message gets through!
Close Connection
- Goal: both sides agree to close the connection
- 4-way connection tear down
2min Break
Reliable Transfer
• Retransmit missing packets
– Numbering of packets and ACKs
• Do this efficiently
– Keep transmitting whenever possible
– Detect missing packets and retransmit quickly
• Two schemes
– Stop & Wait
– Sliding Window (Go-back-n and Selective Repeat)
Detecting Packet Loss?
• Timeouts
– Sender timeouts on not receiving ACK
• Missing ACKs
– Receiver ACKs each packet
– Sender detects a missing packet when seeing a gap in the sequence of ACKs
– Need to be careful! Packets and ACKs might be reordered
• NACK: Negative ACK
– Receiver sends a NACK specifying a packet it is missing
Stop & Wait w/o Errors
• Send; wait for ack; repeat
• RTT: Round Trip Time (RTT): time it takes a packet to travel from sender to receiver and back
– One-way latency (d): one way delay from sender and receiver
\[
\text{RTT} = 2d \\
\text{(if latency is symmetric)}
\]
Stop & Wait w/o Errors
• How many packets can you send?
• 1 packet / RTT
• Throughput: number of bits delivered to receiver per sec
Stop & Wait w/o Errors
• Say, RTT = 100ms
• 1 packet = 1500 bytes
• Throughput = 1500*8bits/0.1s = 120 Kbps
Stop & Wait w/o Errors
• Can be highly inefficient for high capacity links
• Throughput doesn’t depend on the network capacity → even if capacity is 1Gbps, we can only send 120 Kbps!
Stop & Wait with Errors
• If a loss wait for a retransmission timeout and retransmit
• How do you pick the timeout?
# Sliding Window
- **window** = set of adjacent sequence numbers
- The size of the set is the **window size**
- Assume window size is `n`
- Let `A` be the last ACK’d packet of sender without gap; then window of sender = `{A+1, A+2, …, A+n}
- Sender can send packets in its window
- Let `B` be the last received packet without gap by receiver, then window of receiver = `{B+1, …, B+n}
- Receiver can accept out of sequence, if in window
---
## Example: Sliding Window w/o Errors
- Assume
- Link capacity, `C` = 1Gbps
- Latency between end-hosts, `RTT` = 80ms
- `packet_length` = 1000 bytes
- What is the window size `W` to match link’s capacity, `C`?
- Solution
We want Throughput = `C`
Throughput = `W * packet_size / RTT`
`C = W * packet_size / RTT`
`W = C * RTT / packet_size = 10^9 bps * 80 * 10^-3 s / (8000 b) = 10^4` packets
**Window size ~ Bandwidth (Capacity), delay (RTT/2)**
---
# Sliding Window w/o Errors
- Throughput = `W * packet_size / RTT`
---
## Sliding Window with Errors
- Two approaches
- Go-Back-n (GBN)
- Selective Repeat (SR)
- In the absence of errors they behave identically
- Go-Back-n (GBN)
- Transmit up to `n` unacknowledged packets
- If timeout for ACK(`k`), retransmit `k`, `k+1`, ...
- Typically uses NACKs instead of ACKs
- Recall, NACK specifies first in-sequence packet missed by receiver
GBN Example with Errors
Window size (W) = 3 packets
Out-o-seq packets in receiver’s window
Timeout Packet 4
Assume packet 4 lost!
Why doesn’t sender retransmit packet 4 here?
Selective Repeat (SR)
- Sender: transmit up to \( n \) unacknowledged packets
- Assume packet \( k \) is lost
- Receiver: indicate packet \( k \) is missing (use ACKs)
- Sender: retransmit packet \( k \)
SR Example with Errors
Window size (W) = 3 packets
Unacked packets in sender’s window
Summary
- TCP: Reliable Byte Stream
- Open connection (3-way handshaking)
- Close connection: no perfect solution; no way for two parties to agree in the presence of arbitrary message losses (General’s Paradox)
- Reliable transmission
- S&W not efficient for links with large capacity (bandwidth) delay product
- Sliding window more efficient but more complex
Flow Control
- Recall: Flow control ensures a fast sender does not overwhelm a slow receiver
- Example: Producer-consumer with bounded buffer (Lecture 5)
- A buffer between producer and consumer
- Producer puts items into buffer as long as buffer not full
- Consumer consumes items from buffer

TCP Flow Control
- TCP: sliding window protocol at byte (not packet) level
- Go-back-N: TCP Tahoe, Reno, New Reno
- Selective Repeat (SR): TCP Sack
- Receiver tells sender how many more bytes it can receive without overflowing its buffer (i.e., AdvertisedWindow)
- The ACK contains sequence number N of next byte the receiver expects, i.e., receiver has received all bytes in sequence up to and including N-1
TCP Flow Control
- TCP/IP implemented by OS (Kernel)
- Cannot do context switching on sending/receiving every packet
- At 1Gbps, it takes 12 usec to send an 1500 bytes, and 0.8usec to send an 100 byte packet
- Need buffers to match …
- sending app with sending TCP
- receiving TCP with receiving app
TCP Flow Control
• Three pairs of producer-consumer's
① sending process → sending TCP
② Sending TCP → receiving TCP
③ receiving TCP → receiving process
Circular Buffer
• Assume
- A buffer of size N
- A stream of bytes, where bytes have increasing sequence numbers
» Think of stream as an unbounded array of bytes and of sequence number as indexes in this array
• Buffer stores at most N consecutive bytes from the stream
• Byte k stored at position (k mod N) + 1 in the buffer
TCP Flow Control
• Example assumptions:
- Maximum IP packet size = 100 bytes
- Size of the receiving buffer (MaxRcvBufl) = 300 bytes
• Recall, ack indicates the next expected byte in-sequence, not the last received byte
• Use circular buffers
Circular buffer
(N = 10)
sequence #
Circular buffer
(N = 10)
4/2/14 Anthony D. Joseph CS162 ©UCB Spring 2014 Lec 17.45
4/2/14 Anthony D. Joseph CS162 ©UCB Spring 2014 Lec 17.46
4/2/14 Anthony D. Joseph CS162 ©UCB Spring 2014 Lec 17.47
4/2/14 Anthony D. Joseph CS162 ©UCB Spring 2014 Lec 17.48
TCP Flow Control
- **AdvertisedWindow**: number of bytes TCP receiver can receive
\[
\text{AdvertisedWindow} = \text{MaxRcvBuffer} - (\text{LastByteRcvd} - \text{LastByteRead})
\]
- **SenderWindow**: number of bytes TCP sender can send
\[
\text{SenderWindow} = \text{AdvertisedWindow} - (\text{LastByteSent} - \text{LastByteAcked})
\]
- **Still true if receiver missed data...**
- **WriteWindow**: number of bytes sending process can write
\[
\text{WriteWindow} = \text{MaxSendBuffer} - (\text{LastByteWritten} - \text{LastByteAcked})
\]
- **Sending app sends 350 bytes**
- **Recall**:
- We assume IP only accepts packets no larger than 100 bytes
- MaxRcvBuf = 300 bytes, so initial Advertised Window = 300 bytes
Sender sends first packet (i.e., first 100 bytes) and receiver gets the packet
TCP Flow Control
Receiver sends ack for 1st packet
\[
\text{AdvWin} = \text{MaxRcvBuffer} - (\text{LastByteRcvd} - \text{LastByteRead})
\]
\[
= 300 - (100 - 0) = 200
\]
Sender sends 2nd packet (i.e., next 100 bytes) and receiver gets the packet
Receiving TCP delivers first 100 bytes to receiving process
TCP Flow Control
Sending Process
LastByteWritten(350)
| 1, 200 | 201, 350 |
LastByteAcked(0)
Receiving Process
LastByteRead(100)
| 101, 200 |
LastByteRcvd(200)
NextByteExpected(201)
Data[101,200]
{[1,100]}
{[1,1200]}
Ack=101, AdvWin = 200
Receiver sends ack for 2nd packet
AdvWin = MaxRcvBuffer – (LastByteRcvd – LastByteRead) = 300 – (200 – 100) = 200
Sender gets ack for 1st packet
• Sender gets ack for 1st packet
• AdvWin = 200
Sender stops sending as window full
SndWin = AdvWin – (LastByteSent – LastByteAcked) = 300 – (300 – 0) = 0
Sender sends 3rd packet (i.e., next 100 bytes) and the packet is lost
Sender stops sending as window full
SndWin = AdvWin – (LastByteSent – LastByteAcked) = 300 – (300 – 0) = 0
Sender gets ack for 1st packet
• AdvWin = 200
TCP Flow Control
Sending Process
- LastByteWritten(350)
- LastByteAcked(100)
- LastByteSent(300)
Receiving Process
- LastByteRead(100)
- LastByteRcvd(200)
- NextByteExpected(201)
- Data[1,100]
- {1,100}
- {1,100}
- {1,100}
- {101, 300}
- Ack=101, AdvWin = 200
- Receiver gets ack for 2nd packet
- AdvWin = 200 bytes
Sender still cannot send as window full:
SndWin = AdvWin – (LastByteSent – LastByteAcknowledged) = 200 – (300 – 100) = 0
Sender can now send new data!
SndWin = AdvWin – (LastByteSent – LastByteAcknowledged) = 100
TCP Flow Control
Sending Process
- LastByteWritten(350)
- LastByteRead(100)
- LastByteSent(350)
- LastByteRcvd(350)
- NextByteExpected(201)
Receiving Process
- LastByteAcked(200)
- LastByteSent(350)
- LastByteRcvd(350)
Data
- [1,100]
- [1,200]
- [1,300]
- [101,300]
- [201,350]
- [101,200],[301,350]
- [101,200],[301,350]
Ack = 201, AdvWin = 50
- Ack still specifies 201 (first byte out of sequence)
- AdvWin = 50, so can sender re-send 3rd packet?
TCP Flow Control
Sending Process
LastByteWritten(350)
LastByteAcked(200)
LastByteSent(350)
{[201,350]}
(201,350)
{[201,350]}
Ack=201, AdvWin = 50
Data[201,300]
{[101,200],[301,350]}
Yes! Sender can re-send 3rd packet since it's in existing window – won't cause receiver window to grow
4/2/14
Anthony D. Joseph
CS162
©UCB Spring 2014
Receiving Process
LastByteRead(100)
LastByteRcvd(350)
NextByteExpected(351)
{[201,350]}
(201,350)
{[201,350]}
Ack=201, AdvWin = 50
Data[201,300]
{[101,200],[301,350]}
4/2/14
Anthony D. Joseph
CS162
©UCB Spring 2014
Sender DONE with sending all bytes!
4/2/14
Lec 17.71
### Discussion
- Why not have a huge buffer at the receiver (memory is cheap)?
- Sending window (SndWnd) also depends on network congestion
- **Congestion control**: ensure that a fast sender doesn’t overwhelm a router in the network (discussed in detail in EE122)
- In practice there is another set of buffers in the protocol stack, at the **link layer** (i.e., Network Interface Card)
### Summary: Reliability & Flow Control
- Flow control: three pairs of producer consumers
- Sending process → sending TCP
- Sending TCP → receiving TCP
- Receiving TCP → receiving process
- AdvertisedWindow: tells sender how much new data the receiver can buffer
- SenderWindow: specifies how many more bytes the sending application can send to the sending OS
- Depends on AdvertisedWindow and on data sent since sender received AdvertisedWindow
### Summary: Networking (Internet Layering)
Any distributed protocol (e.g., HTTP, Skype, p2p, KV protocol in your project)
- Send segments to another process running on same or different node
- Send packets to another node possibly located in a different network
- Send frames to other node directly connected to same physical network
- Send bits to other node directly connected to same physical network
|
{"Source-Url": "http://inst.eecs.berkeley.edu/~cs162/sp14/Lectures/lec17-reliability-TCPx4.pdf", "len_cl100k_base": 4641, "olmocr-version": "0.1.53", "pdf-total-pages": 19, "total-fallback-pages": 0, "total-input-tokens": 70680, "total-output-tokens": 5890, "length": "2e12", "weborganizer": {"__label__adult": 0.0003888607025146485, "__label__art_design": 0.0003616809844970703, "__label__crime_law": 0.0005183219909667969, "__label__education_jobs": 0.007320404052734375, "__label__entertainment": 0.0002639293670654297, "__label__fashion_beauty": 0.00018930435180664065, "__label__finance_business": 0.0004191398620605469, "__label__food_dining": 0.00047516822814941406, "__label__games": 0.001155853271484375, "__label__hardware": 0.0066070556640625, "__label__health": 0.0006117820739746094, "__label__history": 0.0007534027099609375, "__label__home_hobbies": 0.0001424551010131836, "__label__industrial": 0.0007925033569335938, "__label__literature": 0.0006818771362304688, "__label__politics": 0.0002918243408203125, "__label__religion": 0.0005059242248535156, "__label__science_tech": 0.396728515625, "__label__social_life": 0.0003261566162109375, "__label__software": 0.10308837890625, "__label__software_dev": 0.4765625, "__label__sports_fitness": 0.0004758834838867187, "__label__transportation": 0.0011548995971679688, "__label__travel": 0.0003230571746826172}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 16945, 0.06659]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 16945, 0.53069]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 16945, 0.8215]], "google_gemma-3-12b-it_contains_pii": [[0, 713, false], [713, 2196, null], [2196, 3017, null], [3017, 3975, null], [3975, 5029, null], [5029, 6300, null], [6300, 7206, null], [7206, 7764, null], [7764, 9144, null], [9144, 9990, null], [9990, 11091, null], [11091, 12134, null], [12134, 12954, null], [12954, 13264, null], [13264, 14052, null], [14052, 14595, null], [14595, 15052, null], [15052, 15685, null], [15685, 16945, null]], "google_gemma-3-12b-it_is_public_document": [[0, 713, true], [713, 2196, null], [2196, 3017, null], [3017, 3975, null], [3975, 5029, null], [5029, 6300, null], [6300, 7206, null], [7206, 7764, null], [7764, 9144, null], [9144, 9990, null], [9990, 11091, null], [11091, 12134, null], [12134, 12954, null], [12954, 13264, null], [13264, 14052, null], [14052, 14595, null], [14595, 15052, null], [15052, 15685, null], [15685, 16945, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 16945, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 16945, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 16945, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 16945, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 16945, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 16945, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 16945, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 16945, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, true], [5000, 16945, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 16945, null]], "pdf_page_numbers": [[0, 713, 1], [713, 2196, 2], [2196, 3017, 3], [3017, 3975, 4], [3975, 5029, 5], [5029, 6300, 6], [6300, 7206, 7], [7206, 7764, 8], [7764, 9144, 9], [9144, 9990, 10], [9990, 11091, 11], [11091, 12134, 12], [12134, 12954, 13], [12954, 13264, 14], [13264, 14052, 15], [14052, 14595, 16], [14595, 15052, 17], [15052, 15685, 18], [15685, 16945, 19]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 16945, 0.00454]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
5bfb6dcaa5519ce8e838681b663a78ddfae95b10
|
[REMOVED]
|
{"len_cl100k_base": 4457, "olmocr-version": "0.1.53", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 22805, "total-output-tokens": 6069, "length": "2e12", "weborganizer": {"__label__adult": 0.0007624626159667969, "__label__art_design": 0.0011568069458007812, "__label__crime_law": 0.0008611679077148438, "__label__education_jobs": 0.004673004150390625, "__label__entertainment": 0.0005855560302734375, "__label__fashion_beauty": 0.0005540847778320312, "__label__finance_business": 0.0006718635559082031, "__label__food_dining": 0.0007271766662597656, "__label__games": 0.0017852783203125, "__label__hardware": 0.0011262893676757812, "__label__health": 0.001689910888671875, "__label__history": 0.0008263587951660156, "__label__home_hobbies": 0.0001881122589111328, "__label__industrial": 0.0006442070007324219, "__label__literature": 0.010040283203125, "__label__politics": 0.0007061958312988281, "__label__religion": 0.001049041748046875, "__label__science_tech": 0.421630859375, "__label__social_life": 0.0004177093505859375, "__label__software": 0.035919189453125, "__label__software_dev": 0.5126953125, "__label__sports_fitness": 0.00039076805114746094, "__label__transportation": 0.0007958412170410156, "__label__travel": 0.0003116130828857422}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22863, 0.03445]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22863, 0.28913]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22863, 0.84755]], "google_gemma-3-12b-it_contains_pii": [[0, 3528, false], [3528, 6098, null], [6098, 10760, null], [10760, 14958, null], [14958, 17813, null], [17813, 21357, null], [21357, 22863, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3528, true], [3528, 6098, null], [6098, 10760, null], [10760, 14958, null], [14958, 17813, null], [17813, 21357, null], [21357, 22863, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 22863, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22863, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22863, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22863, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 22863, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22863, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22863, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22863, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22863, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22863, null]], "pdf_page_numbers": [[0, 3528, 1], [3528, 6098, 2], [6098, 10760, 3], [10760, 14958, 4], [14958, 17813, 5], [17813, 21357, 6], [21357, 22863, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22863, 0.12598]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
5dda9dbf8f4fcd445588ccac2e8ecf463588f449
|
This handout is intended to give you practice solving problems that are comparable in format and difficulty to those which will appear on the final examination. We do not guarantee that the number of questions in this sample exam will match the number on the real exam, nor that every kind of problem shown here will exactly match the kinds of problems shown on the final exam (though the real exam will be generally similar overall).
The midterm exam is on your computer but closed-textbook and closed-notes. A “syntax reference sheet” will be provided during the exam (it is omitted here, but available on the course website). It will cover all material presented up to the midterm date itself. Please see the course website for a complete list of midterm exam details and logistics.
General instructions
Answer each of the questions included in the exam. If a problem asks you to write a method, you should write only that method, not a complete program. Type all of your answers directly on the answer page provided for that specific problem, including any work that you wish to be considered for partial credit.
Each question is marked with the number of points assigned to that problem. The total number of points is 180. We intend for the number of points to be roughly comparable to the number of minutes you should spend on that problem.
Unless otherwise indicated as part of the instructions for a specific problem, your code will not be graded on style – only on functionality. On the other hand, good style (comments, etc.) may help you to get partial credit if they help us determine what you were trying to do.
You have 3 hours to complete this exam. We recommend looking over all problems before starting. Remember that you do not have to complete problems in order.
**The Adventures of Karel, Space Explorer**
* Karel the Robot is not actually on the final exam. DO NOT write any Karel code on this exam!
**TABLE OF CONTENTS**
<table>
<thead>
<tr>
<th>Chapter</th>
<th>Points</th>
</tr>
</thead>
<tbody>
<tr>
<td>Chapter 1: Designing a spaceship</td>
<td>35</td>
</tr>
<tr>
<td>Chapter 2: Alien Communications</td>
<td>25</td>
</tr>
<tr>
<td>Chapter 3: Decoding Messages</td>
<td>25</td>
</tr>
<tr>
<td>Chapter 4: Analyzing Alien DNA</td>
<td>25</td>
</tr>
<tr>
<td>Chapter 5: Space Rocks!</td>
<td>25</td>
</tr>
<tr>
<td>Chapter 6: Images of Outer Space</td>
<td>45</td>
</tr>
<tr>
<td><strong>TOTAL:</strong></td>
<td><strong>180</strong></td>
</tr>
</tbody>
</table>
Chapter 1: Designing a spaceship [35 points]
In order for Karel to embark on its journey across the universe, it needs to design and create a spaceship! Help Karel by implementing the following class and method as described below.
Part 1 [25 points]
Write a class called Spaceship that models some characteristics of a Spaceship. Specifically, a Spaceship keeps track of the amount of food on board (in pounds), a list of names of visited planets (in order of visit), and the name of each crew member on board, as well as how much food (in pounds) each crew member consumes each day. Note that you should store the crew members and their food consumption in a HashMap; not doing so will result in a substantial deduction.
You create a Spaceship by specifying the amount of food initially on board, like so:
```java
Spaceship myShip = new Spaceship(50); // 50 pounds of food initially
```
A Spaceship should have the following public methods:
```java
/** Boards a crew member with the given food intake. This crew member will now consume food during trips. */
public void board(String crewMemberName, int foodPerDay);
/** Unboards a crew member with the given name from the ship. This crew member is no longer on the ship and no longer consumes food. */
public void unboard(String crewMemberName);
/** Returns a String of visited planets, in order of visit. The string should be formatted like “[Earth, Mars, Venus]” */
public String getPlanetsVisited();
/** Attempts to fly to a planet, which takes the given number of days. */
public boolean flyTo(String planetName, int daysRequired);
```
The most involved public method is flyTo. This method should do the following:
- It should first calculate if there is enough food on board to feed all crew members for the number of days required to get to this planet.
- If there is enough food, it should update the amount of food onboard to reflect that the ship has traveled to this planet, and it should add this planet to its list of visited planets. The method should also return true to indicate the trip was successful.
- If there is not enough food, then the method should return false to indicate the trip failed. It should not modify either the onboard food or the list of visited planets.
As an example, let's say on myShip we have onboard Nolan, who consumes 3 pounds of food daily, and Nick, who consumes 4 pounds of food daily. myShip.flyTo("Venus", 7) should return true because Nick and Nolan consume 7 pounds of food per day in total, which over 7 days is 7*7=49 pounds of food (and our ship has 50). We should therefore add “Venus” to our list of visited planets, and set the food onboard to now be 50-49=1.
On the other hand, myShip.flyTo("Mars", 10) should return false because we require 7*10=70 pounds of food to get to Mars, but our ship only has 50. We should not add “Mars” to our list of visited planets, nor change our onboard food.
**Part 2 [10 points]**
Now that we have designed a Spaceship, it’s time to put it to use! Write a method called `visitablePlanets` that returns a list of planet names that we could visit given a certain amount of food. Specifically, the method accepts three parameters: the amount of food our spaceship starts with (`int`), a map of names of crewmembers to the amount of food they each consume daily, and a map from planet names we want to visit to the number of travel days required to visit that planet.
You should first create a new `Spaceship` with the given amount of food. Then, you should use the public methods of `Spaceship` to board all crew members and attempt to travel to the planets in the provided planet map. When iterating over the planet map’s keys, you should assume that the keys (planet names) are in the order in which you want to travel to the planets. You should return the list of planets that the `Spaceship` can travel to given the amount of food it starts with.
For example, if the parameters had the values
```plaintext
startingFood = 50,
crewMap = {Rishi=2, Guy=2, Aleksander=3},
planetMap = {Venus=2, Mars=3, Saturn=10}
```
then `visitablePlanets` should return “[Venus, Mars]” because we have enough food to get to Venus (7*2 = 14 pounds required) and then Mars (another 7*3 = 21 pounds required) but not Saturn after that (we have only 50-14-21=15 pounds remaining, but need 7*10=70).
Chapter 2: alien communications [25 points]
After embarking on its space journey, Karel suddenly receives some cryptic communication from alien lifeforms. It seems, not having taken CS 106A, these aliens have sent Karel poorly-written Java code and a series of questions about Java! Karel immediately enlists your help to decipher and answer the questions in each of the parts below.
Part 1 [5 points each, 15 points total]
Write the output produced when the following method is passed each of the inputs listed below. It does not matter what order the key/value pairs appear in your answer, so long as you have the right overall set of key/value pairs. You may assume when you iterate over the map, it is iterated over in the same order the key/value pairs are listed below.
```java
private void collectionMystery(HashMap<String, String> map, ArrayList<String> list) {
HashMap<String, String> map2 = new HashMap<>();
for (String key : map.keySet()) {
boolean b = false;
for (String str : list) {
if (map.get(key).equals(str)) {
b = true;
}
}
if (b) {
map2.put(map.get(key), key);
}
}
println(map2);
}
```
a) map = {cow=moo, pig=oink, dog=bark, alien=boop},
list = [moo, woof, meow, boop]
b) map = {dog=daisy, woof=daisy, karel=robot, space=robot},
list = [daisy, robot, explorer]
c) map = {cat=meow, sheep=ba, lamb=ba, kitten=meow},
list = [meow]
Part 2 [5 points each, 10 points total]
Write your answers to the questions below in your answer booklet – DO NOT WRITE HERE!
1) Give an example of where inheritance is useful in programming, and explain why it is useful in this example.
2) Explain why, when we pass primitives as parameters to a method and change them in that method, the changes do not persist outside of that method, but when we pass objects as parameters and change their properties, the changes **do** persist outside of that method.
Chapter 3: decoding messages [25 points]
The aliens now decide to send Karel messages as arrays of 0s and 1s (ints), which Karel has to decode into its original text form. Help Karel by implementing the following methods below. You may assume that the message digits are either 0 or 1.
Constraints: for this problem, you may not create any new data structures (maps, lists, arrays).
Part 1 [15 points]
The sent messages sometimes get corrupted when transmitted through space. Write a method named correctMessage that takes an int array of any length as a parameter representing a message, and flips its digits as needed to correct it (this method does not return anything).
To correct a message, you must ensure that there are no sequences of more than three of the same digit in a row. For instance, [1, 1, 0] is a valid message, but [0, 1, 1, 1, 1] is corrupted because there are four 1s in a row. You should go through the message from left to right and, whenever you see a sequence of more than three of the same digit in a row, flip the fourth digit (e.g. 0 -> 1 or 1 -> 0) to make it so that there are only three in a row.
For example, for the message [0, 1, 1, 1, 1, 0], you should flip the 5th digit from a 1 to a 0, and the corrected message would be [0, 1, 1, 0, 0, 0]. Similarly, if you receive the message [1, 1, 1, 1, 1], you should flip only the 4th digit (not the 5th) from a 1 to a 0, and the corrected message would be [1, 1, 1, 0, 1].
You should go from left to right, and if a flipped digit causes another sequence of more than three of the same digit, you should correct that too. For instance, for the message [1, 1, 1, 1, 0, 0, 1, 0, 1], working from left to right we should first flip the 4th digit from a 1 to a 0 to get [1, 1, 1, 0, 0, 1, 0, 1]. Then, we get to the 7th digit and see that this causes four 0s in a row, so we flip it from a 0 to a 1 to get [1, 1, 1, 0, 0, 1, 1, 1]. We get to the end without finding additional sequences of more than three of the same digit, so we are done.
Part 2 [10 points]
Now write a method named decodeMessage that decodes a corrected message into text. The method accepts three parameters: the int array of any length representing a corrected message, an int digitsPerChar representing the number of digits that correspond to a single character, and a map from String to Character mapping digit sequences to characters.
To decode a message, break the message into digitsPerChar-size chunks and convert each chunk to a character. To do this, look up each chunk (in String form; e.g. 0, 1, 0, 1 is “0101”) in the given map which maps digit sequences to single characters. You may assume that every sequence of digits is in the map, and that the number of digits is divisible by digitsPerChar. Your method should return the fully-decoded message as a string.
For example, for the message [0, 1, 1, 1], digitsPerChar=2, and the map {01=a, 11=b}, the first chunk of 2, the string “01”, corresponds to ‘a’ in the map. The second chunk of 2, the string “11”, corresponds to ‘b’ in the map. Our method would therefore return the string “ab”.
Chapter 4: analyzing alien DNA [25 points]
After decoding the alien messages, Karel managed to successfully navigate to the aliens’ home planet. Of course, being an avid scientist, Karel wasted no time taking an alien DNA sample to analyze. Alien DNA, which is made up of “bases” (the letters B, O, R, K), can easily be represented as a String. For instance, the string “KRBOORBOKRB” is a valid string of alien DNA. A k-mer is a k-length substring of bases in that DNA. For instance, here are all the 3-mers in this sequence:
“KRBOORBOKRB”
-------------
KRB
RBO
BOO
OOR
ORB
RBO
BOK
OKR
KRB
Conversely, in this example, “BBB” is not a 3-mer because it is not a substring of this DNA sequence. An example of a 4-mer in this string is “BOKR”.
Write a method named mostFrequentKmer that returns the k-mer found most often in a given strand of alien DNA. The method accepts two parameters: the DNA string, and the value of k (an int). As an example, if we are given the DNA string “BOBOK” and k=2, then the 2-mer found most often is the string “BO” because it appears twice, while other 2-mers (“OB”, “OK”) appear only once. If there is a tie for the k-mer found most often, you may return any one of the most frequent k-mers.
Constraints: you may create no more than 1 additional data structure (map, list, array).
Chapter 5: space rocks! [25 points]
While on this alien planet, Karel figures it’s also good to collect samples of space rocks. Help Karel by writing a complete graphical program named SpaceRocks to help organize and discard space rock samples. When writing this program, you should make use of the following provided constants (you do not need to define these in your answer):
private static final int NUM_ROCKS = 8; // number of space rocks to display
private static final int ROCK_DIAMETER = 80; // width/height of a space rock
private static final int ROCK_SPACING = 20; // pixels between each space rock
When you start the program, the canvas should display the space rocks as GOvals with random colors (note that these colors are displayed in grayscale here). The rocks should be positioned starting at the left of the canvas - (0, 0). You do not need to worry about setting the canvas size.
If the user clicks on one space rock, followed by another space rock, those two space rocks should swap positions in the row of rocks. For instance, if the user clicks on the first (darkest) rock, followed by the last (lightest) rock, they would swap and the display would look like so:
If the user clicks on one space rock, and again on the same space rock, that rock should be removed, and all rocks to its right should shift to the left so that the rocks are still correctly padded. For instance, if the user clicks twice on the 4th rock from the left (dark), you should remove that rock and shift to the left the three rocks to its right to fill the empty space, like so:
You may assume that the user will only click on the rocks (and not any blank spaces).
Hint: to make the program simpler, we recommend writing a method like repositionRocks that updates the position of all rocks still present.
Constraints: you may create no more than 1 additional data structure (map, list, array). You also may not change the color of any rocks after they are initialized to a random color.
Chapter 6: Images of outer space [45 points]
Along its journey through the universe, Karel has captured pictures of various artifacts. One common image algorithm to extract information about these images is called edge detection. Edge detection makes an image of the same size as an original, where pixels along edges within the image are colored white, and all others are colored black. For instance, running the edge detection algorithm on the image on the left would produce the image on the right:
<table>
<thead>
<tr>
<th>Source image</th>
<th>Edge Detection output image</th>
</tr>
</thead>
<tbody>
<tr>
<td><img src="image1.png" alt="Source image" /></td>
<td><img src="image2.png" alt="Edge Detection output image" /></td>
</tr>
</tbody>
</table>
Part 1 [30 points]
Write a method named `detectEdges` that takes as a parameter a source GImage (sized at least 1x1 pixels) and returns a new GImage of the same size that displays the edges within that image.
The general idea behind the edge detection algorithm is that we consider a pixel part of an “edge” if it differs significantly from its neighbors. The way we calculate this is similar to how you implemented `blur` for the ImageShop assignment. For a given pixel $(r, c)$ located at row $r$ and column $c$ in the source image, we calculate the average luminosity (rounded down to the nearest integer) of the pixels at locations $(r-1, c-1)$ through $(r+1, c+1)$, not including $(r, c)$. For example, in the diagram below, for the pixel (row 1, column 2), you would calculate the average luminosity of the eight pixels $(0, 1), (0, 2), (0, 3), (1, 1), (1, 3), (2, 1), (2, 2), \text{and} (2, 3)$.
<table>
<thead>
<tr>
<th></th>
<th>0</th>
<th>1</th>
<th>2</th>
<th>3</th>
<th>4</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>(14, 97, 63)</td>
<td>(84, 22, 99)</td>
<td>(74, 38, 69)</td>
<td>(16, 17, 18)</td>
<td>(85, 75, 75)</td>
</tr>
<tr>
<td>1</td>
<td>(21, 18, 45)</td>
<td>(66, 53, 88)</td>
<td><strong>(32, 67, 12)</strong></td>
<td>(95, 65, 35)</td>
<td>(6, 0, 2)</td>
</tr>
<tr>
<td>2</td>
<td>(37, 29, 61)</td>
<td>(28, 49, 31)</td>
<td>(47, 21, 94)</td>
<td>(31, 41, 51)</td>
<td>(246, 84, 13)</td>
</tr>
<tr>
<td>3</td>
<td>(82, 33, 90)</td>
<td>(42, 43, 44)</td>
<td>(15, 80, 50)</td>
<td>(60, 40, 12)</td>
<td>(188, 45, 1)</td>
</tr>
</tbody>
</table>
Note that if a pixel is near the sides of the image, it may have fewer neighbors. Once you have the average neighbor luminosity, you subtract it from that pixel’s own luminosity, and take the absolute value to ensure the difference is positive. This code would look something like:
```java
int luminosityDifference = Math.abs(ownLuminosity - neighborAvgLuminosity);
```
If this difference is greater than the provided constant `THRESHOLD` (you do not have to define this constant), then this pixel should be white $(r=255, g=255, b=255)$ in the new image. Otherwise, it should be black $(r=0, g=0, b=0)$. You may assume the method `computeLuminosity(int r, int g, int b)`, which returns the luminosity for the given RGB values, has been written for you (you do not have to write it).
**Constraints:** You may not create any new data structures except for at most one 2D array. (Asking for the pixel array of an existing image does not count; writing ‘new’ is what counts.)
Part 2 [15 points]
Write a complete graphical program named **EdgeDetector** that implements a graphical user interface for loading and displaying an image, and running edge detection on that image. When you start the program, the user interface has a blank central canvas and a bottom region with the following graphical components: a label displaying the text “Filename: ”, a text field of width 16 for the user to input a filename, a “Load Image” button, and a “Detect Edges” button.
When the user enters a filename (e.g. “res/saturn.jpg”) and clicks the “Load Image” button or presses ENTER in the text field, that image should be added to the canvas with its upper-left corner at (0, 0). When the user clicks the “Detect Edges” button, you should call `detectEdges` on the loaded-in image and display the output immediately to the right of the original image.
You may assume that the entered filename is valid, and do not have to worry about edge cases such as the user clicking “Load Image” multiple times, “Detect Image” multiple times, or the user clicking “Detect Image” without first loading an image. You also do not need to worry about setting the canvas size.
|
{"Source-Url": "https://web.stanford.edu/class/archive/cs/cs106a/cs106a.1188/resources/final/PracticeFinal.pdf", "len_cl100k_base": 5096, "olmocr-version": "0.1.49", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 26290, "total-output-tokens": 5468, "length": "2e12", "weborganizer": {"__label__adult": 0.0009484291076660156, "__label__art_design": 0.0007004737854003906, "__label__crime_law": 0.0006585121154785156, "__label__education_jobs": 0.035186767578125, "__label__entertainment": 0.00023365020751953125, "__label__fashion_beauty": 0.0004534721374511719, "__label__finance_business": 0.0003094673156738281, "__label__food_dining": 0.0015859603881835938, "__label__games": 0.0035533905029296875, "__label__hardware": 0.0017518997192382812, "__label__health": 0.0006909370422363281, "__label__history": 0.000759124755859375, "__label__home_hobbies": 0.0003104209899902344, "__label__industrial": 0.0008039474487304688, "__label__literature": 0.00113677978515625, "__label__politics": 0.0005025863647460938, "__label__religion": 0.0011529922485351562, "__label__science_tech": 0.01197052001953125, "__label__social_life": 0.0003972053527832031, "__label__software": 0.004756927490234375, "__label__software_dev": 0.92919921875, "__label__sports_fitness": 0.0009593963623046876, "__label__transportation": 0.0014476776123046875, "__label__travel": 0.0005764961242675781}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 19243, 0.03283]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 19243, 0.7512]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 19243, 0.88916]], "google_gemma-3-12b-it_contains_pii": [[0, 1787, false], [1787, 2355, null], [2355, 5272, null], [5272, 6695, null], [6695, 8677, null], [8677, 11785, null], [11785, 13103, null], [13103, 15101, null], [15101, 18068, null], [18068, 19243, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1787, true], [1787, 2355, null], [2355, 5272, null], [5272, 6695, null], [6695, 8677, null], [8677, 11785, null], [11785, 13103, null], [13103, 15101, null], [15101, 18068, null], [18068, 19243, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 19243, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 19243, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 19243, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 19243, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 19243, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 19243, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 19243, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 19243, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, true], [5000, 19243, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 19243, null]], "pdf_page_numbers": [[0, 1787, 1], [1787, 2355, 2], [2355, 5272, 3], [5272, 6695, 4], [6695, 8677, 5], [8677, 11785, 6], [11785, 13103, 7], [13103, 15101, 8], [15101, 18068, 9], [18068, 19243, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 19243, 0.12162]]}
|
olmocr_science_pdfs
|
2024-11-27
|
2024-11-27
|
7591b8a9548154bf1a000315c7b33a52ce8d37e5
|
Abstract
The purpose of this document is to provide an overview of Source-Specific Multicast (SSM) and issues related to its deployment. It discusses how the SSM service model addresses the challenges faced in inter-domain multicast deployment, changes needed to routing protocols and applications to deploy SSM and interoperability issues with current multicast service models.
1. Introduction
This document provides an overview of the Source-Specific Multicast (SSM) service and its deployment using the PIM-SM and IGMP/MLD protocols. The network layer service provided by SSM is a "channel", identified by an SSM destination IP address (G) and a source IP address S. An IPv4 address range has been reserved by IANA for use by the SSM service. An SSM destination address range already exists for IPv6. A source S transmits IP datagrams to an SSM destination address G. A receiver can receive these datagrams by subscribing to the channel (Source, Group) or (S,G). Channel subscription is supported by version 3 of the IGMP protocol for IPv4 and version 2 of the MLD protocol for IPv6. The interdomain tree for forwarding IP multicast datagrams is rooted at the source S, and is constructed using the PIM Sparse Mode [9] protocol.
This document is not intended to be a standard for Source-Specific Multicast (SSM). Instead, its goal is to serve as an introduction to SSM and its benefits for anyone interested in deploying SSM services. It provides an overview of SSM and how it solves a number of problems faced in the deployment of inter-domain multicast. It outlines changes to protocols and applications both at end-hosts and routers
for supporting SSM, with pointers to more detailed documents where appropriate. Issues of interoperability with the multicast service model defined by RFC 1112 are also discussed.
This memo is a product of the Source-Specific Multicast (SSM) Working Group of the Internet Engineering Task Force.
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as defined in BCP 14, RFC 2119 [28].
2. Terminology
This section defines some terms that are used in the rest of this document:
Any-Source Multicast (ASM): This is the IP multicast service model defined in RFC 1112 [25]. An IP datagram is transmitted to a "host group", a set of zero or more end-hosts (or routers) identified by a single IP destination address (224.0.0.0 through 239.255.255.255 for IPv4). End-hosts may join and leave the group any time, and there is no restriction on their location or number. Moreover, this model supports multicast groups with arbitrarily many senders - any end-host (or router) may transmit to a host group, even if it is not a member of that group.
Source-Specific Multicast (SSM): This is the multicast service model defined in [5]. An IP datagram is transmitted by a source S to an SSM destination address G, and receivers can receive this datagram by subscribing to channel (S,G). SSM provides host applications with a "channel" abstraction, in which each channel has exactly one source and any number of receivers. SSM is derived from earlier work in EXPRESS [1]. The address range 232/8 has been assigned by IANA for SSM service in IPv4. For IPv6, the range FF3x::/96 is defined for SSM services [21].
Source-Filtered Multicast (SFM): This is a variant of the ASM service model, and uses the same address range as ASM (224.0.0.0-239.255.255.255). It extends the ASM service model as follows. Each "upper layer protocol module" can now request data sent to a host group G by only a specific set of sources, or can request data sent to host group G from all BUT a specific set of sources. Support for source filtering is provided by version 3 of the Internet Group Management Protocol (or IGMPv3) [3] for IPv4, and version 2 of the Multicast Listener Discovery (or MLDv2) [22] protocol for IPv6. We shall henceforth refer to these two protocols as "SFM-capable". Earlier versions of these protocols - IGMPv1/IGMPv2 and MLDv1 - do not provide support for
source-filtering, and are referred to as "non-SFM-capable". Note that while SFM is a different model than ASM from a receiver standpoint, there is no distinction between the two for a sender.
For the purpose of this document, we treat the scoped multicast model of [12] to be a variant of ASM since it does not explicitly restrict the number of sources, but only requires that they be located within the scope zone of the group.
3. The IGMP/PIM-SM/MSDP/MBGP Protocol Suite for ASM
As of this writing, all multicast-capable networks support the ASM service model. One of the most common multicast protocol suites for supporting ASM consists of IGMP version 2 [2], PIM-SM [8,9], MSDP [13] and MBGP [26]. IGMPv2 is the most commonly used protocol for hosts to specify membership in a multicast group, and nearly all multicast routers support (at least) IGMPv2. In case of IPv6, MLDv1 [21] is the commonly used protocol.
Although a number of protocols such as PIM-DM [10], CBT [24,11], DVMRP [6], etc. exist for building multicast tree among all receivers and sources in the same administrative domain, PIM-SM [8,9] is the most widely used protocol. PIM-SM builds a spanning multicast tree rooted at a core rendezvous point or RP for all group members within a single administrative domain. A 'first-hop' router adjacent to a multicast source sends the source’s traffic to the RP for its domain. The RP forwards the data down the shared spanning tree to all interested receivers within the domain. PIM-SM also allows receivers to switch to a source-based shortest path tree.
As of this writing, multicast end-hosts with SFM capabilities are not widely available. Hence a client can only specify interest in an entire host group and receives data sent from any source to this group.
Inter-domain multicast service (i.e., where sources and receivers are located in different domains) requires additional protocols - MSDP [13] and MBGP [26] are the most commonly used ones. An RP uses the MSDP protocol to announce multicast sources to RPs in other domains. When an RP discovers a source in a different domain transmitting data to a multicast group for which there are interested receivers in its own domain, it joins the shortest-path source based tree rooted at that source. It then redistributes the data received to all interested receivers via the intra-domain shared tree rooted at itself.
MBGP defines extensions to the BGP protocol to support the advertisement of reachability information for multicast routes. This allows an autonomous system (AS) to support incongruent unicast and multicast routing topologies, and thus implement separate routing policies for each.
However, the last-hop routers of interested receivers may eventually switch to a shortest-path tree rooted at the source that is transmitting the data.
4. Problems with Current Architecture
There are several deployment problems associated with current multicast architecture:
A) Address Allocation:
Address allocation is one of core deployment challenges posed by the ASM service model. The current multicast architecture does not provide a deployable solution to prevent address collisions among multiple applications. The problem is much less serious for IPv6 than for IPv4 since the size of the multicast address space is much larger. A static address allocation scheme, GLOP [17] has been proposed as an interim solution for IPv4; however, GLOP addresses are allocated per registered AS, which is inadequate in cases where the number of sources exceeds the AS numbers available for mapping. RFC 3138 expands on RFC 2770 to allow routing registries to assign multicast addresses from the GLOP space corresponding to the RFC 1930 private AS space [27]. This space is referred to as the EGLOP (Extended GLOP) address space. Proposed longer-term solutions such as the Multicast Address Allocation Architecture [14] are generally perceived as being too complex (with respect to the dynamic nature of multicast address allocation) for widespread deployment.
B) Lack of Access control:
In the ASM service model, a receiver cannot specify which specific sources it would like to receive when it joins a given group. A receiver will be forwarded data sent to a host group by any source. Moreover, even when a source is allocated a multicast group address to transmit on, it has no way of enforcing that no other source will use the same address. This is true even in the case of IPv6, where address collisions are less likely due to the much larger size of the address space.
C) Inefficient handling of well-known sources:
In cases where the address of the source is well known in advance of the receiver joining the group, and when the shortest forwarding path is the preferred forwarding mode, then shared tree mechanisms are not necessary.
5. Source Specific Multicast (SSM): Benefits and Requirements
As mentioned before, the Source Specific Multicast (SSM) service model defines a "channel" identified by an (S,G) pair, where S is a source address and G is an SSM destination address. Channel subscriptions are described using an SFM-capable group management protocol such as IGMPv3 or MLDv2. Only source-based forwarding trees are needed to implement this model.
The SSM service model alleviates all of the deployment problems described earlier:
A) Address Allocation: SSM defines channels on a per-source basis, i.e., the channel (S1,G) is distinct from the channel (S2,G), where S1 and S2 are source addresses, and G is an SSM destination address. This averts the problem of global allocation of SSM destination addresses, and makes each source independently responsible for resolving address collisions for the various channels that it creates.
B) Access Control: SSM lends itself to an elegant solution to the access control problem. When a receiver subscribes to an (S,G) channel, it receives data sent only by the source S. In contrast, any host can transmit to an ASM host group. At the same time, when a sender picks a channel (S,G) to transmit on, it is automatically ensured that no other sender will be transmitting on the same channel (except in the case of malicious acts such as address spoofing). This makes it much harder to "spam" an SSM channel than an ASM multicast group.
C) Handling of well-known sources: SSM requires only source-based forwarding trees; this eliminates the need for a shared tree infrastructure. This implies that neither the RP-based shared tree infrastructure of PIM-SM nor the MSDP protocol is required. Thus the complexity of the multicast routing infrastructure for SSM is low, making it viable for immediate deployment. Note that there is no difference in how MBGP is used for ASM and SSM.
6. SSM Framework
Figure 1 illustrates the elements in an end-to-end implementation framework for SSM:
Figure 1: SSM Framework: elements in end-to-end model
We now discuss the framework elements in detail:
6.1. Address Allocation
For IPv4, the address range of 232/8 has been assigned by IANA for SSM. To ensure global SSM functionality in 232/8, including in networks where routers run non-SFM-capable protocols, operational policies are being proposed [9] which recommend that routers should not send SSM traffic to parts of the network that do not have channel subscribers.
Note that IGMPv3/MLDv2 does not limit (S,G) joins to only the 232/8 range. However, SSM service, as defined in [5], is available only in this address range for IPv4.
In case of IPv6, [23] has defined an extension to the addressing architecture to allow for unicast prefix-based multicast addresses. See RFC 3306 for details.
6.2. Session Description and Channel Discovery
An SSM receiver application must know both the SSM destination address G and the source address S before subscribing to a channel. Channel discovery is the responsibility of applications. This information can be made available in a number of ways, including via web pages, sessions announcement applications, etc. This is similar to what is used for ASM applications where a multicast session needs to be announced so that potential subscribers can know of the multicast group address, encoding schemes used, etc. In fact, the only additional piece of information that needs to be announced is the source address for the channel being advertised. However, the exact mechanisms for doing this is outside the scope of this framework document.
6.3. SSM-Aware Applications
There are two main issues in making multicast applications "SSM-aware":
- An application that wants to receive an SSM session must first discover the channel address in use.
- A receiving application must be able to specify both a source address and a destination address to the network layer protocol module on the end-host.
Specific API requirements are identified in [16]. [16] describes a recommended application programming interface for a host operating system to support the SFM service model. Although it is intended for SFM, a subset of this interface is sufficient for supporting SSM.
6.4. IGMPv3/MLDv2 Host Reporting and Querier
In order to use SSM service, an end-host must be able to specify a channel address, consisting of a source’s unicast address and an SSM destination address. IGMP version 2 [3] and MLD version 1 [19] allows an end-host to specify only a destination multicast address. The ability to specify an SSM channel address \(c\) is provided by IGMP version 3 [3] and MLD version 2 [20]. These protocols support "source filtering", i.e., the ability of an end-system to express interest in receiving data packets sent only by SPECIFIC sources, or from ALL BUT some specific sources. In fact, IGMPv3 provides a superset of the capabilities required to realize the SSM service model.
A detailed discussion of the use of IGMPv3 in the SSM destination address range is provided in [4].
The Multicast Listener Discovery (MLD) protocol used by an IPv6 router to discover the presence of multicast listeners on its directly attached links, and to discover the multicast addresses that are of interest to those neighboring nodes. MLD version 1 is derived from IGMPv2 and does not provide the source filtering capability required for the SSM service model. MLD version 2 is derived from, and provides the same support for source-filtering as, IGMPv3. Thus IGMPv3 (or MLDv2 for IPv6) provides a host with the ability to request the network for an SSM channel subscription.
6.5. PIM-SSM Routing
[9] provides guidelines for how a PIM-SM implementation should handle source-specific host reports as required by SSM. Earlier versions of the PIM protocol specifications did not describe how to do this.
The router requirements for operation in the SSM range are detailed in [5]. These rules are primarily concerned with preventing ASM-style behaviour in the SSM address range. In order to comply with [5] several changes to the PIM-SM protocol are required, as described in [9]. The most important changes in PIM-SM required for compliance with [5] are:
- When a DR receives an (S,G) join request with the address G in the SSM address range, it MUST initiate a (S,G) join, and NEVER a (*,G) join.
- Backbone routers (i.e., routers that do not have directly attached hosts) MUST NOT propagate (*,G) joins for group addresses in the SSM address range.
- Rendezvous Points (RPs) MUST NOT accept PIM Register messages or (*,G) Join messages in the SSM address range.
Note that only a small subset of the full PIM-SM protocol functionality is needed to support the SSM service model. This subset is explicitly documented in [9].
7. Interoperability with Existing Multicast Service Models
Interoperability with ASM is one of the most important issues in moving to SSM deployment, since both models are expected to be used at least in the foreseeable future. SSM is the ONLY service model for the SSM address range - the correct protocol behaviour for this range is specified in [5]. The ASM service model will be offered for the non-SSM address range, where receivers can issue (*,G) join requests to receive multicast data. A receiver is also allowed to issue an (S,G) join request in the non-SSM address range; however, in that case there is no guarantee that it will receive service according to the SSM model.
Another interoperability issue concerns the MSDP protocol, which is used between PIM-SM rendezvous points (RPs) to discover multicast sources across multiple domains. MSDP is not needed for SSM, but is needed if ASM is supported. [9] specifies operational recommendations to help ensure that MSDP does not interfere with the ability of a network to support the SSM service model. Specifically, [9] states that RPs must not accept, originate or forward MSDP SA messages for the SSM address range.
8. Security Considerations
SSM does not introduce new security considerations for IP multicast. It can help in preventing denial-of-service attacks resulting from unwanted sources transmitting data to a multicast channel (S, G). However no guarantee is provided.
9. Acknowledgments
We would like to thank Gene Bowen, Ed Kress, Bryan Lyles, Timothy Roscoe, Hugh Holbrook, Isidor Kouvelas, Tony Speakman and Nidhi Bhaskar for participating in lengthy discussions and design work on SSM, and providing feedback on this document. Thanks are also due to Mujahid Khan, Ted Seely, Tom Pusateri, Bill Fenner, Kevin Almeroth, Brian Levine, Brad Cain, Hugh LaMaster and Pekka Savola for their valuable insights and continuing support.
10. References
10.1. Informative References
10.2. Normative References
11. Contributors
Christophe Diot
Intel
EMail: christophe.diot@intel.com
Leonard Giuliano
Juniper Networks
EMail: lenny@juniper.net
Greg Shepherd
Procket Networks
EMail: shep@procket.com
Robert Rockell
Sprint
EMail: rrockell@sprint.net
David Meyer
Sprint
EMail: dmm@1-4-5.net
John Meylor
Cisco Systems
EMail: jmeylor@cisco.com
Brian Haberman
Caspian Networks
EMail: bkhabs@nc.rr.com
12. Editor’s Address
Supratik Bhattacharyya
Sprint
EMail: supratik@sprintlabs.com
13. Full Copyright Statement
Copyright (C) The Internet Society (2003). All Rights Reserved.
This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English.
The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assignees.
This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Acknowledgement
Funding for the RFC Editor function is currently provided by the Internet Society.
|
{"Source-Url": "http://mail.tools.ietf.org/pdf/rfc3569.pdf", "len_cl100k_base": 4370, "olmocr-version": "0.1.53", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 26995, "total-output-tokens": 6209, "length": "2e12", "weborganizer": {"__label__adult": 0.0003819465637207031, "__label__art_design": 0.00030422210693359375, "__label__crime_law": 0.0006999969482421875, "__label__education_jobs": 0.0009136199951171876, "__label__entertainment": 0.00035119056701660156, "__label__fashion_beauty": 0.00016379356384277344, "__label__finance_business": 0.0006113052368164062, "__label__food_dining": 0.0003936290740966797, "__label__games": 0.001430511474609375, "__label__hardware": 0.00930023193359375, "__label__health": 0.0004665851593017578, "__label__history": 0.0006375312805175781, "__label__home_hobbies": 9.936094284057616e-05, "__label__industrial": 0.0007300376892089844, "__label__literature": 0.00039839744567871094, "__label__politics": 0.0004575252532958984, "__label__religion": 0.0006103515625, "__label__science_tech": 0.350341796875, "__label__social_life": 0.00015413761138916016, "__label__software": 0.16943359375, "__label__software_dev": 0.46044921875, "__label__sports_fitness": 0.0005064010620117188, "__label__transportation": 0.0007386207580566406, "__label__travel": 0.0003414154052734375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 23091, 0.03272]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 23091, 0.31581]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 23091, 0.89092]], "google_gemma-3-12b-it_contains_pii": [[0, 1643, false], [1643, 4110, null], [4110, 6505, null], [6505, 8664, null], [8664, 10836, null], [10836, 10994, null], [10994, 12891, null], [12891, 15140, null], [15140, 17161, null], [17161, 18932, null], [18932, 20567, null], [20567, 21493, null], [21493, 21577, null], [21577, 23091, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1643, true], [1643, 4110, null], [4110, 6505, null], [6505, 8664, null], [8664, 10836, null], [10836, 10994, null], [10994, 12891, null], [12891, 15140, null], [15140, 17161, null], [17161, 18932, null], [18932, 20567, null], [20567, 21493, null], [21493, 21577, null], [21577, 23091, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 23091, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 23091, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 23091, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 23091, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 23091, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 23091, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 23091, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 23091, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 23091, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 23091, null]], "pdf_page_numbers": [[0, 1643, 1], [1643, 4110, 2], [4110, 6505, 3], [6505, 8664, 4], [8664, 10836, 5], [10836, 10994, 6], [10994, 12891, 7], [12891, 15140, 8], [15140, 17161, 9], [17161, 18932, 10], [18932, 20567, 11], [20567, 21493, 12], [21493, 21577, 13], [21577, 23091, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 23091, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
90027447fc939640142709586467ba45b67235d9
|
ESC/Java2: Uniting ESC/Java and JML
Progress and issues in building and using ESC/Java2
David R. Cok
457 Hillside Avenue
Rochester, NY 14610
USA
cok@frontiernet.net
Joseph Kiniry
Security of Systems Group
Computing Science Department
University of Nijmegen
Toernooiveld 1
6525 ED Nijmegen
The Netherlands
kiniry@cs.kun.nl
ABSTRACT
The ESC/Java tool was a lauded advance in effective static checking of realistic Java programs, but has become out-of-date with respect to Java and the Java Modeling Language (JML). The ESC/Java2 project, whose progress is described in this paper, builds on the final release of ESC/Java from DEC/SRC in several ways. It parses all of JML, thus can be used with the growing body of JML-annotated Java code; it has additional static checking capabilities; and it has been designed, constructed, and documented in such a way as to improve the tool’s usability to both users and researchers. It is intended that ESC/Java2 be used for further research in, and larger-scale case studies of, annotation and verification, and for studies in programmer productivity that may result from its integration with other tools that work with JML and Java.
Categories and Subject Descriptors
D.2.4 [Software Engineering]: Software/Program Verification—Formal methods, Programming by Contract; F.3.1 [Logics and Meanings of Programs]: Specifying and Verifying and Reasoning about Programs—assertions, invariants, logics of programs, pre- and post-conditions, specification techniques
Keywords
JML, ESC/Java, ESC/Java2, static analysis, verification, annotation languages, program specification
1. INTRODUCTION
The ESC/Java tool developed at DEC/SRC was a pioneering tool in the application of static program analysis and verification technology to annotated Java programs [10]. The tool and its built-in prover operated automatically with reasonable performance and needed only program annotations against which to check a program’s source code. The annotations needed were easily read, written and understood by those familiar with Java and were partially consistent with the syntax and semantics of the separate Java Modeling Language (JML) project [1, 15]. Consequently, the original ESC/Java (hereafter called DEC/SRC ESC/Java) was a research success and was also successfully used by other groups for a variety of case studies (e.g., [12, 13]).
Its long-term utility, however, was lessened by a number of factors. First, as companies were bought and sold and research groups disbanded, there was no continuing development or support of DEC/SRC ESC/Java, making it less useful as time went by. As a result of these marketplace changes, the tool was untouched for over two years and its source code was not available.
The problem of lack of support was further compounded because its match to JML was not complete and JML continued to evolve as research on the needs of annotations for program checking advanced. This unavoidable divergence of specification languages made writing, verifying, and maintaining specifications of non-trivial APIs troublesome (as discussed in Section 4).
Additionally, JML has grown significantly in popularity. A number of tools have been developed that use JML, representing the work of several groups [3, 1, 20, 19, 15]. Thus, many new research tools worked well with “modern” JML, but DEC/SRC ESC/Java did not.
Finally, some of the deficiencies of the annotation language used by DEC/SRC ESC/Java reduced the overall usability of the tool. For example, frame conditions were not checked, but errors in frame conditions could cause the prover to reach incorrect conclusions. Also, the annotation language lacked the ability to use methods in annotations, limiting the annotations to statements only about low-level representations.
The initial positive experience of DEC/SRC ESC/Java inspired a vision for an industrial-strength tool that would also be useful for ongoing research in annotation and verification. Thus, when the source code for DEC/SRC ESC/Java was made available, the authors of this paper began the ESC/Java2 project.
This effort has the following goals: (1) to make the source consistent with the current version of Java; (2) to fully parse the current version of JML and Java; (3) to check as much of
2. Changes to DEC/SRC ESC/Java
Creating ESC/Java2 required a number of changes to the DEC/SRC ESC/Java tool. Here we present the most significant of these.
2.1 Java 1.4
The original work was performed from 1998 to 2000, and Java has evolved since then. The addition required by Java 1.4 is support for the Java assert statement.
2.2 Current JML
The Java Modeling Language is a research project in itself; hence the JML syntax and semantics are evolving and are somewhat of a moving target (and there is as yet no complete reference manual). However, the core language is reasonably stable. The following are key additions that have been implemented; other changes that relate primarily to parsing and JML updates are listed in the Appendix:
- Inheritance of annotations and of non-null modifiers that is consistent with the behavioral inheritance of JML;
- Support for datagroups and in and maps clauses, which provides a sound framework for reasoning about the combination of frame conditions and subtyping;
- Model import statements and model fields, routines, and types, which allow abstraction and modularity in writing specifications;
- Enlarging the use and correcting the handling of scope of ghost fields, so that the syntactic behavior of annotations matches that of Java and other JML tools.
In addition, virtually all of the differences between JML and DEC/SRC ESC/Java noted in the JML Reference Manual have been resolved.
2.3 New verification checks
Though all of JML is parsed, not all of it is currently checked. Static checking of the following features has been added to that performed by DEC/SRC ESC/Java. The space available in this paper permits only a summary of the embedding of the above into the underlying ESC/Java logic.
The constraint and initially clauses. These two clauses are variations on the more common invariant clause. They apply to the whole class. A constraint states a condition that must hold between the pre-state and the post-state of every method of a class. For example,
\[\text{constraint maxSize == old(maxSize)};\]
states that maxSize is not changed by any method of the class. It is implemented by adding the predicate as a post-condition of every (non-helper) method in the type (and its derived types).
Similarly, initially states a condition that must hold of every object after construction. It is implemented by adding its predicate as a postcondition of every (non-helper) constructor of the type (but not of its derived types).
The not_modified expression. The not_modified construct is a way of saying, within a postcondition, that a particular expression has the same value in the pre-state and the post-state. That is,
\[\text{not_modified(x+y)} \equiv (x+y) == \text{old}(x+y);\]
Uses of the expression in postconditions are expanded inline according to this definition.
Checking of datagroups and frame conditions. JML contains syntax to define datagroups [16]. With datagroups, the items in an assignable clause may represent sets of program locations, and those sets may be extended by subtypes. Each (of possibly multiple) specification cases of a routine may be guarded by a precondition and may specify the set of store locations that may be assigned to.
There are a number of cases to be considered in a full implementation. We will discuss just one here: an assignment statement that has a left-hand side of expr.field. For this to be a legal assignment with respect to the specifications, either (a) the expr must evaluate to an object that has been allocated since the beginning of the execution of the method, or (b) it must be the case that for every spe-case of the method containing the assignment for which the precondition is true (in the pre-state) there is at least one store location in the list of assignable locations that
1http://www.niii.kun.nl/ita/sos/projects/escframe.html
2In fact, Java 1.5 went beta recently. No work has begun on parsing or statically checking Java 1.5 code. Interested parties are welcome to contact the authors with regard to this topic.
3Subsequent papers are planned that will describe these embeddings in more detail.
matches expr.field. To match, the field names must be the same and the expr values must evaluate to the same object. The matching is complicated by the variety of syntax (e.g. expr.* matches any field of expr) and by the fact that a given field designation may have an accompanying datagroup and the match may be to any element of the datagroup.
The most substantial complication is that datagroups may be recursively defined and thus may have unbounded size. For example, consider the datagroup of all of the ‘next’ fields of a linked list. ESC/Java2 currently deals with this by unrolling the recursion to a fixed depth; since in ESC/Java loops are also unrolled to a fixed number of iterations, this solution handles common cases of iterating over recursive structures.
Annotations containing routine calls and dynamic allocations: JML, but not DEC/SRC ESC/Java, allows pure method calls to be used in annotations. This allows both a degree of abstraction and more readable and writable specifications. ESC/Java2 supports the JML syntax and also performs some static checking. The underlying prover, Simplify, does support function definitions and reasoning with functions. But, as is the rule in first-order provers, the result of a function depends only on its arguments and not on hidden arguments or on global structures referenced by the arguments. Consequently there is a mismatch between the concept of a method in Java and the concept of a function in the prover. However, a moderate degree of checking can be performed without resorting to a full state-based translation and logic if we (a) identify some methods as functions, where possible, (b) include the current state of the heap as an additional uninterpreted parameter, and (c) incorporate the specifications of the called method as additional axioms.
Dynamic allocations of objects using constructors can be recast as method calls and treated as described above. Dynamic allocations of arrays can be translated into first-order logic as functions without difficulty.
model fields and represents clauses: The combination of model fields and represents clauses provides a substantial benefit in abstraction, especially since the representations may be provided by a subtype [8]. Simple representations can be implemented in ESC/Java2 by inlining the representation wherever the model field is used in an annotation. However, that proves not to be workable in larger systems. Instead, we translate instances of model fields as functions of the object that owns them and the global state. This allows a useful degree of reasoning when combined with the class invariants that describe the behavior of the model fields.
2.4 Backwards incompatibilities
The DEC/SRC ESC/Java specification language and JML arose separately; there was some initial but incomplete work to unify the two. The ESC/Java2 project intends to have the tool reflect JML as precisely as reasonable. In some cases, discussion about differences resulted in changes to JML. In a few cases, some backwards incompatibilities in DEC/SRC ESC/Java were introduced. The principal incompatibilities are these:
- The semantics of inheritance of specification clauses and of non-null modifiers was modified to match that defined by JML, since the work on JML resulted in an interpretation consistent with behavioral subtyping. This also changed the usage and semantics of the also keyword.
- The specification modifies everything is now the default frame axiom.
- The syntax and semantics of initially, readable if and monitored by have changed.
- ESC/Java2 forbids bodies of (non-model) routines to be present in non-Java specification files.
3. UNRESOLVED SEMANTIC ISSUES
The work on ESC/Java2 has been useful in exposing and resolving semantic issues in JML. Since ESC/Java2 is built on a different source code base than other JML tools, differences in interpretation in both syntax and semantics arise on occasion. These are generally resolved and documented via mailing list discussions by interested parties. There are, however, still unresolved issues, most of which are the subject of ongoing research.
- pure routines: It is convenient and modular to use model and Java methods within annotations. The semantics of such use is clearer and simpler if such routines are pure, that is, they do not have side-effects. This is important when evaluating annotations during execution, since the checking of specifications should not affect the operation of the program being checked. Side-effects also complicate static reasoning. However, some side-effects are always present, such as changes to the stack or heap or external effects such as the passage of time. Some are often overlooked but can be consequential, such as locking a monitor. Others the programmer may see as innocuous, benevolent side-effects, such as maintaining a private cached value or logging debugging information in an output file. An interpretation of the combination of purity and benevolent (or ignorable) side-effects that is suitable for both static and run-time checking is not convenient and intuitive for users is not yet available. (See also the discussion of purity checking in [14].)
- exceptions in pure expressions: The expressions used in annotations must not have side-effects, but they may still throw exceptions. In that case the result is ill-defined. A semantics that is suitable for both run-time checking and static verification needs to be established.
- initialization: The authors are not aware of any published work on specifying the initialization of classes and objects in the context of JML; initial work formalizing not_initialized was only recently completed for the Loop tool. This work includes providing syntax and semantics for Java initialization blocks. JML’s initializer and static_initializer keywords, and formalizing the rules about order of initialization of classes and object fields in Java.
- datagroups: The in and maps clauses and the datagroup syntax are designed to allow the specification
of frame conditions in a sound way that is extensible by derived classes. We do not yet have experience with the interaction among datagroups, the syntax for designing store locations, and either reasoning about recursive data structures or checking them at run-time.
- **unbounded arithmetic:** Chalin [7] has proposed syntax and semantics to enable specifying and utilizing unbounded arithmetic in a safe way within annotations. Tool support and experience with these concepts is in progress.
Axioms and proof procedures will be needed to support this work in static checkers.
There are other outstanding but less significant issues concerning helper annotations, model programs and the weakly, hence_by, measured_by, accessible and callable clauses.
### 4. USAGE EXPERIENCE TO DATE
The SoS group at the University of Nijmegen, along with other members of the European VerifiCard Project[^2^], has used DEC/SRC ESC/Java for several projects. For example, Hubbers, Oostdijk, and Poll have performed verifications of Smart Card applets using several tools, including DEC/SRC ESC/Java [13]. Hubbers has taken initial steps integrating several JML-based tools [12].
These and other VerifiCard projects relied upon the specifications of the Java Card 2.1.1 API written and verified by Poll, Meijer, and others [18]. This specification originally came in two forms: one “heavyweight” specification that used JML models, heavyweight contract specifications, and refinements, and another “lightweight” specification that was meant to be used with DEC/SRC ESC/Java and other verification tools like Jack, Krakatoa, and the Loop tool [2, 4, 17].
Writing, verifying, and maintaining these two specifications was a troublesome experience. Because of limitations of various tools which depended upon the specifications, several alternate forms of specifications were required. Additionally, it was sometimes the case that the alternate forms were neither equivalent nor had obvious logical relationships between them.
This experience was one of the motivators for the SoS group’s support of this work on ESC/Java2. Now that multiple tools are available that fully cover the JML language, the incidence of specification reuse is rising and painful maintenance issues are becoming a thing of the past. As a result, early evidence for the success of this transition is beginning to appear.
First, the specifications of a small case study [5] were updated and re-verified by one of this paper’s authors (Kiniry) using ESC/Java2. The original work depended upon “lightweight” JML specifications of core Java Card classes and the verification was performed with DEC/SRC ESC/Java and the Loop tool. The re-verification effort used the full “heavyweight” Java and Java Card specifications and was accomplished in a single afternoon.
Second, several members of the SoS group are contributing to updating the “heavyweight” JML specifications of the Java Card API. As a part of this work, the Gemplus Electronic Purse case study, which has been verified partially with DEC/SRC ESC/Java [6] and partially with the Loop tool [5], is being re-verified completely with ESC/Java2 using “heavyweight” specifications.
Finally, recent attempts at verifying highly complex Java code examples written by Jan Bergstra and originally used as stress-tests for the Loop tool have been encouraging. Methods that originally took a significant amount of interactive effort to verify in PVS are now automatically verified in ESC/Java2, much to the surprise of some of the Loop tool authors. This work has caused some re-evaluation of the balance between interactive and automated theorem proving in the SoS group.
### 5. ONGOING WORK
The work on ESC/Java2 is continuing on a number of fronts.
**Language Issues.** Two obvious and related ongoing tasks are the completion of additional features of JML, accompanied in some cases by additional research to clarify the semantics and usability of outstanding features of JML. Usage of JML is now broad enough that accompanying formal reference documentation would be valuable. As tools such as ESC/Java2 become more widely used, users will also appreciate attention to performance, to the clarity of errors and warnings, and to the overall user experience such tools provide.
**Case Studies.** The current implementation supports the static checking of a stable core of JML. With this initial implementation of frame condition checking, of model fields, represents clauses and use of routine calls in annotations, ESC/Java2 can now be used on complex and abstract specifications of larger bodies of software. Consequently, there is a considerable need for good experimental usage studies that confirm that this core of JML is useful in annotations, and that the operation of ESC/Java2 (and Simplify) on that core is correct and valuable.
**Verification Logic.** The logic into which Java and JML are embedded in both DEC/SRC ESC/Java and ESC/Java2 is, by design and admission of the original authors, neither complete or fully sound. This was the result of an engineering judgment in favor of performance and usability. Research studying expanded and larger use cases may show whether this design decision is generally useful in practical static checking or whether a fuller and more complicated state-based logic is required for significant results to be obtained. A related issue is the balance between automated and manual proof construction. Use of verification logics will likely be limited to narrow specialities as long as proof construction is a major component of the overall programming task. Thus, automation is essential, though it is expected that full automation is infeasible. The degree of automation achievable will continue to be a research question. However, we believe that broad adoption of automated tools for program checking will require that users only need interact at high levels of proof construction.
**User Feedback.** The purpose of using theorem provers for static analysis, runtime assertion checking, or model checking is to find errors and thereby improve the correctness of the resulting software. Thus, the orientation of a tool must be towards effectively finding and interpreting examples of incorrect behavior. A complaint (e.g., [11]) in using such
[^2^]: http://www.verificard.org/
technologies is that it is difficult to determine a root cause from the counterexample information provided by the tool, whether it is a failed proof or an invalid test or execution history. The DEC/SRC ESC/Java project implemented some work towards appropriately pruning and interpreting counterexample and trace information, but there remains room for improvement.
**Tool Integration.** Finally, though not part of this specific project, an integration of tools that support JML would be beneficial for programmer productivity. A productive programmer’s working environment for a large-scale project that uses these tools would need the them to be integrated in a way that they seamlessly communicate with one another. A programmer using the tools would naturally move among the various tasks of designing, writing, testing, annotating, verifying and debugging, all the while reading, writing and checking specifications. Design, specifications and code might all be built up incrementally. Thus, the tools would need to be integrated in a way that allows efficient and iterative behavior.
6. **ACKNOWLEDGMENTS**
The authors would like to acknowledge both the work of the team that generated DEC/SRC ESC/Java as well as Gary Leavens and collaborators at Iowa State University who generated JML. In addition, Leavens and students engaged in and helped resolve syntactic and semantic issues in JML raised by the work on ESC/Java2. These teams provided the twin foundations on which the current work is built. Other research groups that use and critique both JML and ESC/Java2 have provided a research environment in which the work described here is useful. Thanks are due also to Leavens who commented on a draft of this paper.
Joseph Kiniry is supported by the NWO Pionier research project on Program Security and Correctness and the VerifiCard research project.
7. **REFERENCES**
APPENDIX
A. PRINCIPAL CHANGES IN ESC/JAVA
Language semantics
- inheritance of annotations and of non_null modifiers that is consistent with the behavioral inheritance of JML;
- support for datagroups and in and maps clauses, which provides a sound framework for reasoning about the combination of frame conditions and subtyping;
- model import statements and model fields, routines, and types, which allow abstraction and modularity in writing specifications;
- enlarging the use and correcting the handling of scope of ghost fields, so that the syntactic behavior of annotation fields matches that of Java and other JML tools;
- Language parsing
- parsing of all of current JML, even if the constructs are ignored with respect to typechecking or verification;
- support for refinement files, which allow specifications to be supplied in files separate from the source code or in the absence of source code;
- heavyweight annotations, which allow some degree of modularity and nesting;
- auto model import of the org.jmlspecs.lang package, similar to Java’s auto import of java.lang;
- generalizing the use of void, set statements and local ghost variables, to provide more flexibility in writing specifications;
- introduction of the constraint, represents, field, method, constructor, \not_modified, instance, old, forall, pure keywords as defined in JML; and
- consistency in the format of annotations in order to match the language handled by other JML tools.
In addition, virtually all of the differences between JML and DEC/SRC ESC/Java noted in the JML Reference Manual have been resolved.
B. ASPECTS OF JML NOT YET IMPLEMENTED IN ESC/JAVA2
Though the core is well-supported, there are several features of JML which are parsed and ignored, some of them experimental or not yet endowed with a clear semantics, and some in the process of being implemented. For those interested in the details of JML and ESC/Java2, the features that are currently ignored are the following:
- checking of access modifiers on annotations and of the strictfp, volatile, transient and weakly modifiers;
- the clauses diverges, hence_by, code_contract, when, and measured_by;
- the annotations within implies that and for_example sections;
- some of the semantics associated with the initialization steps prior to construction;
- multi-threading support beyond that already provided in DEC/SRC ESC/Java;
- serialization;
- annotations regarding space and time consumption;
- full support of recursive maps declarations;
- model programs;
- equivalence of TYPE and java.lang.Class;
- some aspects of store-ref expressions;
- verification of anonymous and block-level classes;
- verification of set comprehension and some forms of quantified expressions;
- implementation of modifies every within the body of routines.
|
{"Source-Url": "https://classes.soe.ucsc.edu/cmps203/Spring06/Project/garga/ESCJAVA2/papers/PASTE2004.pdf", "len_cl100k_base": 5223, "olmocr-version": "0.1.53", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 20567, "total-output-tokens": 7291, "length": "2e12", "weborganizer": {"__label__adult": 0.0003170967102050781, "__label__art_design": 0.00020802021026611328, "__label__crime_law": 0.00028896331787109375, "__label__education_jobs": 0.00049591064453125, "__label__entertainment": 4.017353057861328e-05, "__label__fashion_beauty": 0.00012177228927612303, "__label__finance_business": 0.0001633167266845703, "__label__food_dining": 0.0002574920654296875, "__label__games": 0.0003352165222167969, "__label__hardware": 0.0005335807800292969, "__label__health": 0.0003681182861328125, "__label__history": 0.00015175342559814453, "__label__home_hobbies": 6.222724914550781e-05, "__label__industrial": 0.00026226043701171875, "__label__literature": 0.0001800060272216797, "__label__politics": 0.00019121170043945312, "__label__religion": 0.00038242340087890625, "__label__science_tech": 0.005809783935546875, "__label__social_life": 7.599592208862305e-05, "__label__software": 0.004299163818359375, "__label__software_dev": 0.98486328125, "__label__sports_fitness": 0.0002644062042236328, "__label__transportation": 0.0003483295440673828, "__label__travel": 0.00016736984252929688}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30803, 0.02212]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30803, 0.43733]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30803, 0.91324]], "google_gemma-3-12b-it_contains_pii": [[0, 4284, false], [4284, 8432, null], [8432, 14480, null], [14480, 20828, null], [20828, 26627, null], [26627, 30803, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4284, true], [4284, 8432, null], [8432, 14480, null], [14480, 20828, null], [20828, 26627, null], [26627, 30803, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30803, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30803, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30803, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30803, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30803, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30803, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30803, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30803, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30803, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30803, null]], "pdf_page_numbers": [[0, 4284, 1], [4284, 8432, 2], [8432, 14480, 3], [14480, 20828, 4], [20828, 26627, 5], [26627, 30803, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30803, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
532caa0dfb53c3579723fa13c84aabb7ff248024
|
CSE202 Greedy algorithms II
An induced subgraph of the collaboration graph (with Euler number at most 2).
$G$ is a tree on $n$ vertices.
$G$ is connected with no cycle.
$G$ is connected with $n-1$ edges.
$G$ is formed by adding a leaf to a tree of $n-1$ vertices.
There is a unique path between any two vertices.
A binary tree
An example of a complete binary tree
A k-level complete binary tree has ?? vertices.
A binary heap is a useful data structure if you have a collection of objects to which you are adding more objects and need to remove the object with the lowest value.
Insert? Delete?
inserting an item into a binary heap
(a)
\[ \begin{array}{c} 3 \\ 4 \\ 7 \\ 5 \\ 2 \end{array} \]
(b)
\[ \begin{array}{c} 3 \\ 4 \\ 7 \\ 5 \\ 6 \end{array} \]
(c)
\[ \begin{array}{c} 2 \\ 4 \\ 7 \\ 5 \\ 6 \end{array} \]
4.5 Minimum Spanning Tree
Minimum Spanning Tree
Minimum spanning tree. Given a connected graph \( G = (V, E) \) with real-valued edge weights \( c_e \), an MST is a subset of the edges \( T \subseteq E \) such that \( T \) is a spanning tree whose sum of edge weights is minimized.
\[
\begin{align*}
G &= (V, E) \\
T, \quad \Sigma_{e \in T} c_e &= 50
\end{align*}
\]
Cayley's Theorem. There are \( n^{n-2} \) spanning trees of \( K_n \).
Applications
MST is fundamental problem with diverse applications.
- Network design.
- telephone, electrical, hydraulic, TV cable, computer, road
- Approximation algorithms for NP-hard problems.
- traveling salesman problem, Steiner tree
- Indirect applications.
- max bottleneck paths
- LDPC codes for error correction
- image registration with Renyi entropy
- learning salient features for real-time face verification
- reducing data storage in sequencing amino acids in a protein
- model locality of particle interactions in turbulent fluid flows
- autoconfig protocol for Ethernet bridging to avoid cycles in a network
- Cluster analysis.
Greedy Algorithms
Kruskal’s algorithm. Start with $T = \emptyset$. Consider edges in ascending order of cost. Insert edge $e$ in $T$ unless doing so would create a cycle.
Reverse-Delete algorithm. Start with $T = E$. Consider edges in descending order of cost. Delete edge $e$ from $T$ unless doing so would disconnect $T$.
Prim’s algorithm. Start with some root node $s$ and greedily grow a tree $T$ from $s$ outward. At each step, add the cheapest edge $e$ to $T$ that has exactly one endpoint in $T$.
Remark. All three algorithms produce an MST.
Greedy Algorithms
Simplifying assumption. All edge costs $c_e$ are distinct.
Cut property. Let $S$ be any subset of nodes, and let $e$ be the min cost edge with exactly one endpoint in $S$. Then the MST contains $e$.
Cycle property. Let $C$ be any cycle, and let $f$ be the max cost edge belonging to $C$. Then the MST does not contain $f$.
$e$ is in the MST
$f$ is not in the MST
Cycles and Cuts
**Cycle.** Set of edges the form a-b, b-c, c-d, ..., y-z, z-a.
![Cycle diagram]
Cycle C = 1-2, 2-3, 3-4, 4-5, 5-6, 6-1
**Cutset.** A cut is a subset of nodes S. The corresponding cutset D is the subset of edges with exactly one endpoint in S.
![Cut diagram]
Cut S = {4, 5, 8}
Cutset D = 5-6, 5-7, 3-4, 3-5, 7-8
Cycle-Cut Intersection
**Claim.** A cycle and a cutset intersect in an even number of edges.
![Intersection diagram]
Cycle C = 1-2, 2-3, 3-4, 4-5, 5-6, 6-1
Cutset D = 3-4, 3-5, 5-6, 5-7, 7-8
Intersection = 3-4, 5-6
**Pf.** (by picture)
Greedy Algorithms
Simplifying assumption. All edge costs $c_e$ are distinct.
Cut property. Let $S$ be any subset of nodes, and let $e$ be the min cost edge with exactly one endpoint in $S$. Then the MST $T^*$ contains $e$.
Pf. (exchange argument)
- Suppose $e$ does not belong to $T^*$, and let's see what happens.
- Adding $e$ to $T^*$ creates a cycle $C$ in $T^*$.
- Edge $e$ is both in the cycle $C$ and in the cutset $D$ corresponding to $S$
$\Rightarrow$ there exists another edge, say $f$, that is in both $C$ and $D$.
- $T' = T^* \cup \{ e \} - \{ f \}$ is also a spanning tree.
- Since $c_e < c_f$, $cost(T') < cost(T^*)$.
- This is a contradiction. *
Greedy Algorithms
Simplifying assumption. All edge costs $c_e$ are distinct.
Cycle property. Let $C$ be any cycle in $G$, and let $f$ be the max cost edge belonging to $C$. Then the MST $T^*$ does not contain $f$.
Pf. (exchange argument)
- Suppose $f$ belongs to $T^*$, and let's see what happens.
- Deleting $f$ from $T^*$ creates a cut $S$ in $T^*$.
- Edge $f$ is both in the cycle $C$ and in the cutset $D$ corresponding to $S$
$\Rightarrow$ there exists another edge, say $e$, that is in both $C$ and $D$.
- $T' = T^* \cup \{ e \} - \{ f \}$ is also a spanning tree.
- Since $c_e < c_f$, $cost(T') < cost(T^*)$.
- This is a contradiction. *
Prim's Algorithm: Proof of Correctness
Prim's algorithm. [Jarník 1930, Dijkstra 1957, Prim 1959]
- Initialize $S = \text{any node}$.
- Apply cut property to $S$.
- Add min cost edge in cutset corresponding to $S$ to $T$, and add one new explored node $u$ to $S$.
Implementation: Prim's Algorithm
Implementation. Use a priority queue ala Dijkstra.
- Maintain set of explored nodes $S$.
- For each unexplored node $v$, maintain attachment cost $a[v] = \text{cost of cheapest edge } v \text{ to a node in } S$.
- $O(n^2)$ with an array; $O(m \log n)$ with a binary heap.
```python
Prim(G, c) {
foreach (v ∈ V) a[v] ← ∞
Initialize an empty priority queue $Q$
foreach (v ∈ V) insert $v$ onto $Q$
Initialize set of explored nodes $S$ ← $\emptyset$
while (Q is not empty) {
u ← delete min element from $Q$
$S$ ← $S$ ∪ {u}
foreach (edge e = (u, v) incident to u)
if ((v ∈ S) and ($c_\text{u} < a[v]$))
decrease priority $a[v]$ to $c_\text{u}$
}
}
```
Implementing Prim’s algorithm
Prim’s algorithm finds a minimum spanning tree.
Using a priority queue
Maintaining minimum
---
Prim’s algorithm
Prim’s algorithm finds a minimum spanning tree.
**Input:** $G, c$
Initially, $S = \{s\} = \{$vertices in the current tree$\}$
For $V-S \neq \emptyset$, select $u \notin S$ but adjacent to some vertex in $S$.
Compute
$$f(u) = \min_{e=(w,u), w \in S} c(e)$$
Pick $v$ so that $f(v) = \min_{u \in S} \{f(u)\}$
Set $S \leftarrow S \cup \{v\}$ and add edge $\{w,v\}$.
Endfor
Implementing Prim's algorithm
Prim's algorithm finds a minimum spanning tree.
Input: $G, c$
Initially, $S = \{s\} = \{\text{vertices in the current tree}\}$ heap
For $S' = V - S \neq \emptyset$, select $u \notin S$ but adjacent to some vertex in $S$.
Compute $f(u) = \min_{e = (w, u) \in E} c(e)$
Pick $v$ so that $f(v) = \min_{u \in S} \{f(u)\}$ by extractmin
Set $S \leftarrow S \cup \{v\}$ and add edge $\{w, v\}$.
Update $S'$ for neighbors $u$ of $v$
Endfor
$f(u) \leftarrow \min\{c(\{u, v\}), \text{old } f(u)\}$
Implementing Prim's algorithm
Prim's algorithm finds a minimum spanning tree.
Running time: at most $n$ extractmin
and at most $m$ changekey
Total: $O(m \log n)$.
Kruskal’s Algorithm: Proof of Correctness
Kruskal’s algorithm. [Kruskal, 1956]
- Consider edges in ascending order of weight.
- Case 1: If adding e to T creates a cycle, discard e according to cycle property.
- Case 2: Otherwise, insert e = (u, v) into T according to cut property where S = set of nodes in u’s connected component.


Implementation: Kruskal’s Algorithm
**Implementation.** Use the union-find data structure.
- Build set T of edges in the MST.
- Maintain set for each connected component.
- $O(m \log n)$ for sorting and $O(m \alpha(m, n))$ for union-find.
$m \leq n^3 \Rightarrow \log m = O(\log n)$ \\
essentially a constant
```java
Kruskal(G, c) {
Sort edges weights so that $c_1 \leq c_2 \leq \ldots \leq c_m$.
$T \leftarrow \emptyset$
foreach $(u \in V)$ make a set containing singleton $u$
for $i = 1$ to $m$
$(u, v) = e_i$
if $(u$ and $v$ are in different sets) {
$T \leftarrow T \cup \{e_i\}$
merge the sets containing $u$ and $v$
}
return $T$
}
```
Union-Find Implementation
**Find-Set** \( x \) - follow pointers from \( x \) up to root
**Union** \( x, y \) - make \( x \) a child of \( y \) and return \( y \)
Path Compression
**Find-Set** \( c \)
Intro to Data Structures and Algorithms ©
The function $\lg^* n$
$\lg^* n$ = the number of times we have to take the $\log_2$ of $n$ repeatedly to reach 1
- $\lg^* 2 = 1$
- $\lg^* 3 = \lg^* 4 = \lg^* 2^2 = 2$
- $\lg^* 16 = \lg^* 2^{2^2} = 3$
- $\lg^* 65536 = \lg^* 2^{2^{2^2}} = 4$
$\Rightarrow \lg^* n \leq 5$ for all practical values of $n$
---
**Theorem (Tarjan):** If $S = \text{a sequence of } O(n) \text{ Unions and Find-Sets}$
The worst-case time for $S$ with
- Weighted Unions, and
- Path Compressions
is $O(n \lg^* n)$
$\Rightarrow$ The average time is $O(\lg^* n)$ per operation
**Ackerman's function**
Define the function $A_i(x)$ inductively by
\[
A_0(x) = x + 1 \\
A_{i+1}(x) = A_i(A_i(\ldots A_i(x))) \text{, where } A_i \text{ is applied } x + 1 \text{ times.}
\]
\[
A_1(x) = 2x + 1 \\
A_2(x) = A_1(A_1(\ldots A_1(x))) > 2^{x+1} \\
A_3(x) = A_2(A_2(\ldots A_2(x))) > 2^{2^{x+1}}
\]
The **Inverse Ackerman function is**
\[
\alpha(n) = \min\{k : A_k(1) > n\}
\]
---
**Theorem (Tarjan):** Let
$S$ = sequence of $\Omega(n)$ Unions and Find-Sets
The worst-case time for $S$ with
- Weighted Unions, and
- Path Compressions
is $O(n\alpha(n))$
$\Rightarrow$ The average time is $O(\alpha(n))$ steps per operation
Implementation: Kruskal’s Algorithm
Implementation. Use the union-find data structure.
- Build set $T$ of edges in the MST.
- Maintain set for each connected component.
- $O(m \log n)$ for sorting and $O(m \alpha(m, n))$ for union-find.
\[ m \leq n^2 \Rightarrow \log m \approx O(\log n) \text{ essentially a constant} \]
\begin{verbatim}
Kruskal(G, c) {
Sort edges weights so that $c_1 \leq c_2 \leq \ldots \leq c_m$.
$T \leftarrow \emptyset$
for each $(u \in V)$ make a set containing singleton $u$
for $i = 1$ to $m$
are $u$ and $v$ in different connected components?
$(u, v) = e_i$
if $(u$ and $v$ are in different sets) {
$T \leftarrow T \cup \{e_i\}$
merge the sets containing $u$ and $v$
}
return $T$
}
\end{verbatim}
Lexicographic Tiebreaking
To remove the assumption that all edge costs are distinct: perturb all edge costs by tiny amounts to break any ties.
Impact. Kruskal and Prim only interact with costs via pairwise comparisons. If perturbations are sufficiently small, MST with perturbed costs is MST with original costs. e.g., if all edge costs are integers, perturbing cost of edge $e$, by $i / n^2$
Implementation. Can handle arbitrarily small perturbations implicitly by breaking ties lexicographically, according to index.
\begin{verbatim}
boolean less(i, j) {
if (cost(e_i) < cost(e_j)) return true
else if (cost(e_i) > cost(e_j)) return false
else if (i < j) return true
else return false
}
\end{verbatim}
4.7 Clustering
Clustering. Given a set $U$ of $n$ objects labeled $p_1, \ldots, p_n$, classify into coherent groups.
Distance function. Numeric value specifying "closeness" of two objects.
Fundamental problem. Divide into clusters so that points in different clusters are far apart.
- Routing in mobile ad hoc networks.
- Identify patterns in gene expression.
- Document categorization for web search.
- Similarity searching in medical image databases
- Skycat: cluster $10^9$ sky objects into stars, quasars, galaxies.
Clustering of Maximum Spacing
k-clustering. Divide objects into k non-empty groups.
Distance function. Assume it satisfies several natural properties.
- \( d(p_i, p_j) = 0 \) iff \( p_i = p_j \) (identity of indiscernibles)
- \( d(p_i, p_j) \geq 0 \) (nonnegativity)
- \( d(p_i, p_j) = d(p_j, p_i) \) (symmetry)
Spacing. Min distance between any pair of points in different clusters.
Clustering of maximum spacing. Given an integer k, find a k-clustering of maximum spacing.
Greedy Clustering Algorithm
Single-link k-clustering algorithm.
- Form a graph on the vertex set U, corresponding to n clusters.
- Find the closest pair of objects such that each object is in a different cluster, and add an edge between them.
- Repeat n-k times until there are exactly k clusters.
Key observation. This procedure is precisely Kruskal’s algorithm (except we stop when there are k connected components).
Remark. Equivalent to finding an MST and deleting the k-1 most expensive edges.
Greedy Clustering Algorithm: Analysis
Theorem. Let $C^*$ denote the clustering $C^*_1, \ldots, C^*_k$ formed by deleting the $k-1$ most expensive edges of a MST. $C^*$ is a $k$-clustering of max spacing.
Pf. Let $C$ denote some other clustering $C_1, \ldots, C_k$.
- The spacing of $C^*$ is the length $d^*$ of the $(k-1)^{st}$ most expensive edge.
- Let $p_i, p_j$ be in the same cluster in $C^*$, say $C^*_{r}$, but different clusters in $C$, say $C_s$ and $C_t$.
- Some edge $(p, q)$ on $p_i-p_j$ path in $C^*$, spans two different clusters in $C$.
- All edges on $p_i-p_j$ path have length $\leq d^*$ since Kruskal chose them.
- Spacing of $C$ is $\leq d^*$ since $p$ and $q$ are in different clusters. $
Extra Slides
MST Algorithms: Theory
Deterministic comparison based algorithms.
- $O(m \log n)$
[Jarník, Prim, Dijkstra, Kruskal, Boruvka]
- $O(m \log \log n)$
[Cheriton-Tarjan 1976, Yao 1975]
- $O(m \beta(m, n))$
[Fredman-Tarjan 1987]
- $O(m \log \beta(m, n))$
[Gabow-Galil-Spencer-Tarjan 1986]
- $O(m^\alpha(m, n))$
[Chazelle 2000]
Holy grail: $O(m)$.
Notable.
- $O(m)$ randomized
[Karger-Klein-Tarjan 1995]
- $O(m)$ verification
[Dixon-Rauch-Tarjan 1992]
Euclidean.
- 2-d: $O(n \log n)$.
- k-d: $O(k n^2)$.
compute MST of edges in Delaunay
dense Prim
Dendrogram
Dendrogram. Scientific visualization of hypothetical sequence of evolutionary events.
- Leaves = genes.
- Internal nodes = hypothetical ancestors.
Dendrogram of Cancers in Human
Tumors in similar tissues cluster together.
Reference: Botstein & Brown group
- gene expressed
- gene not expressed
|
{"Source-Url": "https://mathweb.ucsd.edu/~fan/teach/202/notes/04mst2.pdf", "len_cl100k_base": 4543, "olmocr-version": "0.1.50", "pdf-total-pages": 21, "total-fallback-pages": 0, "total-input-tokens": 24365, "total-output-tokens": 5679, "length": "2e12", "weborganizer": {"__label__adult": 0.0004200935363769531, "__label__art_design": 0.0005054473876953125, "__label__crime_law": 0.0005950927734375, "__label__education_jobs": 0.0031261444091796875, "__label__entertainment": 0.00012063980102539062, "__label__fashion_beauty": 0.00022399425506591797, "__label__finance_business": 0.00030493736267089844, "__label__food_dining": 0.0006628036499023438, "__label__games": 0.0007963180541992188, "__label__hardware": 0.001911163330078125, "__label__health": 0.0013666152954101562, "__label__history": 0.0004887580871582031, "__label__home_hobbies": 0.00026607513427734375, "__label__industrial": 0.000980377197265625, "__label__literature": 0.00045180320739746094, "__label__politics": 0.00038313865661621094, "__label__religion": 0.0007619857788085938, "__label__science_tech": 0.2276611328125, "__label__social_life": 0.00019180774688720703, "__label__software": 0.00772857666015625, "__label__software_dev": 0.74951171875, "__label__sports_fitness": 0.0004603862762451172, "__label__transportation": 0.0008883476257324219, "__label__travel": 0.00026535987854003906}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 14307, 0.01871]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 14307, 0.61814]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 14307, 0.7387]], "google_gemma-3-12b-it_contains_pii": [[0, 369, false], [369, 470, null], [470, 884, null], [884, 910, null], [910, 1992, null], [1992, 2932, null], [2932, 3506, null], [3506, 4822, null], [4822, 5846, null], [5846, 6369, null], [6369, 7063, null], [7063, 8149, null], [8149, 8397, null], [8397, 8953, null], [8953, 9596, null], [9596, 11125, null], [11125, 11648, null], [11648, 12630, null], [12630, 13355, null], [13355, 14158, null], [14158, 14307, null]], "google_gemma-3-12b-it_is_public_document": [[0, 369, true], [369, 470, null], [470, 884, null], [884, 910, null], [910, 1992, null], [1992, 2932, null], [2932, 3506, null], [3506, 4822, null], [4822, 5846, null], [5846, 6369, null], [6369, 7063, null], [7063, 8149, null], [8149, 8397, null], [8397, 8953, null], [8953, 9596, null], [9596, 11125, null], [11125, 11648, null], [11648, 12630, null], [12630, 13355, null], [13355, 14158, null], [14158, 14307, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 14307, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 14307, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 14307, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 14307, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 14307, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 14307, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 14307, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 14307, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 14307, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 14307, null]], "pdf_page_numbers": [[0, 369, 1], [369, 470, 2], [470, 884, 3], [884, 910, 4], [910, 1992, 5], [1992, 2932, 6], [2932, 3506, 7], [3506, 4822, 8], [4822, 5846, 9], [5846, 6369, 10], [6369, 7063, 11], [7063, 8149, 12], [8149, 8397, 13], [8397, 8953, 14], [8953, 9596, 15], [9596, 11125, 16], [11125, 11648, 17], [11648, 12630, 18], [12630, 13355, 19], [13355, 14158, 20], [14158, 14307, 21]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 14307, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-01
|
2024-12-01
|
315af73fe37ceb6f19e95c344308400c901e3b7f
|
Writing FreeBSD Problem Reports
Abstract
This article describes how to best formulate and submit a problem report to the FreeBSD Project.
Table of Contents
1. Introduction .................................................. 1
2. When to Submit a Problem Report .................................. 1
3. Preparations .................................................. 3
4. Writing the Problem Report ........................................ 4
5. Tips and Tricks for Writing a Good Problem Report .......... 4
6. Before Beginning ............................................... 6
7. Attaching Patches or Files ....................................... 6
8. Filling out the Form ............................................. 7
9. Follow-up .................................................. 9
10. If There Are Problems .......................................... 9
11. Further Reading .............................................. 10
1. Introduction
One of the most frustrating experiences one can have as a software user is to submit a problem report only to have it summarily closed with a terse and unhelpful explanation like "not a bug" or "bogus PR". Similarly, one of the most frustrating experiences as a software developer is to be flooded with problem reports that are not really problem reports but requests for support, or that contain little or no information about what the problem is and how to reproduce it.
This document attempts to describe how to write good problem reports. What, one asks, is a good problem report? Well, to go straight to the bottom line, a good problem report is one that can be analyzed and dealt with swiftly, to the mutual satisfaction of both user and developer.
Although the primary focus of this article is on FreeBSD problem reports, most of it should apply quite well to other software projects.
Note that this article is organized thematically, not chronologically. Read the entire document before submitting a problem report, rather than treating it as a step-by-step tutorial.
2. When to Submit a Problem Report
There are many types of problems, and not all of them should engender a problem report. Of
course, nobody is perfect, and there will be times when what seems to be a bug in a program is, in fact, a misunderstanding of the syntax for a command or a typographical error in a configuration file (though that in itself may sometimes be indicative of poor documentation or poor error handling in the application). There are still many cases where submitting a problem report is clearly not the right course of action, and will only serve to frustrate both the submitter and the developers. Conversely, there are cases where it might be appropriate to submit a problem report about something else than a bug—an enhancement or a new feature, for instance.
So how does one determine what is a bug and what is not? As a simple rule of thumb, the problem is not a bug if it can be expressed as a question (usually of the form “How do I do X?” or “Where can I find Y?”). It is not always quite so black and white, but the question rule covers a large majority of cases. When looking for an answer, consider posing the question to the FreeBSD general questions mailing list.
Consider these factors when submitting PRs about ports or other software that is not part of FreeBSD itself:
- Please do not submit problem reports that simply state that a newer version of an application is available. Ports maintainers are automatically notified by portscout when a new version of an application becomes available. Actual patches to update a port to the latest version are welcome.
- For unmaintained ports (MAINTAINER is ports@FreeBSD.org), a PR without an included patch is unlikely to get picked up by a committer. To become the maintainer of an unmaintained port, submit a PR with the request (patch preferred but not required).
- In either case, following the process described in Porter’s Handbook will yield the best results. (You might also wish to read Contributing to the FreeBSD Ports Collection.)
A bug that cannot be reproduced can rarely be fixed. If the bug only occurred once and you cannot reproduce it, and it does not seem to happen to anybody else, chances are none of the developers will be able to reproduce it or figure out what is wrong. That does not mean it did not happen, but it does mean that the chances of your problem report ever leading to a bug fix are very slim. To make matters worse, often these kinds of bugs are actually caused by failing hard drives or overheating processors—you should always try to rule out these causes, whenever possible, before submitting a PR.
Next, to decide to whom you should file your problem report, you need to understand that the software that makes up FreeBSD is composed of several different elements:
- Code in the base system that is written and maintained by FreeBSD contributors, such as the kernel, the C library, and the device drivers (categorized as kern); the binary utilities (bin); the manual pages and documentation (docs); and the web pages (www). All bugs in these areas should be reported to the FreeBSD developers.
- Code in the base system that is written and maintained by others, and imported into FreeBSD and adapted. Examples include clang(1), and sendmail(8). Most bugs in these areas should be reported to the FreeBSD developers; but in some cases they may need to be reported to the original authors instead if the problems are not FreeBSD-specific.
- Individual applications that are not in the base system but are instead part of the FreeBSD Ports
Collection (category ports). Most of these applications are not written by FreeBSD developers; what FreeBSD provides is merely a framework for installing the application. Therefore, only report a problem to the FreeBSD developers when the problem is believed to be FreeBSD-specific; otherwise, report it to the authors of the software.
Then, ascertain whether the problem is timely. There are few things that will annoy a developer more than receiving a problem report about a bug she has already fixed.
If the problem is in the base system, first read the FAQ section on FreeBSD versions, if you are not already familiar with the topic. It is not possible for FreeBSD to fix problems in anything other than certain recent branches of the base system, so filing a bug report about an older version will probably only result in a developer advising you to upgrade to a supported version to see if the problem still recurs. The Security Officer team maintains the list of supported versions.
If the problem is in a port, consider filing a bug with the upstream. The FreeBSD Project can not fix all bugs in all software.
3. Preparations
A good rule to follow is to always do a background search before submitting a problem report. Maybe the problem has already been reported; maybe it is being discussed on the mailing lists, or recently was; it may even already be fixed in a newer version than what you are running. You should therefore check all the obvious places before submitting your problem report. For FreeBSD, this means:
- The FreeBSD Frequently Asked Questions (FAQ) list. The FAQ attempts to provide answers for a wide range of questions, such as those concerning hardware compatibility, user applications, and kernel configuration.
- The mailing lists. If you are not subscribed, use the searchable archives on the FreeBSD web site. If the problem has not been discussed on the lists, you might try posting a message about it and waiting a few days to see if someone can spot something that has been overlooked.
- Optionally, the entire web-use your favorite search engine to locate any references to the problem. You may even get hits from archived mailing lists or newsgroups you did not know of or had not thought to search through.
- Next, the searchable FreeBSD PR database (Bugzilla). Unless the problem is recent or obscure, there is a fair chance it has already been reported.
- Most importantly, attempt to see if existing documentation in the source base addresses your problem.
For the base FreeBSD code, you should carefully study the contents of /usr/src/UPDATING on your system or the latest version at https://cgit.freebsd.org/src/tree/UPDATING. (This is vital information if you are upgrading from one version to another, especially if you are upgrading to the FreeBSD-CURRENT branch).
However, if the problem is in something that was installed as a part of the FreeBSD Ports Collection, you should refer to /usr/ports/UPDATING (for individual ports) or /usr/ports/CHANGES (for changes that affect the entire Ports Collection).
4. Writing the Problem Report
Now that you have decided that your issue merits a problem report, and that it is a FreeBSD problem, it is time to write the actual problem report. Before we get into the mechanics of the program used to generate and submit PRs, here are some tips and tricks to help make sure that your PR will be most effective.
5. Tips and Tricks for Writing a Good Problem Report
- Do not leave the ”Summary” line empty. The PRs go both onto a mailing list that goes all over the world (where the ”Summary” is used for the Subject: line), but also into a database. Anyone who comes along later and browses the database by synopsis, and finds a PR with a blank subject line, tends just to skip over it. Remember that PRs stay in this database until they are closed by someone; an anonymous one will usually just disappear in the noise.
- Avoid using a weak ”Summary” line. You should not assume that anyone reading your PR has any context for your submission, so the more you provide, the better. For instance, what part of the system does the problem apply to? Do you only see the problem while installing, or while running? To illustrate, instead of Summary: portupgrade is broken, see how much more informative this seems: Summary: port ports-mgmt/portupgrade core dumps on -current. (In the case of ports, it is especially helpful to have both the category and portname in the ”Summary” line.)
- If you have a patch, say so. The presence of a patch makes it much easier to progress a report.
- Do not use the patch or patch-ready keywords – they are deprecated.
- If you are a maintainer, say so. If you are maintaining a part of the source code (for instance, an existing port), you definitely should set the ”Class” of your PR to maintainer-update. This way any committer that handles your PR will not have to check.
- Be specific. The more information you supply about what problem you are having, the better your chance of getting a response.
- Include the version of FreeBSD you are running (there is a place to put that, see below) and on which architecture. You should include whether you are running from a release (e.g., from a CD-ROM or download), or from a system maintained by Git (and, if so, what hash and branch you are at). If you are tracking the FreeBSD-CURRENT branch, that is the very first thing someone will ask, because fixes (especially for high-profile problems) tend to get committed very quickly, and FreeBSD-CURRENT users are expected to keep up.
- Include which global options you have specified in your make.conf, src.conf, and src-env.conf. Given the infinite number of options, not every combination may be fully supported.
- If the problem can be reproduced easily, include information that will help a developer to
reproduce it themselves. If a problem can be demonstrated with specific input then include an example of that input if possible, and include both the actual and the expected output. If this data is large or cannot be made public, then do try to create a minimal file that exhibits the same issue and that can be included within the PR.
- If this is a kernel problem, then be prepared to supply the following information. (You do not have to include these by default, which only tends to fill up the database, but you should include excerpts that you think might be relevant):
- your kernel configuration (including which hardware devices you have installed)
- whether or not you have debugging options enabled (such as WITNESS), and if so, whether the problem persists when you change the sense of that option
- the full text of any backtrace, panic or other console output, or entries in /var/log/messages, if any were generated
- the output of pciconf -l and relevant parts of your dmesg output if your problem relates to a specific piece of hardware
- the fact that you have read src/UPDATING and that your problem is not listed there (someone is guaranteed to ask)
- whether or not you can run any other kernel as a fallback (this is to rule out hardware-related issues such as failing disks and overheating CPUs, which can masquerade as kernel problems)
- If this is a ports problem, then be prepared to supply the following information. (You do not have to include these by default, which only tends to fill up the database, but you should include excerpts that you think might be relevant):
- which ports you have installed
- any environment variables that override the defaults in bsd.port.mk, such as PORTSDIR
- the fact that you have read ports/UPDATING and that your problem is not listed there (someone is guaranteed to ask)
- Avoid vague requests for features. PRs of the form "someone should really implement something that does so-and-so" are less likely to get results than very specific requests. Remember, the source is available to everyone, so if you want a feature, the best way to ensure it being included is to get to work! Also consider the fact that many things like this would make a better topic for discussion on freebsd-questions than an entry in the PR database, as discussed above.
- Make sure no one else has already submitted a similar PR. Although this has already been mentioned above, it bears repeating here. It only take a minute or two to use the web-based search engine at https://bugs.freebsd.org/bugzilla/query.cgi. (Of course, everyone is guilty of forgetting to do this now and then.)
- Report only one issue per Problem Report. Avoid including two or more problems within the same report unless they are related. When submitting patches, avoid adding multiple features or fixing multiple bugs in the same PR unless they are closely related-such PRs often take longer to resolve.
- Avoid controversial requests. If your PR addresses an area that has been controversial in the past, you should probably be prepared to not only offer patches, but also justification for why the patches are "The Right Thing To Do". As noted above, a careful search of the mailing lists
using the archives at [https://www.FreeBSD.org/search/#mailinglists](https://www.FreeBSD.org/search/#mailinglists) is always good preparation.
- Be polite. Almost anyone who would potentially work on your PR is a volunteer. No one likes to be told that they have to do something when they are already doing it for some motivation other than monetary gain. This is a good thing to keep in mind at all times on Open Source projects.
6. Before Beginning
Similar considerations apply to use of the [web-based PR submission form](https://www.FreeBSD.org/search/#mailinglists). Be careful of cut-and-paste operations that might change whitespace or other text formatting.
Finally, if the submission is lengthy, prepare the work offline so that nothing will be lost if there is a problem submitting it.
7. Attaching Patches or Files
In general, we recommend using `git format-patch` to generate one or a series of unified diff against the base branch (e.g. `origin/main`). Patches generated this way would include the Git hashes and will include your name and email address, making it easier for commiters to apply your patch and properly credit you as the author (using `git am`). For minor changes where you prefer not to use git, please be sure to use `diff(1)` with the `-u` option to create a unified diff, as this would give developers more context and are more readable than other diff formats.
For problems with the kernel or the base utilities, a patch against FreeBSD-CURRENT (the main Git branch) is preferred since all new code should be applied and tested there first. After appropriate or substantial testing has been done, the code will be merged/migrated to the FreeBSD-STABLE branch.
If you attach a patch inline, instead of as an attachment, note that the most common problem by far is the tendency of some email programs to render tabs as spaces, which will completely ruin anything intended to be part of a Makefile.
Do not send patches as attachments using `Content-Transfer-Encoding: quoted-printable`. These will perform character escaping and the entire patch will be useless.
Also note that while including small patches in a PR is generally all right—particularly when they fix the problem described in the PR-large patches and especially new code which may require substantial review before committing should be placed on a web or ftp server, and the URL should be included in the PR instead of the patch. Patches in email tend to get mangled, and the larger the patch, the harder it will be for interested parties to unmangle it. Also, posting a patch on the web allows you to modify it without having to resubmit the entire patch in a followup to the original PR. Finally, large patches simply increase the size of the database, since closed PRs are not actually deleted but instead kept and simply marked as complete.
You should also take note that unless you explicitly specify otherwise in your PR or in the patch itself, any patches you submit will be assumed to be licensed under the same terms as the original file you modified.
8. Filling out the Form
The email address you use will become public information and may become available to spammers. You should either have spam handling procedures in place, or use a temporary email account. However, please note that if you do not use a valid email account at all, we will not be able to ask you questions about your PR.
When you file a bug, you will find the following fields:
- **Summary:** Fill this out with a short and accurate description of the problem. The synopsis is used as the subject of the problem report email, and is used in problem report listings and summaries; problem reports with obscure synopses tend to get ignored.
- **Severity:** One of *Affects only me*, *Affects some people* or *Affects many people*. Do not overreact; refrain from labeling your problem *Affects many people* unless it really does. FreeBSD developers will not necessarily work on your problem faster if you inflate its importance since there are so many other people who have done exactly that.
- **Category:** Choose an appropriate category.
The first thing you need to do is to decide what part of the system your problem lies in. Remember, FreeBSD is a complete operating system, which installs both a kernel, the standard libraries, many peripheral drivers, and a large number of utilities (the "base system"). However, there are thousands of additional applications in the Ports Collection. You'll first need to decide if the problem is in the base system or something installed via the Ports Collection.
Here is a description of the major categories:
- If a problem is with the kernel, the libraries (such as standard C library libc), or a peripheral driver in the base system, in general you will use the **kern** category. (There are a few exceptions; see below). In general these are things that are described in section 2, 3, or 4 of the manual pages.
- If a problem is with a binary program such as sh(1) or mount(8), you will first need to determine whether these programs are in the base system or were added via the Ports Collection. If you are unsure, you can do **whereis programme**. FreeBSD's convention for the Ports Collection is to install everything underneath /usr/local, although this can be overridden by a system administrator. For these, you will use the **ports** category (yes, even if the port's category is www; see below). If the location is /bin, /usr/bin, /sbin, or /usr/sbin, it is part of the base system, and you should use the **bin** category. These are all things that are described in section 1 or 8 of the manual pages.
- If you believe that the error is in the startup (rc) scripts, or in some kind of other non-executable configuration file, then the right category is **conf** (configuration). These are things that are described in section 5 of the manual pages.
- If you have found a problem in the documentation set (articles, books, man pages) or website the correct choice is **docs**.
if you are having a problem with something from a port named www/someportname, this nevertheless goes in the **ports** category.
There are a few more specialized categories.
- If the problem would otherwise be filed in `kern` but has to do with the USB subsystem, the correct choice is `usb`.
- If the problem would otherwise be filed in `kern` but has to do with the threading libraries, the correct choice is `threads`.
- If the problem would otherwise be in the base system, but has to do with our adherence to standards such as POSIX®, the correct choice is `standards`.
- If you are convinced that the problem will only occur under the processor architecture you are using, select one of the architecture-specific categories: commonly `i386` for Intel-compatible machines in 32-bit mode; `amd64` for AMD machines running in 64-bit mode (this also includes Intel-compatible machines running in EMT64 mode); and less commonly `arm` or `powerpc`.
These categories are quite often misused for "I do not know" problems. Rather than guessing, please just use `misc`.
**Example 1. Correct Use of Arch-Specific Category**
You have a common PC-based machine, and think you have encountered a problem specific to a particular chipset or a particular motherboard: `i386` is the right category.
**Example 2. Incorrect Use of Arch-Specific Category**
You are having a problem with an add-in peripheral card on a commonly seen bus, or a problem with a particular type of hard disk drive: in this case, it probably applies to more than one architecture, and `kern` is the right category.
- If you really do not know where the problem lies (or the explanation does not seem to fit into the ones above), use the `misc` category. Before you do so, you may wish to ask for help on the FreeBSD general questions mailing list first. You may be advised that one of the existing categories really is a better choice.
- **Environment:** This should describe, as accurately as possible, the environment in which the problem has been observed. This includes the operating system version, the version of the specific program or file that contains the problem, and any other relevant items such as system configuration, other installed software that influences the problem, etc.—quite simply everything a developer needs to know to reconstruct the environment in which the problem occurs.
- **Description:** A complete and accurate description of the problem you are experiencing. Try to avoid speculating about the causes of the problem unless you are certain that you are on the right track, as it may mislead a developer into making incorrect assumptions about the problem. It should include the actions you need to take to reproduce the problem. If you know any workaround, include it. It not only helps other people with the same problem work around it, but may also help a developer understand the cause for the problem.
9. Follow-up
Once the problem report has been filed, you will receive a confirmation by email which will include the tracking number that was assigned to your problem report and a URL you can use to check its status. With a little luck, someone will take an interest in your problem and try to address it, or, as the case may be, explain why it is not a problem. You will be automatically notified of any change of status, and you will receive copies of any comments or patches someone may attach to your problem report's audit trail.
If someone requests additional information from you, or you remember or discover something you did not mention in the initial report, please submit a follow up. The number one reason for a bug not getting fixed is lack of communication with the originator. The easiest way is to use the comment option on the individual PR's web page, which you can reach from the PR search page.
If the problem report remains open after the problem has gone away, just add a comment saying that the problem report can be closed, and, if possible, explaining how or when the problem was fixed.
Sometimes there is a delay of a week or two where the problem report remains untouched, not assigned or commented on by anyone. This can happen when there is an increased problem report backlog or during a holiday season. When a problem report has not received attention after several weeks, it is worth finding a committer particularly interested in working on it.
There are a few ways to do so, ideally in the following order, with a few days between attempting each communication channel:
- Send an e-mail to the relevant list seeking comments on the report.
- Join the relevant IRC channels. A partial listing is here: https://wiki.freebsd.org/IRC/Channels. Inform the people in that channel about the problem report and ask for assistance. Be patient and stay in the channel after posting, so that the people from different time zones around the world have a chance to catch up.
- Find committers interested in the problem that was reported. If the problem was in a particular tool, binary, port, document, or source file, check the Git Repository. Locate the last few committers who made substantive changes to the file, and try to reach them via IRC or email. A list of committers and their emails can be found in the Contributors to FreeBSD article.
Remember that these people are volunteers, just like maintainers and users, so they might not be immediately available to assist with the problem report. Patience and consistency in the follow-ups is highly advised and appreciated. With enough care and effort dedicated to that follow-up process, finding a committer to take care of the problem report is just a matter of time.
10. If There Are Problems
If you found an issue with the bug system, file a bug! There is a category for exactly this purpose. If you are unable to do so, contact the bug wranglers at bugmeister@FreeBSD.org.
11. Further Reading
This is a list of resources relevant to the proper writing and processing of problem reports. It is by no means complete.
- **How to Report Bugs Effectively:** An excellent essay by Simon G. Tatham on composing useful (non-FreeBSD-specific) problem reports.
- **Problem Report Handling Guidelines:** Valuable insight into how problem reports are handled by the FreeBSD developers.
|
{"Source-Url": "https://download.freebsd.org/doc/en/articles/problem-reports/problem-reports_en.pdf", "len_cl100k_base": 5613, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 22522, "total-output-tokens": 6066, "length": "2e12", "weborganizer": {"__label__adult": 0.00024080276489257812, "__label__art_design": 0.00033855438232421875, "__label__crime_law": 0.0002651214599609375, "__label__education_jobs": 0.0014247894287109375, "__label__entertainment": 5.060434341430664e-05, "__label__fashion_beauty": 0.00010585784912109376, "__label__finance_business": 0.00022172927856445312, "__label__food_dining": 0.00015878677368164062, "__label__games": 0.0008373260498046875, "__label__hardware": 0.0008039474487304688, "__label__health": 0.0001386404037475586, "__label__history": 0.0001080036163330078, "__label__home_hobbies": 0.0001322031021118164, "__label__industrial": 0.00014197826385498047, "__label__literature": 0.00018775463104248047, "__label__politics": 0.00011211633682250977, "__label__religion": 0.00023794174194335935, "__label__science_tech": 0.0025272369384765625, "__label__social_life": 0.0001208782196044922, "__label__software": 0.036590576171875, "__label__software_dev": 0.955078125, "__label__sports_fitness": 0.00012600421905517578, "__label__transportation": 0.00015044212341308594, "__label__travel": 8.71419906616211e-05}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26996, 0.00852]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26996, 0.27826]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26996, 0.94156]], "google_gemma-3-12b-it_contains_pii": [[0, 2155, false], [2155, 5597, null], [5597, 8664, null], [8664, 11448, null], [11448, 14683, null], [14683, 17751, null], [17751, 20843, null], [20843, 23627, null], [23627, 26594, null], [26594, 26996, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2155, true], [2155, 5597, null], [5597, 8664, null], [8664, 11448, null], [11448, 14683, null], [14683, 17751, null], [17751, 20843, null], [20843, 23627, null], [23627, 26594, null], [26594, 26996, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 26996, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26996, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26996, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26996, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26996, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26996, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26996, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26996, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26996, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26996, null]], "pdf_page_numbers": [[0, 2155, 1], [2155, 5597, 2], [5597, 8664, 3], [8664, 11448, 4], [11448, 14683, 5], [14683, 17751, 6], [17751, 20843, 7], [20843, 23627, 8], [23627, 26594, 9], [26594, 26996, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26996, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
0dc3f4b13ddfc23814a305b30dcdce731f806258
|
Project 2: Chord Distributed Hash Table
Introduction
In this assignment, you will implement a basic CHORD distributed hash table (DHT) as described in this paper:
You can download my Linux implementation to play with:
- [Example solution for Linux](#)
- [Example solution for OS X](#)
- [Example solution for Windows](#)
Save the file as `chord-sol` and make it executable (Linux/OS X):
```bash
chmod 755 chord-sol
```
Then launch it using:
```bash
./chord-sol
```
Requirements
Your DHT must implement the services to maintain a DHT, and it must support a simple command-line user interface. Each instance (running on different machines, or on the same machine on different ports) will run an RPC server and act as an RPC client. In addition, several background tasks will run to keep the DHT data structures up-to-date.
User interface
When running, an instance of your DHT should support a simple command-line interface. It will supply a prompt, and the user can issue one of the following commands. The simplest command is:
- **help**: this displays a list of recognized commands
The main commands start with those related to joining and leaving DHT rings:
- **port <n>**: set the port that this node should listen on. By default, this should be port 3410, but users can set it to something else.
This command only works before a ring has been created or joined. After that point, trying to issue this command is an error.
- **create**: create a new ring.
This command only works before a ring has been created or joined. After that point, trying to issue this command is an error.
- **join <address>**: join an existing ring, one of whose nodes is at the address specified.
This command only works before a ring has been created or joined. After that point, trying to issue this command is an error.
- **quit**: shut down. This quits and ends the program. If this was the last instance in a ring, the ring is effectively shut down.
If this is not the last instance, it should send all of its data to its immediate successor before quitting. Other than that, it is not necessary to notify the rest of the ring when a node shuts down.
Next, there are those related to finding and inserting keys and values. A `<key>` is any sequence of one or more non-space characters, as is a value.
- **put <key> <value>**: insert the given key and value into the currently active ring. The instance must find the peer that is responsible for the given key using a DHT lookup operation, then contact that host directly and send it the key and value to be stored.
- **putrandom**:<n>: randomly generate <n> keys (and accompanying values) and put each pair into the ring. Useful for debugging.
- **get**:<key>: find the given key in the currently active ring. The instance must find the peer that is responsible for the given key using a DHT lookup operation, then contact that host directly and retrieve the value and display it to the local user.
- **delete**:<key>: similar to lookup, but instead of retrieving the value and displaying it, the peer deletes it from the ring.
Finally, there are operations that are useful mainly for debugging:
- **dump**: display information about the current node, including the range of keys it is responsible for, its predecessor and successor links, its finger table, and the actual key/value pairs that it stores.
- **dumpkey**:<key>: similar to dump, but this one finds the node responsible for <key>, asks it for its dump info, and displays it to the local user. This allows a user at one terminal to query any part of the ring.
- **dumptaddr**:<address>: similar to above, but query a specific host and dump its info.
- **dumpall**: walk around the ring, dumping all information about every peer in the ring in clockwise order (display the current host, then its successor, etc).
Of these, **dump** is the most helpful and is required. The others may prove helpful in debugging, but they are optional.
### DHT interface
When communicating with other DHT nodes, your DHT should use the basic operations described in the paper, including finger tables. You should implement a successor list as described in the paper, and basic migration of key/value pairs as nodes join and leave. Details are given later in this document.
There are a few different basic types of values that you will need to work with. For node addresses, use a string representation of the address in the form `address:port`, where address is a dotted-decimal IP address (not a host name). When referring to positions on the ring (ring addresses), you will be using a large number, not a string. This works out nicely: keys and node addresses are strings, and both can be hashed into ring addresses, which are not strings. The type checker will make sure you never mix up the two types of addresses.
You will use the sha1 hash algorithm (available in `crypto/sha1` in the Go standard library), which gives 160-bit results. This means that your finger table will have up to 160 entries. In order to treat these as large integer operations and perform math operations on them, you will need to use the `math/big` package. I recommend immediately converting sha1 hash results into `big` values and using that as your type for ring addresses.
Each node will need to maintain the following data structures as described in the paper:
- **finger**: a list of addresses of nodes on the circle. Create a list with 161 entries, all of which start out empty (None). You will only need to maintain a few of them at the end, but by creating a full-size list you will simplify your code and make it as similar to the pseudo-code in the paper as possible. Use entries 1–160 (instead of 0–159) for the same reason.
- **successor**: a list of addresses to the next several nodes on the ring. Set the size of this list as a global, named constant with a value of at least 3.
- **predecessor**: a link to the previous node on the circle (an address)
Note that addresses should contain an IP address and a port number.
The main operations you must support are:
- **find_successor(id)**: note that this is not the same as the **get** function from the command-line interface. This is the operation defined in Figure 5 of the paper.
- **create()**: note that this is not the same as the **create** function in the application interface; it is the operation defined in Figure 6 of the paper (and is invoked by the command-line interface).
- **join(n')**: note that this is not the same as the **join** function in the application interface.
- **stabilize()**
Each of these is described in the pseudo-code in the paper. You must also incorporate the modifications described in the paper to maintain a list of successor links instead of a single successor value.
**Suggestions**
The following are implementation suggestions, which you are free to follow or ignore.
**Goroutines**
- When you start the DHT (either through a create request or a join request), you should launch the RPC server for the local node. This is similar to what you have already done in the first project. Set up the necessary data structures, then launch the RPC server in its own goroutine.
- Run the stabilize procedure in its own goroutine, also launched at node creation time. It should run in a forever loop: sleep for a second, then call the stabilize procedure described in the paper.
- Similarly, fixfingers should run every second or so in its own goroutine.
- CheckPredecessor also runs in its own goroutine, also in a loop that repeats every second or so.
- Use the main goroutine to run the command-line interface loop. When it exits, everything else will be shut down as well.
**RPC connections**
The number and locations of peers will vary over time. For a production system, you would maintain a pool of outgoing connections and garbage collect connections over time.
To make things simpler, establish a fresh RPC connection for each message you send, wait for the response, then shut down that connection. You may find it helpful to write a function like this:
```go
func call(address string, method string, request interface{}, reply interface{}) error
```
This function takes care of establishing a connection to the given address, sending a request to the given method with the given parameters, then closes the client connection and returns the result.
It is okay to make all of your requests synchronously, i.e., the goroutine that sends the request can stop and wait until the response is available.
**Iterative lookups**
Use the iterative style of recursive lookups as described in the paper. All RPC calls will be able to return values immediately without blocking, i.e., every RPC server function queries or modifies local data structures without having to contact other servers.
The most complicated operation you must support is a complete `find_successor` lookup that may have to contact multiple servers. It should start by checking if the result can be found locally. If not, it should enter a loop. In each iteration, it contacts a single server, asking it for the result. The server returns either the result itself, or a forwarding address of the node that should be contacted next.
Put in a hard-coded limit on the number of requests that a single lookup can generate, just in case. Define this as a global, named constant. 32 ought to be sufficient for hundreds of nodes.
Here is revised pseudo-code for `find_successor` and friends:
```go
// ask node n to find the successor of id
// or a better node to continue the search with
n.find_successor(id)
if (id ∈ (n, successor])
return true, successor;
else
return false, closest_preceding_node(id);
```
// search the local table for the highest predecessor of id
n.closest_preceding_node(id)
// skip this loop if you do not have finger tables implemented yet
for i = m downto 1
if (finger[i] ∈ (n, id))
return finger[i];
return successor;
// find the successor of id
find(id, start)
found, nextNode = false, start;
i = 0
while not found and i < maxSteps
found, nextNode = nextNode.find_successor(id);
i += 1
if found
return nextNode;
else
report error;
Hash functions
To get a sha1 hash value, include the appropriate libraries and use something like this:
```go
func hashString(elt string) *big.Int {
hasher := sha1.New()
hasher.Write([]byte(elt))
return new(big.Int).SetBytes(hasher.Sum(nil))
}
```
Now you can use the operations in `math/big` to work with these 160-bit values. It is a bit cumbersome because you cannot use infix operators. For example, the following is helpful:
```go
const keySize = sha1.Size * 8
var two = big.NewInt(2)
func jump(address string, fingerentry int) *big.Int {
n := hashString(address)
fingerentryminus1 := big.NewInt(int64(fingerentry) - 1)
jump := new(big.Int).Exp(two, fingerentryminus1, nil)
sum := new(big.Int).Add(n, jump)
return new(big.Int).Mod(sum, hashMod)
}
```
This computes the address of a position across the ring that should be pointed to by the given finger table entry (using 1-based numbering).
Another useful function is this:
```go
func between(start, elt, end *big.Int, inclusive bool) bool {
if end.Cmp(start) > 0 {
return (start.Cmp(elt) < 0 && elt.Cmp(end) < 0) || (inclusive && elt.Cmp(end) == 0)
} else {
return start.Cmp(elt) < 0 || elt.Cmp(end) < 0 || (inclusive && elt.Cmp(end) == 0)
}
}
```
This one returns true if \( elt \) is between \( start \) and \( end \) on the ring, accounting for the boundary where the ring loops back on itself. If inclusive is true, it tests if \( elt \) is in \( (start, end] \), otherwise it tests for \( (start, end) \).
Getting your network address
It is helpful to have your code find its own address. The following code will help:
```go
func getLocalAddress() string {
var localaddress string
```
ifaces, err := net.Interfaces()
if err != nil {
panic("init: failed to find network interfaces")
}
// find the first non-loopback interface with an IP address
for _, elt := range ifaces {
if elt.Flags&net.FlagLoopback == 0 && elt.Flags&net.FlagUp != 0 {
addr, err := elt.Addr()
if err != nil {
panic("init: failed to get addresses for network interface")
}
for _, addr := range addr {
if ipnet, ok := addr.(*net.IPNet); ok {
if ip4 := ipnet.IP.To4(); len(ip4) == net.IPv4len {
localaddress = ip4.String()
break
}
}
}
}
}
if localaddress == "" {
panic("init: failed to find non-loopback interface with valid address on this node")
}
return localaddress
It finds the first address that is not a loopback device, so it should be one that an outside machine can connect to. If you have multiple devices or multiple IP addresses, it will choose one arbitrarily. It may even pick an IPv6 address.
**Implementation order**
**Week 1**
- Start by building your keyboard handler. Implement simple functions like `help`, `quit`, `port`, etc.
- Implement a skeleton `create` function that starts a `Node` instance complete with RPC server. Start by having it listen for a `ping` method that just responds to all requests immediately.
- Implement a `ping` command for the keyboard, which issues a ping request to a given address (as explained earlier). Use this to test if your RPC setup is working. You should use the `call` function given earlier. This will give you a complete RPC client/server pair.
- Implement `get`, `put`, and `delete` RPC server functions that manipulate the bucket of key/values pairs stored on a given instance. Implement `get`, `put`, and `delete` keyboard commands that require an address to be specified (later you will find the address by invoking your find function). Test everything with multiple instances running. You should be able to insert keys into remote instances, and retrieve them.
- Start implementing your `dump` command, which will initially just list the key/value pairs stored locally.
- Make a ring. Start by ignoring finger tables, and make a ring that just uses successor pointers. Follow the rules outlined in the paper. Implement the `join` command that initially just sets the given address as your successor.
- Update `dump` to show all interesting information about this node.
**Week 2**
- Implement a timer event for the `stabilize` function. This will require implementing `notify` as well. Your goal is to allow a complete ring with valid successor and predecessor pointers.
- Implement the initial version of the find function. Have it follow the list of successor pointers (since no finger table exists yet).
• Update `get`, `put`, and `delete` to use your find function to find the address where a key/value pair should be located instead of requiring the user to specify it.
• At this point, you should be able to build rings with all basic functionality in place. The rest is just optimization and failure handling.
• Add `fix_fingers` and `check_predecessor` and update `stabilize` to conform to the pseudo-code in the paper (if it does not already).
When `fix_fingers` finds a entry, add it to the next entry (as given in the pseudo-code), but also loop and keep adding to successive entries as long as it is still in the right range. For example, the successor for the position 1 step further around the ring is probably the successor for 2 steps around the ring, and for 4, 8, and 16 steps around the ring. You can check this without repeating the `find_successor` operation, and will likely fill the first 155 or so of the 160 entries with a single value. This is a good optimization.
• Update your `find_successor` function to use the finger table. In `closest_preceding_node`, the last line (the fallback case if nothing suitable was found in the finger table) should return your successor, not your own address.
At this point, you should have complete functionality as long as there are no failures.
**Week 3**
To handle failures, you need to keep a successor list. This is a suprisingly easy extension, and makes for a much more satisfying result.
• Store a list of successors *in addition* to the successor pointer. All of your existing code will continue to use the single successor link; you will only need to consult the list when your successor goes down. This list will start out with only a single entry (the initial value of the successor pointer). Set a global constant that will be its maximum size (3 is a reasonable number).
• Change `stabilize` to obtain your successor’s successor list in addition to its predecessor. Add your successor to the beginning of this list, and remove an element off the end if necessary to keep the list within its maximum size. This is your new successor list.
• When `stabilize`’s call to the successor fails, assume that the successor has gone down. Chop the first element off your successors list, and set your successor to the next element in the list. If there is no such element (the list is empty), set your successor to your own address.
Your ring should now tolerate node failures. All that is left is to manage migrating key/value pairs around the ring as nodes join and leave. This is also relatively easy:
• Make two new RPC server functions. `put_all` receives a map of key/value pairs, and adds all of its contents to the local bucket of key/value pairs.
`get_all` takes the address of a new node that is between you and your predecessor. It should gather all keys that belong to that new node (use your `between` function to determine this) into a new map, and it should also remove them from your bucket. You can loop through all the values in a map like this:
```
for key, value := range elt.Bucket { ... }
```
Return the map of values that no longer belong in your node.
• When a node is about to go down (in response to a `quit` command, call `put_all` on its successor, handing it the entire local bucket before shutting down.
• When joining an existing ring, issue a `get_all` request to your new successor once the join has succeeded, i.e., as soon as you know your successor.
This should give you full functionality.
|
{"Source-Url": "http://www.cs.dixie.edu/cs/3410/asst_chord.pdf", "len_cl100k_base": 4189, "olmocr-version": "0.1.49", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 17510, "total-output-tokens": 4672, "length": "2e12", "weborganizer": {"__label__adult": 0.00027179718017578125, "__label__art_design": 0.00017201900482177734, "__label__crime_law": 0.0001798868179321289, "__label__education_jobs": 0.00048422813415527344, "__label__entertainment": 5.328655242919922e-05, "__label__fashion_beauty": 8.767843246459961e-05, "__label__finance_business": 0.00010669231414794922, "__label__food_dining": 0.0003216266632080078, "__label__games": 0.0004265308380126953, "__label__hardware": 0.0006809234619140625, "__label__health": 0.0002810955047607422, "__label__history": 0.00013947486877441406, "__label__home_hobbies": 6.985664367675781e-05, "__label__industrial": 0.00023627281188964844, "__label__literature": 0.0001462697982788086, "__label__politics": 0.0001480579376220703, "__label__religion": 0.00031757354736328125, "__label__science_tech": 0.004367828369140625, "__label__social_life": 8.45789909362793e-05, "__label__software": 0.004192352294921875, "__label__software_dev": 0.98681640625, "__label__sports_fitness": 0.00022292137145996096, "__label__transportation": 0.0002605915069580078, "__label__travel": 0.00015091896057128906}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 18449, 0.00706]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 18449, 0.37874]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 18449, 0.88542]], "google_gemma-3-12b-it_contains_pii": [[0, 2704, false], [2704, 6709, null], [6709, 9852, null], [9852, 12106, null], [12106, 14934, null], [14934, 18449, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2704, true], [2704, 6709, null], [6709, 9852, null], [9852, 12106, null], [12106, 14934, null], [14934, 18449, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 18449, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 18449, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 18449, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 18449, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 18449, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 18449, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 18449, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 18449, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 18449, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 18449, null]], "pdf_page_numbers": [[0, 2704, 1], [2704, 6709, 2], [6709, 9852, 3], [9852, 12106, 4], [12106, 14934, 5], [14934, 18449, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 18449, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
3ef7ed58050d93b082ff9f1c69449696edac9b19
|
[REMOVED]
|
{"Source-Url": "https://lexelectronica.openum.ca/files/sites/103/Vol25_Num3_Bersini.pdf", "len_cl100k_base": 7502, "olmocr-version": "0.1.50", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 36835, "total-output-tokens": 8492, "length": "2e12", "weborganizer": {"__label__adult": 0.0006647109985351562, "__label__art_design": 0.001361846923828125, "__label__crime_law": 0.00231170654296875, "__label__education_jobs": 0.007770538330078125, "__label__entertainment": 0.0004527568817138672, "__label__fashion_beauty": 0.00037026405334472656, "__label__finance_business": 0.001807212829589844, "__label__food_dining": 0.0009169578552246094, "__label__games": 0.0025043487548828125, "__label__hardware": 0.00128173828125, "__label__health": 0.0012416839599609375, "__label__history": 0.0014696121215820312, "__label__home_hobbies": 0.00032639503479003906, "__label__industrial": 0.001079559326171875, "__label__literature": 0.006877899169921875, "__label__politics": 0.0244598388671875, "__label__religion": 0.0009870529174804688, "__label__science_tech": 0.36279296875, "__label__social_life": 0.0008449554443359375, "__label__software": 0.0345458984375, "__label__software_dev": 0.54052734375, "__label__sports_fitness": 0.00037598609924316406, "__label__transportation": 0.004680633544921875, "__label__travel": 0.000335693359375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 39017, 0.01226]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 39017, 0.42171]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 39017, 0.95231]], "google_gemma-3-12b-it_contains_pii": [[0, 2107, false], [2107, 4691, null], [4691, 7485, null], [7485, 9585, null], [9585, 11889, null], [11889, 13735, null], [13735, 15707, null], [15707, 17336, null], [17336, 19671, null], [19671, 22279, null], [22279, 24953, null], [24953, 27637, null], [27637, 30180, null], [30180, 32894, null], [32894, 35459, null], [35459, 37963, null], [37963, 39017, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2107, true], [2107, 4691, null], [4691, 7485, null], [7485, 9585, null], [9585, 11889, null], [11889, 13735, null], [13735, 15707, null], [15707, 17336, null], [17336, 19671, null], [19671, 22279, null], [22279, 24953, null], [24953, 27637, null], [27637, 30180, null], [30180, 32894, null], [32894, 35459, null], [35459, 37963, null], [37963, 39017, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 39017, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 39017, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 39017, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 39017, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 39017, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 39017, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 39017, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 39017, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 39017, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 39017, null]], "pdf_page_numbers": [[0, 2107, 1], [2107, 4691, 2], [4691, 7485, 3], [7485, 9585, 4], [9585, 11889, 5], [11889, 13735, 6], [13735, 15707, 7], [15707, 17336, 8], [17336, 19671, 9], [19671, 22279, 10], [22279, 24953, 11], [24953, 27637, 12], [27637, 30180, 13], [30180, 32894, 14], [32894, 35459, 15], [35459, 37963, 16], [37963, 39017, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 39017, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-29
|
2024-11-29
|
d09b154e760ee0f8cc97db6d06a50462823c4211
|
[REMOVED]
|
{"Source-Url": "https://inria.hal.science/hal-01434792/document", "len_cl100k_base": 6115, "olmocr-version": "0.1.50", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 34851, "total-output-tokens": 8088, "length": "2e12", "weborganizer": {"__label__adult": 0.0005483627319335938, "__label__art_design": 0.000507354736328125, "__label__crime_law": 0.0006022453308105469, "__label__education_jobs": 0.0006070137023925781, "__label__entertainment": 0.00021064281463623047, "__label__fashion_beauty": 0.00024819374084472656, "__label__finance_business": 0.00041747093200683594, "__label__food_dining": 0.0005292892456054688, "__label__games": 0.0007948875427246094, "__label__hardware": 0.0035076141357421875, "__label__health": 0.0011529922485351562, "__label__history": 0.0004870891571044922, "__label__home_hobbies": 0.00016438961029052734, "__label__industrial": 0.0009608268737792968, "__label__literature": 0.00039505958557128906, "__label__politics": 0.0004558563232421875, "__label__religion": 0.0007939338684082031, "__label__science_tech": 0.36474609375, "__label__social_life": 0.00014472007751464844, "__label__software": 0.01245880126953125, "__label__software_dev": 0.6083984375, "__label__sports_fitness": 0.0003905296325683594, "__label__transportation": 0.0008950233459472656, "__label__travel": 0.0002732276916503906}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 32642, 0.0334]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 32642, 0.2314]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 32642, 0.87011]], "google_gemma-3-12b-it_contains_pii": [[0, 1222, false], [1222, 3672, null], [3672, 6963, null], [6963, 9285, null], [9285, 11325, null], [11325, 14355, null], [14355, 16295, null], [16295, 19265, null], [19265, 21842, null], [21842, 23191, null], [23191, 24823, null], [24823, 26387, null], [26387, 28273, null], [28273, 31235, null], [31235, 32642, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1222, true], [1222, 3672, null], [3672, 6963, null], [6963, 9285, null], [9285, 11325, null], [11325, 14355, null], [14355, 16295, null], [16295, 19265, null], [19265, 21842, null], [21842, 23191, null], [23191, 24823, null], [24823, 26387, null], [26387, 28273, null], [28273, 31235, null], [31235, 32642, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 32642, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 32642, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 32642, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 32642, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 32642, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 32642, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 32642, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 32642, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 32642, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 32642, null]], "pdf_page_numbers": [[0, 1222, 1], [1222, 3672, 2], [3672, 6963, 3], [6963, 9285, 4], [9285, 11325, 5], [11325, 14355, 6], [14355, 16295, 7], [16295, 19265, 8], [19265, 21842, 9], [21842, 23191, 10], [23191, 24823, 11], [24823, 26387, 12], [26387, 28273, 13], [28273, 31235, 14], [31235, 32642, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 32642, 0.072]]}
|
olmocr_science_pdfs
|
2024-12-01
|
2024-12-01
|
71222a4649095587a4b67f78dee29549c203e1ef
|
Keeping Up With The Joneses (CVEs)
David Reyna
Wind River Systems
david.reyna@windriver.com
Security Response Management
*Risk, Cost, and Best Practices in an Imperfect World*
- Keeping our products secure is a requirement for survival
- Security data is available, but can be a flood of data with varying quality and completeness
- Managing security defects can be very inefficient, resulting in high costs
- We need to share best practices, knowledge, awareness, automation, and tools
Agenda
- Understanding CVE sources
- Understanding CVE quality
- Understanding CVE volume
- Managing your security response
- Costs, best practices, solutions
- New open source ‘Security Response Tool’ (SRTool)
General Security Patch Workflow
- **Upstream CVE Sources**
- Gather data/fixes/info
- Publish CVE Data
- **You (OS Vendor/OEM/etc.)**
- Scan upstream CVEs
- Manage CVE response
- Fix CVEs
- Create patches
- **Customer**
- Receive patches
- Test/deploy
(Covered Topics)
CVEs
- CVE (Common Vulnerability Enumerations)
- The enumerations of the community tracked security vulnerabilities, separated by the year reported (e.g. CVE-2018-12345)
- CVE content
- Description field
- Estimated severity score (CCSV), Low to Critical, 0.0 to 10.0
- Estimated impact and domain scores, e.g. “Attack Vector”, “Privileges Required”, “User Interaction”, “Scope”, “Confidentiality”, …
- List of affected products and their version numbers (CPEs)
- List of support links (published information, patches, reproducers, …)
- Weakness categories (CWE), e.g. “buffer overflow”, “pointer issues”
Upstream CVE Sources
- **MITRE**
- Manages the list of CVEs
- **NIST (National Institute of Standards and Technology)**
- Manages the National Vulnerability Database (NVD) of CVEs
- **Hardware Vendors, Software Maintainers, Distros**
- Many vendors track and share CVE's relevant to their product
- Many CVE aggregators also available (e.g. cvedetails.com)
- **Mailing lists, websites, and forums (public and private)**
- Preview of coming issues, place to discuss issues
## CVE Workflow: Normal/Expected
<table>
<thead>
<tr>
<th>Community</th>
<th>MITRE</th>
<th>SI Vendors / Maintainers</th>
<th>Vendors (NDA)</th>
<th>NIST</th>
<th>Vendors (Public)</th>
<th>Customers</th>
</tr>
</thead>
<tbody>
<tr>
<td>Discover</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>(Private)</td>
<td>(Work)</td>
<td>(Test)</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Public</td>
<td>Work</td>
<td>Public</td>
<td>Test</td>
<td>Watch</td>
<td>Watch</td>
<td></td>
</tr>
<tr>
<td>Fix – public</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>Receive/ Fix</td>
</tr>
</tbody>
</table>
---
*MITRE, SI Vendors, Vendors (NDA), NIST, Vendors (Public), Customers.*
## CVE Workflow: Out-of-order/Delayed
<table>
<thead>
<tr>
<th>Community</th>
<th>MITRE</th>
<th>SI Vendors / Maintainers</th>
<th>Vendors (NDA)</th>
<th>NIST</th>
<th>Vendors (Public)</th>
<th>Customers</th>
</tr>
</thead>
<tbody>
<tr>
<td>Discover</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Reserved</td>
<td></td>
<td>Work</td>
<td>Test</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>"</td>
<td></td>
<td>Fix – Public</td>
<td>-</td>
<td></td>
<td>What?</td>
<td>What?</td>
</tr>
<tr>
<td>"</td>
<td></td>
<td></td>
<td>-</td>
<td></td>
<td>Some Patch</td>
<td>Some fix</td>
</tr>
<tr>
<td>Public</td>
<td></td>
<td></td>
<td>-</td>
<td></td>
<td>More Patch</td>
<td>More fix</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>Public</td>
<td>All Patch</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>All fix</td>
</tr>
</tbody>
</table>
The focus here is not the vulnerability itself, but the process and cost in handling that vulnerability.
Quality of CVEs: Issues
- CVEs may only have a brief or incomplete description
- CVE affected product list (CPEs) may have gaps, errors, unexpected version deviations, even be empty
- CVE content may be misleading, mentioning one package when it actually affects a different package
- CVEs may have few, inaccurate, or missing content links (discussion, reproducers, patches)
- CVE status changes continually as new information is discovered and shared
- Sometimes delays in content updates
Quality of CVEs: Issues (2)
• The most recently created CVEs (within the last few months) are particularly prone to the above issues, but unfortunately these are often all that organizations have to work with for their pending releases (i.e. there is often no CPE data to work with)
• Tools (e.g. CVE scanners) must insure that (a) they are flexible in processing the information, (b) that they can differentiate between strong and weak data, (c) that expectations are set as to what the tool is able conclude and act upon, and that (d) humans are appropriately included in the process.
Quality of CVEs: Examples 1
- **CVE-2017-13220:**
- The CPE says “cpe:2.3:o:google:android:-:*:*:*:*:*:*:*:*:*:*:***” then talks about upstream kernel issues and refers to a kernel SHA.
- **CVE-2014-2524:**
- Has a CPE which claims all releases of “readline” 6.3 and below are vulnerable, but the problem only exists in 6.0 onwards.
Quality of CVEs: Examples 2
• CVE-2017-8872:
– Against “libxml” resulted in a bug and patch, but upstream ignored it. An almost-identical patch was merged recently but no mention of the CVE was made
• CVE-2018-10195:
– A case study in 'dark CVEs'. Reserved in MITRE, Red Hat have their own notice and a patch. Since it is for software which is long-dead, this patch will never go upstream.
Volume of CVE Data: Issues
- Volume of CVEs is 1000+ per month and growing
- Every new CVE must be evaluated, even if only a percentage may be applicable
- Costly in sheer numbers and required analysis overhead given the quality limitations
- Incorrectly categorizing a vulnerability can be even more costly in customer escalations and trust
Volume of CVE Data: Example
- Alerts:
- 2011: 4150
- 2012: 5288
- 2013: 5186
- 2014: 7937
- 2015: 6488
- 2016: 6449
- 2017: 14614
- Fixed:
- 2011: 341
- 2012: 433
- 2013: 645
- 2014: 1844
- 2015: 2330
- 2016: 5157
- 2017: 5436
- Supported Releases:
- 2011: 3
- 2012: 3
- 2013: 4
- 2014: 4
- 2015: 4
- 2016: 4
- 2017: 5
CVE Examples:
- CVE-2011-1020
- CVE-2012-3412
- CVE-2013-4312
- CVE-2014-0160 aka Heartbleed
- CVE-2015-0235 aka Ghost
- CVE-2016-8800 aka DROWN
- Stack-heap Overflow CVE-2017-100034-66
Tools: CVE System Analysis
- Can be very valuable in targeting product specific review activities
- Tells you of known vulnerabilities, but not what you are NOT vulnerable to
- Scans almost exclusively in the category of 'needs investigation'
- Depends on known data
- Example: Nessus
Tools: CVE Build/Source Analysis
- Can be more precise than system analysis
- Possible for something to trigger a vulnerable warning for components never used
- You still need to determine what you are not vulnerable to, understand the items that were reported, etc.
- Depends on known data
- Examples: Black Duck, Yocto Project ‘cve-report’, Dependency Tracker
Security Response Management
• While there is heightened awareness about device vulnerabilities, what is often missing is awareness about the process of managing the security response process itself.
• Security response management is overhead, where costs need to be understood and reviewed.
• Security response management does not make money, but it does protect money.
Security Management: Issues
- The amount of work is growing, in the volume of CVEs and in the product support matrix
- The vulnerabilities often apply differently against different releases
- The data is often not well integration with other systems, for example defect managers, agile managers, compliance tools
- The data is often not aggregated in accessible ways
- Difficult to share current data between development teams
- Difficult to share current status between teams and management
- Continual re-gathering status for reporting to management and customers
- Embargoed data requires special handling
- Compliance tracking and reporting
- Who knew what when
Security Management Services
• Some companies offload this process to external vendors
– They can provide the missing expertise and/or resources
– The pass-through can reduce customer response times
– The external support can be expensive
Defect systems vs. Security Management
Defect systems are often poor security management systems
- Defects are per product, CVE's are across products
- An issue may need to be tracked before a CVE is created or published
- Hard to manage embargoed data in defect systems
- Projects are normally public to entire product groups
- Would require shadow projects
- Would require a shadow project per authorized access list
- Awkward promoting private issues to public defects
Cost overview: Necessary costs
- Tracking upstream CVE's
- Creating and fixing defects
- Provide updates to customers, management
- Provide patches to customers
Cost overview: Unnecessary costs
- Repeated manual polling of upstream data, initial and all updates
- Repeated manual polling of defect status
- Manually un-assisted analysis of each CVE for vulnerability status, across products
- Manually re-analyzing each updated CVE for vulnerability status
- Manually tracking and sharing patches, reports, documents, ...
- Manually regathering status for customers, management
- Manually tracking private data, and "who knew what when"
- Manually repackaging data for public database
Best Practices
• Automate as much of the process as possible
– CVE data gathering, updating, change notifications
– Defect update polling, with filtered change notifications
– Report tools for management and customers
– History and audit tracking
• Use multiple sources
– NIST, MITRE, distros, oss-security, linux-distros (private list), …
• Aggregate the data
– Central database, central document store
Best Practices (2)
- Provide easy access to the data
- GUI interfaces, command line scripts
- Be flexible with the data
- Design for the imperfections of the upstream data
- Defocus details (like version numbering) during analysis, to avoid big misses from small errors
- Provide tools for CVE inflow triage
- Provide tools to help walk the volume of CVEs
- Provide heuristics to help provide guidance given the gaps in the provided information
- Provide management for NDA information
- Central but safe storage, user restrictions, easy promotion to public database
Introducing the SRTool
- Wind River has developed a tool called the “Security Response Tool” based on its cumulative experience.
- Its goal is to address the process pain points and inefficiencies, to scale with a limited staff, and to implement best practices.
- Wind River has shared this with open source.
Srtool Features for Best Practices
- **Automation** for multiple CVE source updates, defect status, report generation, history audit data
- **Easy access** via web interface and command line scripts
- **Data aggregation** in SQL database, download directory
- **Data flexibility** by design
- **Tool for CVE inflow triage**, with guidance heuristics
- **NDA management** via user model, deploy model
## Affected Products
<table>
<thead>
<tr>
<th>Product Name</th>
<th>Investigation</th>
<th>Status</th>
<th>Outcome</th>
<th>Defect</th>
<th>Release Version</th>
<th>Manage</th>
</tr>
</thead>
<tbody>
<tr>
<td>Linux Customer Content Management</td>
<td>19118</td>
<td>Not Vulnerable</td>
<td>Closed</td>
<td>LINCGM-2020</td>
<td>LINCGM-2022</td>
<td>LINCGM-2160</td>
</tr>
<tr>
<td>Wind River Linux 5</td>
<td>112769</td>
<td>Vulnerable</td>
<td>Fixed</td>
<td>LIN5-24077</td>
<td>5.0.1.42</td>
<td></td>
</tr>
<tr>
<td>Wind River Linux LTS-17</td>
<td>120518</td>
<td>Vulnerable</td>
<td>Open</td>
<td>LIN10-2989</td>
<td>LIN10-3041</td>
<td>10.17.41.9</td>
</tr>
<tr>
<td>Wind River Linux 9</td>
<td>125978</td>
<td>Vulnerable</td>
<td>Open</td>
<td>LIN9-8155</td>
<td>LIN9-8164</td>
<td>9.0.0.15</td>
</tr>
<tr>
<td>Wind River Linux 8</td>
<td>133082</td>
<td>Vulnerable</td>
<td>Open</td>
<td>LIN8-8496</td>
<td>LIN8-8509</td>
<td>8.0.0.25</td>
</tr>
<tr>
<td>Wind River Linux 7</td>
<td>141608</td>
<td>Vulnerable</td>
<td>Open</td>
<td>LIN7-9344</td>
<td>LIN7-9345</td>
<td>7.0.0.28</td>
</tr>
<tr>
<td>Wind River Linux 7 SCP</td>
<td>148800</td>
<td>Vulnerable</td>
<td>Open</td>
<td>SCP7-747</td>
<td>7.0.0.28</td>
<td></td>
</tr>
<tr>
<td>Wind River Linux LTS-18</td>
<td>149901</td>
<td>Not Vulnerable</td>
<td>Closed</td>
<td>LIN1018-313</td>
<td>unknown</td>
<td></td>
</tr>
<tr>
<td>Wind River Linux 6</td>
<td>153283</td>
<td>Vulnerable</td>
<td>Open</td>
<td>LIN5-14153</td>
<td>LIN5-14156</td>
<td>6.0.0.37</td>
</tr>
<tr>
<td>Wind River Linux 6 SCP</td>
<td>162016</td>
<td>Vulnerable</td>
<td>Open</td>
<td>SCP6-1119</td>
<td>6.0.0.37</td>
<td></td>
</tr>
</tbody>
</table>
SRTool: Object Model
- **Data source**: represents external content, like CVE data providers, defect system, and sustaining team
- **CVE**: the representation of the upstream CVEs
- **Vulnerability**: the mapping of CVE(s) issues across the products
- **Investigation**: the mapping of a vulnerability to specific product/defects
- **Defect**: the mapping to the organization’s defects (Jira, Bugzilla) to CVE’s via Investigations
- **Notifications**: automatic messaging of changed upstream CVE and internal defect status
SRTool: Functional Layout
Web Interface
SRTool Engine
SRTool Data Base (SQL)
| CVE | Vul | Inv | Defect | Notify |
Back end scripts
cron job (trigger incremental updates)
External Sources
- MITRE
- NIST
- Other...
- Jira/Bugzilla
- Sustaining
Reports
Report scripts
Public Facing DB
Custom data scripts
Data: Bulk files, cached CVEs
Data: Download cache
External Sources
MITRE
NIST
Other...
Jira/Bugzilla
Sustaining
SRTool: Guided Incoming CVE Triage
- CVE incoming rate 1000+ a month
- View for fast review and triage
- Heuristics from the previous defects to help guide the filtering process
<table>
<thead>
<tr>
<th>Select</th>
<th>Status</th>
<th>Recommendation</th>
<th>Name</th>
<th>Description</th>
<th>Severity (VS)</th>
<th>Reasons For</th>
<th>Reasons Against</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>New</td>
<td>0</td>
<td>CVE-2018-1000002</td>
<td>Improper input validation bugs in DNSSEC validators components in Knot Resolver (prior version 1.5.2) allow attacker in man-in-the-middle position to deny existence of some data in DNS via packet replay.</td>
<td>3.7 LOW</td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>New</td>
<td>0</td>
<td>CVE-2018-1000003</td>
<td>Improper input validation bugs in DNSSEC validators components in PowerDNS version 4.1.0 allow attacker in man-in-the-middle position to deny existence of some data in DNS via packet replay.</td>
<td>3.7 LOW</td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>New</td>
<td>1</td>
<td>CVE-2018-1000004</td>
<td>In the Linux kernel 4.12. 3.10. 2.6 and possibly earlier versions a race condition vulnerability exists in the sound system, this can lead to a deadlock and denial of service condition.</td>
<td>5.0 MEDIUM</td>
<td>linux</td>
<td></td>
</tr>
<tr>
<td></td>
<td>New</td>
<td>-1</td>
<td>CVE-2018-1000005</td>
<td>Gitlab Electron versions 1.8.2-beta 3 and earlier, 1.7.10 and earlier, 1.6.15 and earlier has a vulnerability in the protocol handler, specifically Electron apps running on Windows 10. 7 or 2006 that register custom protocol handlers can be tricked in arbitrary command execution if the user clicks on a specially crafted URL. This has been fixed in versions 1.8.2-beta 4, 1.7.11, and 1.6.16.</td>
<td>8.8 HIGH</td>
<td>windows</td>
<td></td>
</tr>
<tr>
<td></td>
<td>New</td>
<td>2</td>
<td>CVE-2018-1000006</td>
<td>Jenkins PMD Plugin 3.49 and earlier versions XML external entities in files it parses as part of the build process, allowing attackers with user permissions in Jenkins to extract secrets from the Jenkins master, perform server-side request forgery, or denial-of-service attacks.</td>
<td>8.8 HIGH</td>
<td>plugin xml</td>
<td></td>
</tr>
</tbody>
</table>
SRTool: Next Steps
• The SRTool is under active open source development, so come join us!
• The design is modular, so it is easy to add your data sources and implement your business rules
• The SRTool is intended at this time to be an internal tool, with scripts to export clean data to the organization's public CVE site
• The community page is hosted here:
– https://wiki.yoctoproject.org/wiki/Contribute_to_SRTool
Conclusion
• There is quite a wealth of vulnerability information available.
• With knowledge, awareness, adaptability, and automation, we can manage this struggle.
• We need to spend people’s time on the actual problems, not the process.
• Use these links to learn more:
• https://lists.yoctoproject.org/listinfo/yocto-security
• david.reyna@windriver.com (SRTool maintainer)
See a live SRTool demo at the Yocto Project Booth!
|
{"Source-Url": "https://elinux.org/images/9/94/Keeping-Up-With-The-Joneses-CVEs-David-Reyna-Wind-River-Systems.pdf", "len_cl100k_base": 4843, "olmocr-version": "0.1.53", "pdf-total-pages": 34, "total-fallback-pages": 0, "total-input-tokens": 40201, "total-output-tokens": 5826, "length": "2e12", "weborganizer": {"__label__adult": 0.0006403923034667969, "__label__art_design": 0.0006961822509765625, "__label__crime_law": 0.007511138916015625, "__label__education_jobs": 0.0020389556884765625, "__label__entertainment": 0.0001455545425415039, "__label__fashion_beauty": 0.0003445148468017578, "__label__finance_business": 0.003847122192382813, "__label__food_dining": 0.0003597736358642578, "__label__games": 0.0011281967163085938, "__label__hardware": 0.0038509368896484375, "__label__health": 0.0007472038269042969, "__label__history": 0.0003414154052734375, "__label__home_hobbies": 0.00026106834411621094, "__label__industrial": 0.0015134811401367188, "__label__literature": 0.00033354759216308594, "__label__politics": 0.0006222724914550781, "__label__religion": 0.0004494190216064453, "__label__science_tech": 0.0987548828125, "__label__social_life": 0.00029969215393066406, "__label__software": 0.2003173828125, "__label__software_dev": 0.6748046875, "__label__sports_fitness": 0.0003020763397216797, "__label__transportation": 0.0004224777221679687, "__label__travel": 0.00023043155670166016}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 17344, 0.06475]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 17344, 0.09147]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 17344, 0.84203]], "google_gemma-3-12b-it_contains_pii": [[0, 93, false], [93, 490, null], [490, 702, null], [702, 991, null], [991, 1612, null], [1612, 2098, null], [2098, 2922, null], [2922, 3876, null], [3876, 3981, null], [3981, 4473, null], [4473, 5062, null], [5062, 5401, null], [5401, 5797, null], [5797, 6140, null], [6140, 6691, null], [6691, 6977, null], [6977, 7340, null], [7340, 7714, null], [7714, 8391, null], [8391, 8637, null], [8637, 9117, null], [9117, 9279, null], [9279, 9804, null], [9804, 10223, null], [10223, 10803, null], [10803, 11113, null], [11113, 11514, null], [11514, 13180, null], [13180, 13704, null], [13704, 14134, null], [14134, 16490, null], [16490, 16910, null], [16910, 17344, null], [17344, 17344, null]], "google_gemma-3-12b-it_is_public_document": [[0, 93, true], [93, 490, null], [490, 702, null], [702, 991, null], [991, 1612, null], [1612, 2098, null], [2098, 2922, null], [2922, 3876, null], [3876, 3981, null], [3981, 4473, null], [4473, 5062, null], [5062, 5401, null], [5401, 5797, null], [5797, 6140, null], [6140, 6691, null], [6691, 6977, null], [6977, 7340, null], [7340, 7714, null], [7714, 8391, null], [8391, 8637, null], [8637, 9117, null], [9117, 9279, null], [9279, 9804, null], [9804, 10223, null], [10223, 10803, null], [10803, 11113, null], [11113, 11514, null], [11514, 13180, null], [13180, 13704, null], [13704, 14134, null], [14134, 16490, null], [16490, 16910, null], [16910, 17344, null], [17344, 17344, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 17344, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 17344, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 17344, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 17344, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 17344, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 17344, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 17344, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 17344, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 17344, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 17344, null]], "pdf_page_numbers": [[0, 93, 1], [93, 490, 2], [490, 702, 3], [702, 991, 4], [991, 1612, 5], [1612, 2098, 6], [2098, 2922, 7], [2922, 3876, 8], [3876, 3981, 9], [3981, 4473, 10], [4473, 5062, 11], [5062, 5401, 12], [5401, 5797, 13], [5797, 6140, 14], [6140, 6691, 15], [6691, 6977, 16], [6977, 7340, 17], [7340, 7714, 18], [7714, 8391, 19], [8391, 8637, 20], [8637, 9117, 21], [9117, 9279, 22], [9279, 9804, 23], [9804, 10223, 24], [10223, 10803, 25], [10803, 11113, 26], [11113, 11514, 27], [11514, 13180, 28], [13180, 13704, 29], [13704, 14134, 30], [14134, 16490, 31], [16490, 16910, 32], [16910, 17344, 33], [17344, 17344, 34]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 17344, 0.12587]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
0f13ff04455a9648af919285d584e381e6b73591
|
UvA-DARE (Digital Academic Repository)
SAD/Parasol II progress report
de Ronde, J.F.; van Halderen, A.W.; Beemster, M.; Sloot, P.M.A.
Citation for published version (APA):
General rights
It is not permitted to download or to forward/distribute the text or part of it without the consent of the author(s) and/or copyright holder(s), other than for strictly personal, individual use, unless the work is under an open content license (like Creative Commons).
Disclaimer/Complaints regulations
If you believe that digital publication of certain material infringes any of your rights or (privacy) interests, please let the Library know, stating your reasons. In case of a legitimate complaint, the Library will make the material inaccessible and/or remove it from the website. Please Ask the Library: https://uba.uva.nl/en/contact, or a letter to: Library of the University of Amsterdam, Secretariat, Singel 425, 1012 WP Amsterdam, The Netherlands. You will be contacted as soon as possible.
COMMISSION OF THE EUROPEAN COMMUNITIES
ESPRESSO III
PROJECT NB 6756
CAMAS
COMPUTER AIDED MIGRATION OF APPLICATIONS SYSTEM
CAMAS-TR-2.2.4.2
SAD/PARASOL II Progress report
Date: SEPT.1993
Rev. 2.0
ACE - U. of AMSTERDAM - ESI SA - ESI GmbH - FEGS - PARSYTEC - U. of SOUTHAMPTON.
1. Introduction
The above mentioned period effort has been spent on the design and development of several tools (boxes in the overview picture below) that the University of Amsterdam contributes to the CAMAS Workbench.
2. Development of the SAD formalism.
The development of SAD (Symbolic Application Description) which is the mathematical formalism that describes the time complexity of sequential and SPMD Fortran programs has been one of the focal points this period. Firstly it was recognized that a mathematical formalism describing such programs in order to represent a time complexity description of the program, should consist of three separate levels:
We describe SPMD programs by the following functional hierarchy:
1) Statement block level (fixed complexities, machine dependent)
2) Control flow level (control dependent complexities)
3) Data locality level (data distribution dependent complexities)
2.1 Research focus
Investigations have been done on a formalism that can capture the first two levels in a description. Therefore several typical Fortran 77 programs/program parts have been analysed by hand. As the example in the appendix shows the first two levels of the functional hierarchy allow a generic description of the form:
\[ SAD = \sum_{i=1}^{N} \prod_{m}^{M} \prod_{k}^{K} P_{k} X_{m} S[Block(i)] \]
Where $N$ is the number of isolated statement blocks (containing no control flow characteristics whatsoever), $P_k$ describes the $k$-th nested branch probability of the total of $K_i$ branches in which $S[Block(i)]$ is nested. Analogously $X_m$ describes the loop-count of the $m_i$-th nested loop of a total of $M_i$ loops in which $S[Block(i)]$ is nested. $S[Block(i)]$ is the time complexity of an isolated statement block labelled $i$.
1) The time complexity of a so called statement block $S[Block(i)]$ is given by cumulation of all the individual time complexities occurring in the block. For example an expression like:
\[ a = a + b \times c \]
has a time complexity of \( T_{assign} + T_{multiply} + T_{addition} \)
The corresponding actual time measures in such formal expressions are filled in by the machine database (the parameterised machine description).
2) The control flow level introduces indeterminability into the time complexity description. In general the execution path taken, given a specific set of input parameters, is only determinable by means of explicit execution. We approach this level in a (quasi) statistic manner by describing the possibility of branching in some specific direction along the execution graph. Branch directions in if..then..else constructs are specified by probabilities $P_1, P_2, P_3, ..., P_n$ (where we assume the number of branching directions = $n$) whereas in loop constructs the number of unkown iterations is presented by a stochastic variable $X$. So a parameterised description on these two levels leads to a mixture of the time-complexities of basic statement blocks, probabilities and stochastic variables.
3) The locality level describes the fact that some fraction of data is involved in communication and the remaining part is not. So far only the first two levels have been considered in the SAD formalism. How exactly the 3rd level will eventually appear in the time complexity formula is part of future work. This will among others depend on how the MAP subtask will evolve.
2.2 Data dependent control information
As is clear from the overview picture PARASOL II plays a key-role in the Workbench structure. What in fact happens in PARASOL II is actualisation of the parameters present in the SAD formula. The machine parameters are obtained from the machine database developed under Parasol I and have a clear origin (some existing or what-if hardware architecture that is). The other parameters originating from control flow and -when the 3rd level will be concerned- from data locality also need to be initialized in order to obtain a time complexity measure for the program of interest. The question of how to actualize these parameters is to be answered in PARASOL II. Control dependency information will be substracted from the parse tree generated in the F2SAD transformation sequence. The ideas behind the implementation of such an automatic transformation tool will be discussed in one of the paragraphs below. Furthermore in the appendix an idea of what control dependencies will be substracted will be given. At this point obviously the Interprocedural Dependency Analyser of Southampton can be brought into the picture.
2.3 The reduction/compression phase
Given a general F77 numerical application. It can consist of thousands of lines of code and consequently performing F2SAD on it will lead to a formal expression that is out of proportion. Therefore in order to have an expression that is manageable it has to be reduced
in size by means of compression and reduction techniques. One can think of purely mathematical manipulations as the "Simplify" operation in Mathematica or reductions based on information obtained from data dependency analysis. For some examples of such reduction and compression operations see the appendix. The mathematical manipulation package Mathematica offers the possibility of performing reduction/compression techniques and several reductions/compressions can also automatically be performed within the F2SAD tool. The reduction task consists of manipulating the SAD formula using control dependency information (and probably also expert programmers knowledge) to do realistic actualisations of the parameter set that comprises the SAD formula. So the manipulations are reductions/compressions and actualisation of parameters. Both have to be done using some mathematical manipulation package. The solution to problems arising in actualizing the parameters are part of future research. The paragraph below will shed some light on the status of the simulation strategies as they have been developed until now.
3 PARASOL II: simulations/experiments
The goal of PARASOL II is: given the following:
- A reduced SAD description of a data parallel (SPMD) Fortran 77 application
- A Machine parameterization
- A Mapping tool which optimizes the data distribution
to obtain a prediction of the time consumption of the application given a spectrum of input values and machine parameters (PARASOL I). This would mean in the idealized case: Fill in the various input parameters to the SAD expression and the time complexity given the specific actualization rolls out of the black box. Due to the undeterminability of control flow this procedure will only work for generic applications when in fact the code is executed. Program execution is undesirable for a variety of reasons:
-Probably performance prediction on a "What-if machine", or "still-to-be-built "machine is desired so that execution is not possible.
-The time complexity response on "What-if" input may be of interest.
-Simulation allows for the exploration of different coding strategies for core codes without actually being forced to implement every strategy explicitly.
3.1 The undeterminable X
The SAD contains a number of specific parameters originating from the three hierarchical levels. Some of these parameters will depend trivially on input parameters (e.g. problem size = N) others will depend on the entire program evolution (e.g. the stop condition in a matrix inverting algorithm). The parameters with trivial dependendce are to be identified using control dependency analysis. The problematic ones are to be approximated using stochastic modelling. That is: based on characteristic features of a parameter (of importance) that can be supplied by the expert programmer or that can be derived from the source code (reversibility) the response of such a parameter on variations \( \delta \) of the input vector \( \mathbf{i} \) can be approximated/modelled.
Notational: \( \mathbf{i} \) represents the list of input parameters that is given as ordinary input to enable an application to execute. E.g. : the elements of a matrix and a vector when the calculation of a matrix vector product is concerned. Formally we shall denote the list with input values as:
\[ \mathbf{i} = \{i_1, i_2, \ldots, i_n\} \]
In general the parameters X or P that describe loop and branching constructs in the SAD are functions of the input vector \( \tilde{I} \): \( X = f(\tilde{I}) \). What is desired is an estimation of this function, as the only way to get the exact representation of \( X = f(\tilde{I}) \) is execution of substantial parts of the application. Furthermore, some measure telling how probable this function tells the "truth" is convenient. E.g. for a specific X you can show that within a deviation of \( \delta f(\tilde{I}) \) the used function is approximated. In other words:
\[
X = f(\tilde{I}) + \delta f(\tilde{I})
\]
The picture below gives an idea how this undeterminable behaviour would appear in the time complexity function when varying one of the input parameters \( i \), the other parameters kept constant. The error bar characterizes the uncertainty for specific \( i \) that the time complexity formula \( T (= \text{SAD formula}) \) has at this point. These error bars are present for the whole spectrum of \( i \).
So X is in general a function which depends on the input vector \( \tilde{I} \). Suppose we have a row of M functions
\[
f_1 \circ f_2 \circ f_3 \circ \ldots \circ f_M(\tilde{I})
\]
where \( f \circ g \) means: the function f acting on the function g that consecutively operate on \( \tilde{I} \). The complexity of these functions determines if you can calculate the response that these functions cause in a simple manner or that one has to flee to approximation methods. One can roughly discriminate several grades of complexity to obtain knowledge about the dependence of a parameter X on the input list:
- X directly corresponds to some element \( i \) of \( \tilde{I} \): \( X = i \)
- X depends on \( \tilde{I} \) via a simple function and this function is tractable via some data dependency analysis.
- X depends on \( \tilde{I} \) via a function that is not simple but corresponds to the computation of significant parts of the application.
The problem with approximating the responses using some deviation function lies in the fact that in general the sequence of functions that act on the specific input list changes when a fluctuation \( \delta \tilde{I} \) is superposed on \( \tilde{I} \). So a continuous variational solution method is not applicable to this problem (see picture below for elucidation). Formally one could write this down as:
\[ i_m \rightarrow T(i_m) \]
\[ i_m + \delta i_m \rightarrow T(i_m + \delta i_m) \]
\[ T(i_m + \delta i_m) - T(i_m) = ? \]
where \( T \) denotes the time complexity formula and \( i_m \) denotes an input variable which is varied and is an element from the input list:
\[ \hat{I} = \{i_1, i_2, \ldots, i_n\} \]
The ? denotes the fact that a small variation in the input can lead to small variations in the response function and to large non-linear jumps. So it is clear that the problem of how to model/estimate response functions in this area is part of future research.
depending on the input list another trajectory through
the function tree below is actualized
\[
\begin{align*}
T(I) &= f(g_1(h_1(I))) \\
T(I + \delta I) &= f(g_1(h_2(I + \delta I))) \\
T(I + \delta I') &= f(g_2(w_1(I + \delta I'))) \\
T(I + \delta I'') &= f(g_2(w_2(I + \delta I''))) \\
\end{align*}
\]
Input lists
The picture above visualizes the non-linear behaviour of the response to variations of the input list. \( f, g_1, g_2, h_1, h_2, w_1, w_2 \) are functions.
4. Implementation issues: F77 to SAD
4.1 How to get from Fortran to a SAD description
To obtain a SAD description of a Fortran program, a transformation of the source code has to be done. This translation process, implemented as a compiler, takes Fortran 77 source code augmented with communication primitives for the SPMD programming model as input and builds the SAD formula with the corresponding data dependent control flow and additional information about the program.
In the section below the general structure of such a translator is discussed. We then turn to the implications of trying to process Fortran. Finally we turn to the way the translation process can be implemented.
4.2 Structure of the front-end of the f2sad compiler
Fortran was the first high level programming language ever developed. Unfortunately, during the development of this early programming language a number of decisions were made which turned out to be bad practice in computer language design. Therefore the standard tools (lex & yacc) for compiler engineering are not directly applicable to Fortran 77.
There are several difficulties with Fortran which must be solved before standard tools can be used. These problems will be discussed in the software layer where they are solved.
The structure of the front-end of the $f2sad$ compiler is structured as shown in the above figure, which is comparable to the generic model of a compiler [1]. The source program -- Fortran 77 code-- is read using a separate module. This module performs tasks like buffering, keeping track of the file position, line and column numbering. It also contains routines for returning errors back to the user.
This stream of characters is then filtered using a preprocessing module. Its output is a modified stream of characters where the following set of problems is solved.
- If a line starts with a label then it will be preceded by a special indicating character. This will enable the lexical analyzer to distinguish these labels from integers, which in turn is needed in the syntactic analyzer. Labels after goto's and other jump statements are not preceded by this indicator because the syntactic analyzer does not need to know this.
- All spacing characters except newlines are removed. Many programming languages have a free layout (spacing characters may be inserted freely between tokens), Fortran unfortunately takes this even one step further: spacing characters are insignificant. If you separate the characters within the keyword if with a space (making $i f$) the compiler should still recognize it as one keyword if instead of two variables $i$ and $f$.
- Continuation lines are glued together to produce one line.
- Comment lines are deleted.
- Since Fortran officially only defines uppercase letters, the compiler is so friendly to convert lowercase letters to uppercase.
- Note that this preprocessor module breaks the direct correlation between the line numbers in the input and the output. We want however to be able to go back from the generated SAD description to the source code, therefore this correlation needs to be restored. This is solved by the module which reads the file. The semantics description is able to refer to the file position of the tokens using a separate information passing mechanism.
The lexical analyzer for Fortran is written using lex, a tool for generating lexical analyzers using regular expressions. Because the preprocessor has made some changes to the source input it is now possible to tokenize the input. The lexical analyzer not only converts characters into tokens, it also stores the lexical value (lexeme) for later use.
The following irregular behaviour patterns were necessary in the implementation of the lexical analyzer (using lex).
- If a label indicator is encountered in the input stream then the next token is a label instead of an integer. The label indicator character is further ignored.
- Within certain contexts, the context-free parser cannot distinguish an assignment to an array element from a function definition statement (this is discussed further on). Therefore the lexical analyzer indicates, on request of the parser, by inserting a special token whether this statement is an assignment or a function definition statement. It can determine this by looking if the identifier in the statement is defined. If the identifier is indeed defined to be an array then we are dealing with an assignment, otherwise with a function definition or an error.
- As said earlier; Fortran considers white spaces as insignificant. Suppose we have the input if foo. This should be tokenized into two tokens, the keyword if and the identifier foo. Unfortunately, because spaces are deleted and lex always tries to match the longest token it will consider if foo as one identifier iffoo. By checking prefixes of lexemes we can detect keywords, bypass the "longest matching token" rule and consider the remaining characters as part of the next token.
4.3 The semantics and back-end of the f2sad compiler
The yacc generated syntax checker, is normally used to make a parse tree. A parse tree represents the input source program in a structured way, in the same way the grammar is written down. Yacc does not automate the building of the parse tree, but allows you to execute actions on the nodes of the abstract parse tree. In this way you can build the parse tree yourself.
The translation process of the compiler can be viewed as the rewriting process of the parse tree into a tree representing the output. The output can then be generated by a traversal of the latter tree.
There are tools (e.g. [2]) available which assist in coupling the syntax checker and a parse tree manipulator, but most tools have the disadvantage of defining their own lexical and syntax analyzing languages. These restrict the classes of languages that can be handled and since Fortran parsing needs some special tuning of the lexical and syntax analyzers this presents a severe problem. It is possible to overcome these problems by creating an additional layer or by using a self-made tool.
The rewriting process of the Fortran parse tree into the SAD formula is not extremely difficult, the only complication is that Fortran may contain goto statements, possibly creating so called spagetti code.
The data dependent control flow contains information by which the control flow can be described in terms of its input parameters. Generating this data dependent control flow information about the program is a more serious problem which still needs a lot of our attention.
Modelling and analyzing data dependent control flow interacts with analyzing data dependency. Therefore techniques used within the IDA (interprocedural dependency analyzer) tool may be very similar to techniques we need to use. Information generated by the IDA tool may enhance the data dependent control flow information. Future interaction between SOTON and the UoA therefore seems fruitful.
4.4 Status
The lexical- and syntax descriptions, the file reader and the preprocessor for Fortran are finished. The tool for building and rewriting the parse tree is nearing completion (in the testing phase). The description of the semantics of Fortran is currently being constructed. All finished parts are tested, but can only be tested thoroughly when the entire tool has been completed.
Bibliography
[2] *The TXL programming language, Syntax and informal semantics, Version 7*
APPENDIX
Abstracting the SAD Formula from a Fortran 77 kernel by hand
In this appendix the SAD formalism describing the first two levels of the functional hierarchy of Fortran 77 (or C) will be derived using a scientific Fortran 77 kernel extracted from the so called Livermore Loops. This example will clarify the SAD expression that is chosen to describe the functional structure of Fortran 77 programs. Several F77 examples have been transformed to SAD by hand and these have shown the direction in which the F2SAD tool currently is being developed.
The Livermore Loop we're handling as an example of F2SAD by hand has the following form:
```fortran
PROGRAM SADTST
PARAMETER (NN = 100, LOOP = 100)
DIMENSION X(NN), V(NN)
N = 1000
DO 23 J = 1, NN
V(J) = EXP ((REAL(J) - 50.)**2) / 5.0
23 X(J) = EXP ((REAL(J) - 50.)**2)
DO 200 L = 1, LOOP
II = N
IPTNP = 0
222 IPNT = IPTNP
IPNTP = IPTNP + II
II = II / 2
DO 2 K = IPNT + 2, IPNTP, 2
I = I + 1
2 X(I) = X(K) - V(K) * X(K-1) -
200 CONTINUE
END
```
The Livermore Loop under consideration descends from an ICCG (Incomplete Cholesky Conjugate Gradient). The basic statement blocks (level 1) are pointed out. Writing out the SAD expression by hand leads to:
\[
SAD(\text{program}) = S[\text{Block}(1)] + X_1 S[\text{Block}(2)] + X_2 S[\text{Block}(3)] + X_3 S[\text{Block}(4)] + X_4 S[\text{Block}(5)] + S[\text{Block}(6)]
\]
or
\[
SAD(\text{program}) = S[\text{Block}(1)] + X_1 S[\text{Block}(2)] + X_2 S[\text{Block}(3)] + X_2 X_3 S[\text{Block}(4)] + S[\text{Block}(6)] + X_2 X_3 X_4 S[\text{Block}(5)]
\]
Where \(S[\text{Block}(i)]\) denotes the cumulation of the atomic time complexities in the statement blocks. For example: \(S[\text{Block}(1)] = T_{\text{aic}}\) : That is the time to assign an integer constant.
The other statement blocks have the same form though of course in large statement blocks much more different atomic times are involved.
Further:
\[ X_1 \text{ corresponds to the loop boundary of the DO 23 -- 23 loop} \]
\[ X_2 \text{ corresponds to the loop boundary of the DO 200 -- 200 loop} \]
\[ X_3 \text{ corresponds to the loop boundary of the IF(II.GT.1) GOTO 222 loop} \]
\[ X_4 \text{ corresponds to the loop boundary of the DO 2 -- 2 loop} \]
We see that loop boundaries (originating from do loops or from if..goto loops) are parameterized in the SAD expression. Further investigations of generic Fortran 77 constructs have shown that an equivalent parameterization can be applied for handling the presence of if..then...elseif ....endif constructs in Fortran 77. The various branching directions offered in a branch construct are modelled by chances that describe the probability that a branch in a certain direction is realised. It turns out that an analogous nested expression arises as in the above expression. Furthermore it became clear that the probability and the loop boundary parameters could be handled as normal factors in a factorized expression. Therefore after having done several F2SAD actions by hand we can state that as long as the code is structured (no spaghetti) a symbolic expression for such programs can be realized and furthermore the general form for such a SAD expression is:
\[ SAD = \sum_{i=1}^{N} \prod_{m_i}^{M_i} \prod_{k_i}^{K_i} P_{k_i} X_{m_i} S[Block(i)] \]
Where : \( P_{k_i} \) describes the \( k_i \)-th nested branch probability of the total of \( K_i \) branches in which \( S[Block(i)] \) is nested. Analogously \( X_{m_i} \) describes the boundary of the \( m_i \)-th nested loop of a total of \( M_i \) loops in which \( S[Block(i)] \) is nested.
**Additional information to the SAD formula: Data Dependent control**
As we consider the parameter set \( \{X_1, X_2, X_3, X_4\} \) we notice the following:
\[ X_1 = \text{NN} \quad \text{----> Input} \]
\[ X_2 = \text{LOOP} \quad \text{----> Input} \]
\[ X_3 = \text{function of N:=f(N) \quad \text{----> N :-----Input}} \]
\[ X_4 = \text{function of a function of N: = g(f(N))} \quad \text{N:-----Input} \]
So as was stated above: every parameter in the SAD expression depends on the input in a simple or less trivial manner.
Given a specific input set all parameters can exactly be calculated if the functions \( f \) and \( g \) are relatively simple. In the case of the example above some algebraic effort can determine the forms of the two functions \( f \) and \( g \). As an example we’ll derive the form for \( f \):
From the program shown above we note that the loop boundary that \( X_3 \) describes depends on a function which we call \( F \). This function has the following form when it acts on its argument \( II \) (double I not Pi).
\[ F(II) = \left\lfloor \frac{II}{2} \right\rfloor \]
Where the floor function acting on argument $a : \lfloor a \rfloor$ means: return the truncation of the real value $a$. So $\lfloor 1.5 \rfloor = 1$, $\lfloor 2 \rfloor = 2$ etc.....
Further analysis by hand shows that the value of $X_j$ which depends on the initial value of $II (= N)$ can be calculated using the condition:
$$\begin{cases}
F^m(II) > 1 \\
F^{m+1}(II) \leq 1
\end{cases}$$
where $F^m = F^{m-1}(F)$ and $m$ is integer
The value of $m$ that satisfies the above condition is $m = \lfloor \log_2(N) \rfloor = f(N)$.
Analogously such types of dependency analyses can be performed for all parameters that have no direct correspondence with an input parameter. Of course very often the back tracing of such control flow dependencies will turn out to be execution in reverse order of the program. That is what we do not want. How to circumvent such problems is part of work to be done in PARASOL II.
**Mathematical manipulations of the SAD formula**
Now several possible reduction/compression techniques on the SAD formula will be discussed.
A Simplify action:
Generally the SAD expression for an arbitrary statement block $S[Block]$ is a cumulation of all the atomic time consumptions in the block. What a Simplify action (such as offered by the mathematical manipulation package Mathematica) does is accumulating the times in the expression of the same name. Example:
$$S[Block] = T_1 + T_2 + T_1 + T_1$$
Simplify[$S[Block]$] → $3T_1 + T_2$
and for a general expression we can write
$$S[Block] = T_1 + T_1 + T_1 + \ldots + T_1$$
Simplify[$S[Block]$] → $\sum_i \alpha_i T_i$
where $T_i, T_j, T_k$ etc.... denote the various atomic machineparameters.
On control level: Suppose you have an expression
$$P_1 * S[Block(i)] + P_2 * S[Block(j)]$$
where
$$S[Block(i)] = \sum_i \alpha_i T_i$$
$$S[Block(j)] = \sum_j \beta_j T_j$$
and these statement blocks -although not related in any manner-turn out to satisfy the condition that the difference in their explicit time complexities is less than some small
value $\varepsilon$, then one can compress the total expression to a form in which only one statement block describing the time complexities of both original blocks remains:
$$\text{if: } \sum_j \beta_j T_j - \sum_i \alpha_i T_i < \varepsilon \Rightarrow (p_1 + p_2) S[\text{Block}(i, j)]$$
Another example of a possible reduction: given two statement blocks that are added together; contraction of the prefactors of the atomic times is another compression/reduction step:
$$S[\text{Block}(j)] + S[\text{Block}(i)] = \sum_i \beta_i T_i + \sum_i \alpha_i T_i \rightarrow \sum_i (\alpha_i + \beta_i) T_i$$
Or suppose the expression below arises:
$$X \ast S[\text{Block}(j)] + S[\text{Block}(i)]$$
When during simulations in PARASOL II $X$ turns out not to be affected significantly by fluctuations $\delta \bar{I}$ of the input vector $\bar{I}$. Then the variable nature of $X$ can be omitted and replaced by a constant. Consecutively one of the reduction techniques that are mentioned above can be used to reduce the expression further.
|
{"Source-Url": "https://pure.uva.nl/ws/files/2078625/25752_Sloot40SAD.pdf", "len_cl100k_base": 6649, "olmocr-version": "0.1.50", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 34257, "total-output-tokens": 7581, "length": "2e12", "weborganizer": {"__label__adult": 0.00030350685119628906, "__label__art_design": 0.0003864765167236328, "__label__crime_law": 0.00031256675720214844, "__label__education_jobs": 0.0007987022399902344, "__label__entertainment": 8.958578109741211e-05, "__label__fashion_beauty": 0.0001634359359741211, "__label__finance_business": 0.00026035308837890625, "__label__food_dining": 0.00037598609924316406, "__label__games": 0.0005235671997070312, "__label__hardware": 0.0013332366943359375, "__label__health": 0.0004787445068359375, "__label__history": 0.0003304481506347656, "__label__home_hobbies": 0.0001347064971923828, "__label__industrial": 0.000732421875, "__label__literature": 0.000293731689453125, "__label__politics": 0.00027060508728027344, "__label__religion": 0.0005207061767578125, "__label__science_tech": 0.1029052734375, "__label__social_life": 0.00010865926742553712, "__label__software": 0.0096893310546875, "__label__software_dev": 0.87890625, "__label__sports_fitness": 0.00035119056701660156, "__label__transportation": 0.0005970001220703125, "__label__travel": 0.00021028518676757812}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28579, 0.02789]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28579, 0.77499]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28579, 0.86668]], "google_gemma-3-12b-it_contains_pii": [[0, 1212, false], [1212, 1493, null], [1493, 1712, null], [1712, 2825, null], [2825, 6339, null], [6339, 9722, null], [9722, 12115, null], [12115, 14259, null], [14259, 16463, null], [16463, 19750, null], [19750, 20750, null], [20750, 22590, null], [22590, 25509, null], [25509, 27538, null], [27538, 28579, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1212, true], [1212, 1493, null], [1493, 1712, null], [1712, 2825, null], [2825, 6339, null], [6339, 9722, null], [9722, 12115, null], [12115, 14259, null], [14259, 16463, null], [16463, 19750, null], [19750, 20750, null], [20750, 22590, null], [22590, 25509, null], [25509, 27538, null], [27538, 28579, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28579, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28579, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28579, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28579, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28579, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28579, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28579, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28579, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28579, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28579, null]], "pdf_page_numbers": [[0, 1212, 1], [1212, 1493, 2], [1493, 1712, 3], [1712, 2825, 4], [2825, 6339, 5], [6339, 9722, 6], [9722, 12115, 7], [12115, 14259, 8], [14259, 16463, 9], [16463, 19750, 10], [19750, 20750, 11], [20750, 22590, 12], [22590, 25509, 13], [25509, 27538, 14], [27538, 28579, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28579, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-03
|
2024-12-03
|
c2459017b2044b4cbb0977f0e3f2379129446610
|
Natural Language Processing and Program Analysis for Supporting Todo Comments as Software Evolves
Pengyu Nie, Junyi Jessy Li, Sarfraz Khurshid, Raymond Mooney, and Milos Gligoric
The University of Texas at Austin
{pynie@, jessy@austin., khurshid@ece., mooney@cs., gligoric@}utexas.edu
Abstract
Natural language elements (e.g., API comments, todo comments) form a substantial part of software repositories. While developers routinely use many natural language elements (e.g., todo comments) for communication, the semantic content of these elements is often neglected by software engineering techniques and tools. Additionally, as software evolves and development teams re-organize, these natural language elements are frequently forgotten, or just become outdated, imprecise and irrelevant.
We envision several techniques, which combine natural language processing and program analysis, to help developers maintain their todo comments. Specifically, we propose techniques to synthesize code from comments, make comments executable, answer questions in comments, improve comment quality, and detect dangling comments.
Introduction
Natural language elements form a substantial part of software repositories. These elements are used to communicate between users and developers (e.g., API comments, bug reports, and feature requests), and among developers (e.g., todo comments). Todo comments contain invaluable data that describe changes to code that can increase software maintenance, reliability, and quality. Despite occurring frequently in practice and containing valuable information, these elements, because of their informal nature, are largely not exploited by existing software engineering tools.
Research on combining program analysis and natural language processing (NLP), which recently started to gain some traction, is in its infancy (Ernst 2017; Arnaoudova et al. 2015; Hindle et al. 2012; Oda et al. 2015; Allamanis, Peng, and Sutton 2016; Vasi1escu, Casalnuovo, and Devanbu 2017; Raychev, Vechev, and Krause 2015; Nguyen et al. 2012), and the existing work, although novel, mostly neglected comments that are used to communicate among the developers (Storey et al. 2008; Sridhara 2016).
In this position paper, we argue about the importance of content in todo comments and envision several techniques to automatically maintain and resolve those comments.
This position paper is a large extent inspired by our extensive analysis of a large corpus of open-source projects. Specifically, we analyzed over 30k open-source projects, which are available on GitHub, totaling 585 million lines of code (not counting comments). We found that these projects include over 297 million lines of comments (~30% of the total lines). Our analysis also uncovered more than 700k todo comments in the used corpus. We manually inspected (and discussed) hundreds of comments, code and comment changes, and commit messages. In the following subsections, we will frequently refer to this dataset and our findings related to this dataset. All examples of code and comments that we provide in this paper are taken from one of the analyzed open-source projects.
This paper mostly focuses on todo comments that contain valuable information on increasing software quality, performance, maintenance, and reliability. We consider the following three categories of todo comments. First, task comments explain what features are currently not supported or what optimizations need to be implemented (e.g., from the Google Guava project: “For optimal performance, use a binary search when targets.size() < size()/log(size())”). Second, trigger-action comments talk about changes to the code repository that would be necessary if something else is modified by developers (e.g., from Guava: “check more preconditions (as bufferSize > chunkSize) if this is ever public”). Finally, question comments are concerned with alternative implementations, potential optimizations, and testing, which may be explored by developers only if time permits (e.g., from Guava: “Is this faster than System.arraycopy() for small arrays?”).
Regardless of the category of todo comments, as software evolves and development teams re-organize, these comments may be dangling, i.e., resolved but forgotten (Storey et al. 2008; Sridhara 2016). For example, a trigger may hold (e.g., “if this is ever public”) but the action may not be executed by developers (for very long time or ever), and developers may never have enough time to consider alternative algorithms and fine tune their existing implementations.
With the goal to help developers increase the reliability of their software, we propose several techniques to (1) synthesize code described in task comments, (2) make trigger-action comments executable, (3) answer question comments, (4) improve the quality of all todo comments, and (5) automatically detect dangling comments.
Copyright © 2018, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved.
protected AbstractStreamingHasher(int chunkSize, int bufferSize) {
// TODO(kevinb): check more preconditions (as bufferSize >> chunkSize)
if (T
checkArgument(bufferSize > chunkSize);
checkArgument(bufferSize \% chunkSize == 0); ... }
(a) Example from Google Guava (AbstractStreamingHasher)
public void testDynamicAttributesSupport() throws Exception {
dispatcher.serviceAction(request, response, mapping);
// TODO: remove expectedJDK15 and if() after switching to Java 1.6
if (TRIGIT.getJavaVersion() > 5,
TRIGIT.DELETE_NEXT, TRIGIT.VAR_DECL;
String expectedJDK15 = " <input type=" text">; ...
String expectedJDK16 = " <input type=" text">; ...
}
(b) Example from Apache Struts (FreemarkerResultMockedTest)
Figure 1: Examples of trigger-action comments from open-source projects; we show how the existing comments (crossed out) can be encoded as executable statements in our TRIGIT framework (highlighted code)
Techniques
This section describes the basic idea behind each technique and the way we will approach the implementation.
Synthesizing Error-Reporting Code
We plan to develop lightweight synthesis techniques to generate error-reporting code for unsupported cases that are documented by developers in the task comments (e.g., from Guava: "support array types"). First, we will identify comments that document unsupported cases. To this end, we will explore possible supervision signals from resolved comments and their corresponding code changes, crowdsourcing annotation and semantic parsing of the comments. Second, we will synthesize error-reporting code that follows the style used in the codebase (e.g., throw an exception or return a special value from a function). Note that our goal is not to work on full-blown program synthesis, which would be interesting but challenging (e.g., Polikarpova, Kuraj, and Solar-Lezama (2016)), but rather to focus on a specific domain of error-reporting. Basically, our goal is to make the existing comments observable during program execution by reporting an appropriate message for unsupported cases.
Extracting Executable Comments
We will develop techniques to help software engineers to encode their trigger-action comments as executable code statements. This will help with repository maintenance, because developers will not need to manually check their todo comments; instead, the executable statements will be automatically triggered when appropriate.
We show several examples of trigger-action comments in Table 1 (the top half). We found that ~10% of all todo comments (in our corpus) belong to this comment category. While it would be infeasible to support every comment written in the trigger-action style, we plan to focus on those tasks that update the codebase (e.g., transformations of abstract syntax trees) when triggers are satisfied.
Our initial step is to develop a domain specific language embedded in Java to be used to: (1) query the static features of the codebase, e.g., required Java version, and (2) specify code transformations, e.g., remove a method from a class. Figure 1 shows two examples of trigger-action comments encoded in our framework (named TRIGIT); the original todo comments are crossed out and the statements for our framework are highlighted.
In the first example, we use our framework to check a modifier of the current method; if the method becomes public, the code guarded by the trigger should become a part of the compiled class. In the second example, we specify that a variable should be removed if the required Java version is higher than 1.5; the required Java version can be obtained from a build script. (Note that the statements/expressions that use the variables need to be annotated too, but we do not show this due to space limitations.) The evaluation of the triggers will be done statically (once code is compiled), as the queries should not depend on the dynamic behavior of the program. Our tool, which can be implemented as a compiler plugin, will automatically remove the triggers and perform program transformations. Note that the user would still be able to inspect/approve the changes (e.g., by executing git diff). As the transformation engine we will use the existing open-source platforms, e.g., Eclipse, or program transformation systems, e.g., Cordy et al. (2004). The language design will be guided by examples, and we will evolve the language to support cases that we encounter in the future.
Our second step is to automatically discover trigger-action comments present in a codebase and recover the corresponding triggers and actions via mining explicit condition relations within the content of the todo comments; explicit discourse relations can be classified with adequate accuracy (Pitler et al. 2008).
In the third step, we will develop automated migration from comments to the TRIGIT specifications, which will follow our recent work on language to code for if-this-then-that (IFTTT) recipes (Quirk, Mooney, and Galley 2015). Specifically, we will train a semantic parser to map trigger-action comments into executable code using supervision automatically extracted from the code changes made when a todo comment is resolved. This supervision may be noisy, since not all code changes may be directly related to resolving the todo comment, but our previous work on IFTTT shows that noisy, automatically extracted supervision from pairing comments and code can be tolerated reasonably well.
Answering Questions From Comments
We will develop techniques to help software engineers to make informed decisions about questions that are asked in todo comments. In our preliminary studies, we discovered that developers ask questions in todo comments more than 10% of the time; we obtained this number by counting todo comments that contain "?". Some of these questions are shown in Table 1 (the bottom half). Many of the questions are related to code optimization, program transformation, or testing. Our plan is to focus on techniques that will address these three types of questions. First, to answer questions related to optimizations, we will extract suggested
code modifications from comments, apply those modifications and profile the code (by executing existing test suites) and evaluate the performance with profiles (on various machines). Second, to answer questions related to tests, we will develop techniques that extract test inputs from a question and generate new tests with those inputs; these new tests will be obtained by adjusting an automated test generation tool (e.g., Randoop (Pacheco et al. 2007)) or by extending existing (manually written) tests. Third, to answer questions related to code structure, we will extract suggested changes (from Guava: “Add getters returning rowKeyToIndex and columnKeyToIndex.”), perform the changes, and measure quality of code in terms of naturalness (Hindle et al. 2012).
Our question classification system will also learn from how todo comments are answered as software evolves (e.g., files and functions that are modified and language artifacts that are added or edited); we can also learn from actions taken by developers. As some of the questions may be open-ended, we plan to develop an interactive dialog interface, which we recently used for language to code translation (Chaurasia and Mooney 2017). We plan to use dialog systems to clarify user intent and gather information—in our case, when a question is initially asked.
### Improving Todo Comments
We will develop techniques to help software engineers to write meaningful todo comments. While manually analyzing hundreds of todo comments, we found a number of comments that were hard to understand even if we read the code near those comments. We were also in disagreement about their meaning in several cases, and although we could understand a comment (e.g., from the Square Retrofit project: “TODO non-suck message”), it was clear that any technique would have a hard time to extract any useful data.
Our initial task will be to detect todo comments that are not specific enough, as well as those comments that do not follow the conventions already used in the same project. The techniques that we will develop will build on our work on text specificity (Li and Nenkova 2015) and program analysis. When we detect an unspecific comment, we will either notify a developer to provide additional clarification, highlight a part of the comment that does not follow the style (in a similar way that spellcheckers highlight typos in comments inside IDEs), or automatically reformat the comment to be consistent with other comments in the same repository. We will also provide automated comment style checkers, where the rules can be expressed by developers; this is similar to code style checkers, which are used in practice. Having specific comments that follow the same style will enable techniques from prior sections.
### Detecting Dangling Todo Comments
Prior work has shown that developers may resolve todo comments but forget to remove these comments from source code (Storey et al. 2008; Sridhara 2016); these dangling comments can waste developers’ time during program comprehension and maintenance.
We are working on a technique, based on machine learning, to automatically detect dangling todo comments. Our detection technique learns from existing software repositories. As mentioned earlier, we have already collected more than 700k todo comments. This large dataset provides examples for todo comments that were removed by developers (over 20k). We are using these examples as distant supervision signals, where we are exploring automatic labeling of examples (e.g., todo comments that are in the same file with removed todo comments). Our models are exploiting commit messages and static code analysis of changes. In the future, we plan to also utilize software histories to extract necessary context when todo comments were introduced. We will also reason about co-evolution of code and comments from when a todo comment was introduced until
<table>
<thead>
<tr>
<th>Project (on GitHub)</th>
<th>File (.java)</th>
<th>Todo Comments</th>
</tr>
</thead>
<tbody>
<tr>
<td>Apache/Incubator-wave</td>
<td>Pretty</td>
<td>Remove this if it implements getAttributes</td>
</tr>
<tr>
<td>Apache/Struts</td>
<td>FreemakerResultMockedTest</td>
<td>Remove expected/ok16 and xif() after switching Java 1.6</td>
</tr>
<tr>
<td>Apache/Poi</td>
<td>TextXSSBugs</td>
<td>Delete this test case when HR0008B and VAK are implemented</td>
</tr>
<tr>
<td>Google/Guiava</td>
<td>Types</td>
<td>Once we are on Java 8, delete this abstraction</td>
</tr>
<tr>
<td>Google/Guiava</td>
<td>AbstractStreamingHasher</td>
<td>Check preconditions (as bufferSize >= chunkSize) if this is ever public</td>
</tr>
<tr>
<td>Google/Guiava</td>
<td>MapTest</td>
<td>Replace with Ascii.caseInsensitiveEquivalence() if it exists</td>
</tr>
<tr>
<td>Jaxp</td>
<td>NodeSet</td>
<td>If deprecated constructors are removed, this should always be available</td>
</tr>
<tr>
<td>Trigger-action</td>
<td>引入</td>
<td>We will also reason about co-evolution of code and comments from when a todo comment was introduced until</td>
</tr>
</tbody>
</table>
### Table 1: Example todo comments in open-source projects
<table>
<thead>
<tr>
<th>Project (on GitHub)</th>
<th>File (.java)</th>
<th>Todo Comments</th>
</tr>
</thead>
<tbody>
<tr>
<td>Andyglick/Hk2-fork</td>
<td>AbstractRepositoryImpl</td>
<td>Is it allowed to call the initialize method multiple times?</td>
</tr>
<tr>
<td>Apache/Net</td>
<td>IMAPReply</td>
<td>Would looking() be more efficient? If so, then drop trailing * from patterns</td>
</tr>
<tr>
<td>Google/Guiava</td>
<td>ArrayTable</td>
<td>Add getters returning roKeyToIndex and columnKeyToIndex?</td>
</tr>
<tr>
<td>Google/Guiava</td>
<td>EvictingQueue</td>
<td>Do we want to checkForNull each element in containsAll and retainAll?</td>
</tr>
<tr>
<td>Eclipse/CDT</td>
<td>L1vmEnvironmentVariableSupplier</td>
<td>Is this actually called anywhere?</td>
</tr>
<tr>
<td>Eclipse/CDT</td>
<td>EvalBinary</td>
<td>What if the composite being accessed is not an array but a structure?</td>
</tr>
<tr>
<td>Eclipse/Mwce</td>
<td>PluginExtensionManager</td>
<td>Test: what happens when a handler is not there? Exception?</td>
</tr>
<tr>
<td>Morristech/Gwt</td>
<td>NodeList</td>
<td>What happens if index is out of range?</td>
</tr>
<tr>
<td>Morristech/Gwt</td>
<td>AbstractFilters</td>
<td>Test case for empty continuation header?</td>
</tr>
<tr>
<td>Morristech/Gwt</td>
<td>Simplifier</td>
<td>If the AST were normalized, we wouldn’t need this</td>
</tr>
</tbody>
</table>
...
it was resolved by a developer. Specifically, for each code change, we will compute its distance from todo comments, word similarity with each comment, and code structure that may be described in a comment. These sources of information provide complementary views to feature development and complementary models, so we plan to build on our prior work in co-training and ensemble models.
Related Work
Li et al. (2006) used text classification to validate the representativeness of their study of bug characteristics. Fluri, Wursch, and Gall (2007) empirically showed that code and comments frequently co-evolve. Padioleau, Tan, and Zhou (2009) manually studied over one thousand comments, and found that 50% of comments can be leveraged by various techniques. Haouari, Sahraoui, and Langlais (2011) introduced a taxonomy of comments and found that todo comments are the second most common type of comments. Movshovitz-Attias and Cohen (2013) used topic modeling and language models to generate comments from Java source files. Several work tackled automated generation of commit messages and mining relation from commit messages (Linares-Vásquez et al. 2015; Jiang and McMillan 2017; Andersson, Ericsson, and Wingkvist 2014; Loyola, Marrese-Taylor, and Matsuo 2017).
Tan et al. (2007) detected inconsistencies between code and comments and proposed a technique to test Javadoc comments. Zhong et al. (2011) developed a technique to infer specification from natural language API documentation and used it to detect issues in client code.
Conclusion
We argued that comments used to communicate among developers (todo comments) contain invaluable content that is currently neglected. We described several techniques – synthesizing code from comments, making comments executable, answering questions in comments, improving comment quality, and detecting dangling comments. These techniques, based on natural language processing and program analysis, have potential to substantially simplify software maintenance and increase software reliability.
Acknowledgments
We thank Rishabh Rai for the initial discussion on this work. This work was partially supported by the US National Science Foundation under Grant No. CCF-1704790.
References
Andersson, R.; Ericsson, M.; and Wingkvist, A. 2014. Mining relations from Git commit messages: An experience report. In SLTC.
Chaurasia, S., and Mooney, R. 2017. Dialog for language to code. In IJCNLP.
Ernst, M. D. 2017. Natural language is a programming language: Applying natural language processing to software development. In SNAPL, volume 71.
Haouari, D.; Sahraoui, H.; and Langlais, P. 2011. How good is your comment? A study of comments in Java programs. In ESEM.
Li, J. J., and Nenkova, A. 2015. Fast and accurate prediction of sentence specificity. In AAAI.
Loyola, P.; Marrese-Taylor, E.; and Matsuo, Y. 2017. A neural architecture for generating natural language descriptions from source code changes. In ACL.
Padioleau, Y.; Tan, L.; and Zhou, Y. 2009. Listening to programmers’ taxonomies and characteristics of comments in operating system code. In ICSE.
Polikarpova, N.; Kuraj, I.; and Solar-Lezama, A. 2016. Program synthesis from polymorphic refinement types. In PLDI.
Quirk, C.; Mooney, R.; and Galley, M. 2015. Language to code: Learning semantic parsers for if-this-then-that recipes. In ACL.
Raychev, V.; Vechev, M.; and Krause, A. 2015. Predicting program properties from ”Big Code”. In POPL.
Sridhara, G. 2016. Automatically detecting the up-to-date status of ToDo comments in Java programs. In ISEC.
Storey, M.-A.; Ryall, J.; Bull, R. I.; Myers, D.; and Singer, J. 2008. TODO or to bug. In ICSE.
Tan, L.; Yuan, D.; Krishna, G.; and Zhou, Y. 2007. /*iComment: Bugs or bad comments?*/. In SOSPI.
Vasilescu, B.; Casalnuovo, C.; and Devanbu, P. T. 2017. Recovering clear, natural identifiers from obfuscated JS names. In FSE.
|
{"Source-Url": "http://www.cs.utexas.edu/~ai-lab/downloadPublication.php?filename=http%3A%2F%2Fwww.cs.utexas.edu%2Fusers%2Fml%2Fpapers%2Fnie.nlse18.pdf&pubid=127683", "len_cl100k_base": 4825, "olmocr-version": "0.1.53", "pdf-total-pages": 4, "total-fallback-pages": 0, "total-input-tokens": 13685, "total-output-tokens": 5490, "length": "2e12", "weborganizer": {"__label__adult": 0.0003783702850341797, "__label__art_design": 0.00020647048950195312, "__label__crime_law": 0.0003173351287841797, "__label__education_jobs": 0.0006232261657714844, "__label__entertainment": 4.756450653076172e-05, "__label__fashion_beauty": 0.00014781951904296875, "__label__finance_business": 0.0001589059829711914, "__label__food_dining": 0.0002663135528564453, "__label__games": 0.0003843307495117187, "__label__hardware": 0.0004634857177734375, "__label__health": 0.0003407001495361328, "__label__history": 0.00012022256851196288, "__label__home_hobbies": 6.03795051574707e-05, "__label__industrial": 0.00020229816436767575, "__label__literature": 0.0002307891845703125, "__label__politics": 0.0002193450927734375, "__label__religion": 0.0003504753112792969, "__label__science_tech": 0.0024890899658203125, "__label__social_life": 9.429454803466796e-05, "__label__software": 0.003643035888671875, "__label__software_dev": 0.98828125, "__label__sports_fitness": 0.0002484321594238281, "__label__transportation": 0.00035572052001953125, "__label__travel": 0.00015592575073242188}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22928, 0.01487]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22928, 0.44978]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22928, 0.8716]], "google_gemma-3-12b-it_contains_pii": [[0, 5009, false], [5009, 11164, null], [11164, 17087, null], [17087, 22928, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5009, true], [5009, 11164, null], [11164, 17087, null], [17087, 22928, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 22928, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22928, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22928, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22928, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 22928, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22928, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22928, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22928, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22928, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22928, null]], "pdf_page_numbers": [[0, 5009, 1], [5009, 11164, 2], [11164, 17087, 3], [17087, 22928, 4]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22928, 0.19298]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
757d9ef2b7701f2ca58062480cce51249fe0c435
|
[REMOVED]
|
{"len_cl100k_base": 5192, "olmocr-version": "0.1.53", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 24568, "total-output-tokens": 7104, "length": "2e12", "weborganizer": {"__label__adult": 0.0003452301025390625, "__label__art_design": 0.0014657974243164062, "__label__crime_law": 0.0004954338073730469, "__label__education_jobs": 0.01073455810546875, "__label__entertainment": 0.0003705024719238281, "__label__fashion_beauty": 0.0001850128173828125, "__label__finance_business": 0.0032176971435546875, "__label__food_dining": 0.0003426074981689453, "__label__games": 0.0007381439208984375, "__label__hardware": 0.0017910003662109375, "__label__health": 0.0006375312805175781, "__label__history": 0.0006771087646484375, "__label__home_hobbies": 0.00018787384033203125, "__label__industrial": 0.0006127357482910156, "__label__literature": 0.0012731552124023438, "__label__politics": 0.00029277801513671875, "__label__religion": 0.0004696846008300781, "__label__science_tech": 0.327392578125, "__label__social_life": 0.0002853870391845703, "__label__software": 0.301513671875, "__label__software_dev": 0.345703125, "__label__sports_fitness": 0.00022101402282714844, "__label__transportation": 0.0005693435668945312, "__label__travel": 0.0003006458282470703}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27898, 0.04302]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27898, 0.61464]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27898, 0.88493]], "google_gemma-3-12b-it_contains_pii": [[0, 2859, false], [2859, 6299, null], [6299, 9818, null], [9818, 13218, null], [13218, 14516, null], [14516, 16836, null], [16836, 18739, null], [18739, 19547, null], [19547, 22840, null], [22840, 26118, null], [26118, 27898, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2859, true], [2859, 6299, null], [6299, 9818, null], [9818, 13218, null], [13218, 14516, null], [14516, 16836, null], [16836, 18739, null], [18739, 19547, null], [19547, 22840, null], [22840, 26118, null], [26118, 27898, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27898, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27898, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27898, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27898, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27898, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27898, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27898, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27898, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27898, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27898, null]], "pdf_page_numbers": [[0, 2859, 1], [2859, 6299, 2], [6299, 9818, 3], [9818, 13218, 4], [13218, 14516, 5], [14516, 16836, 6], [16836, 18739, 7], [18739, 19547, 8], [19547, 22840, 9], [22840, 26118, 10], [26118, 27898, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27898, 0.03472]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
b5ef10994eb23beacb7f727fc08f2f55b1968de0
|
Tutorial: Probabilistic Model Checking
Dave Parker
“Scalable Analysis of Probabilistic Models and Programs”
Dagstuhl, June 2023
Probabilistic model checking (PMC)
System
High-level model/design
System requirements
Specification (temporal logic)
Probabilistic model checker
Result
Probabilistic model
Probabilistic model checking
Parameters + data → Probabilistic model
Probabilistic model checker
P_{≥0.999} [ F_{≤20} goal ] → Numerical results (“guarantees”)
Result
Strategies/policies/controllers
Overview
- Probabilistic models
- Temporal logic
- a language for quantitative guarantees
- Techniques, tools & languages
- Multi-agent verification
- stochastic multi-player games
Probabilistic models
Probabilistic models
• **Discrete–time Markov chains (DTMCs)**
– finite state space + discrete probabilities
• **Markov decision processes (MDPs)**
– DTMCs + **nondeterminism**
– policies (or strategies) resolve actions based on history
• **Models for PMC:**
– mostly finite–state
– mostly known in full
Models, models, models…
• **Wide range of probabilistic models**
discrete states & probabilities: **Markov chains**
+ nondeterminism: **Markov decision processes** (MDPs)
+ real–time clocks: **probabilistic timed automata** (PTAs)
+ uncertainty: **interval MDPs** (IMDPs)
+ partial observability: **partially observable MDPs** (POMDPs)
+ multiple players: *(turn–based)* **stochastic games**
+ concurrency: **concurrent stochastic games**
• **And many others**
– continuous–time Markov chains
– **Markov automata**
– stochastic timed/hybrid automata
– …
Temporal logic
Temporal logic
• **Formal specification of desired/required behaviour**
– formal language for quantitative guarantees
• **Simple examples (PCTL)**
– Probabilistic reachability
\[ P \geq 0.7 \ [ F \text{ goal}_1 ] \]
\[ P \geq 0.6 \ [ F \leq 10 \text{ goal}_1 ] \]
– Probabilistic safety/invariance
\[ P \geq 0.99 \ [ G \neg \text{hazard} ] \]
– Numerical queries
\[ P =? \ [ F \text{ goal}_1 ] \]
\[ P_{\max} =? \ [ F \text{ goal}_1 ] \]
• **Extensions**
– richer temporal specs (LTL), costs/rewards, multi-objective, ...
Linear temporal logic (LTL)
• **LTL (linear temporal logic) syntax:**
$\psi ::= \text{true} | a | \psi \land \psi | \neg \psi | X \psi | \psi U \psi | F \psi | G \psi$
• **Propositional logic + temporal operators:**
– $a$ is an atomic proposition (labelling a state)
– $X \psi$ means "$\psi$ is true in the next state"
– $F \psi$ means “$\psi$ is eventually true”
– $G \psi$ means “$\psi$ always remains true”
– $\psi_1 U \psi_2$ means "$\psi_2$ is true eventually and $\psi_1$ is true until then”
• **Common alternative notation:**
– $\bigcirc$ (next), $\Diamond$ (eventually), $\square$ (always), $U$ (until)
Linear temporal logic (LTL)
- **LTL (linear temporal logic) syntax:**
\[ \psi ::= \text{true} \mid a \mid \psi \land \psi \mid \neg \psi \mid X \psi \mid \psi U \psi \mid F \psi \mid G \psi \]
- **Commonly used LTL formulae:**
- \( G (a \rightarrow F b) \) – "b always eventually follows a"
- \( G (a \rightarrow X b) \) – "b always immediately follows a"
- \( G F a \) – "a is true infinitely often"
- \( F G a \) – "a becomes true and remains true forever"
- **Example: robot task specifications in LTL**
- e.g. \( P_{>0.7} [ (G \neg \text{hazard}) \land (GF \text{goal}_1) ] \) – "the probability of avoiding hazard and visiting goal\(_1\) infinitely often is > 0.7"
- e.g. \( P_{\text{max}=?} [ \neg \text{zone}_3 U (\text{zone}_1 \land (F \text{zone}_4)) ] \) – "max. probability of patrolling zone 1 (whilst avoiding zone 3) then zone 4?"
Temporal logic
- **Benefits of temporal logic**
- unambiguous, flexible, tractable behavioural specification
- broad range of quantitative properties expressible
- (probabilistic) guarantees on safety, performance, etc.
- meaningful properties: event probabilities, time, energy,…
\[ P_{>0.7} \left[ (G\neg\text{hazard}) \land (GF \text{ goal}_1) \right] \]
- (c.f. ad-hoc reward structures, e.g. with discounting)
- caveat: accuracy of model (and its solution)
- efficient LTL-to-automata translation
- optimal (finite-memory) policy synthesis (via product MDP)
- correctness monitoring / shielding
- task progress metrics
LTL & automata
• Safe/co-safe LTL: (deterministic) finite automata
– (non-)satisfaction occurs in finite time
– \( \neg \text{zone}_3 \cup (\text{zone}_1 \land (F \text{zone}_4)) \)
• Full LTL: e.g. (det.) Rabin/Buchi automata
– \( G\neg \text{hazard} \land GF \text{goal}_1 \)
• Other useful LTL subclasses
– GR(1), LTL\GU, …
LTL model checking via product MDP
\[
M \otimes A_{\psi}
\]
\[
\psi = G\neg h \land GF g_1
\]
LTL model checking via product MDP
\[ M \otimes A_\psi \]
\[ \psi = G\neg h \land GF g_1 \]
Costs & Rewards
• Costs & rewards
– i.e., values assigned to model states or transitions
• Temporal logic examples
– $R^{\text{energy}}_{\min=\infty} [ F \text{ goal } ]$ – minimise the expected energy consumption until the goal is reached
– $R^{\text{hazard}}_{\leq 1.5} [ C^{\leq 20} ]$ – the expected number of times that the robot enters the hazard location within 20 steps is at most 1.5
– $R^{\text{time}}_{\min=\infty} [ \neg \text{zone}_3 U (\text{zone}_1 \land (F \text{ zone}_4)) ]$ – minimise expected time to patrol zones 1 then 4, without passing through 3
• Notes:
1. mostly use the $R$ (reward) operator, even for costs
2. discounted rewards are more rarely used in this context
More temporal logic
• **Multi-objective queries**
– e.g. $\langle\langle*\rangle\rangle(\ P_{\text{max}}=? \ [ GF \ \text{goal}_1 \ ], \ P_{\geq 0.7} \ [ G \ \neg\text{hazard} \ ])$
– max. objective 1 subject to constrained objective 2
– also: achievability & Pareto queries
• **Nested (branching–time) queries**
– e.g. $R_{\text{min}}=? [\ P_{\geq 0.99} \ [ F^{\leq 10} \ \text{base} \ ] \ U \ (\text{zone}_1 \ \land \ (F \ \text{zone}_4))]$
– "minimise expected time to visit zones 1 then 4, whilst (initially) ensuring the base can always be reliably reached"
• **And more**
– cost–bounded, conditional probabilities, quantiles
– metric temporal logic, signal temporal logic
– …
Multi-objective specifications
- **Achievability query**
- $P_{\geq 0.7} [\text{G } \neg \text{hazard}] \land P_{\geq 0.2} [\text{GF goal}_1]$?
- **Numerical query**
- $P_{\text{max}=?} [\text{GF goal}_1]$ such that $P_{\geq 0.7} [\text{G } \neg \text{hazard}]$?
- **Pareto query**
- for $P_{\text{max}=?} [\text{G } \neg \text{hazard}]$, $P_{\text{max}=?} [\text{GF goal}_1]$?
Techniques, tools & languages
Verification techniques
• **Probabilistic model checking techniques**
– automata + graph analysis + numerical solution
– often more focus on exhaustive/“exact”/optimal methods
– e.g., for MDPs: *value iteration* (VI), linear programming
• **Example (MDPs):**
– max. probability of reaching ✓
– values \( p(s) = \sup_\sigma \Pr_s^\sigma (F ✓) \)
are the least fixed point of:
\[
p(s) = \begin{cases}
1 & \text{if } s \models ✓ \\
\max_a \sum_{s'} \delta(s,a)(s') \cdot p(s') & \text{otherwise}
\end{cases}
\]
• **But: VI has known accuracy and convergence issues**
– interval iteration, sound VI, optimistic VI
– separate convergence from above and below
Scalability & efficiency
- **Scalability & efficiency** are always key challenges
- many approaches investigated...
- **Symbolic probabilistic model checking**
- i.e., (multi–terminal) binary decision diagrams
- **Model reductions**
- bisimulation minimisation
- abstraction + sound bounds (property driven)
- **Sampling (simulation) based methods**
- statistical model checking, PAC guarantees, heuristics, ...
- **Trade–off: scalability/efficiency vs. accuracy/guarantees**
- spectrum of “correctness” : exact, floating–point correct, ε–correct, probably ε–correct, often ε–correct
Probabilistic verification tools
• Probabilistic verification software
– PRISM (and PRISM-games), Storm, Modest toolset, ePMC
– general purpose probabilistic model checking tools
– wide range of models (Markov chains, (PO)MDPs, games), many temporal logics & solution techniques
• Also many other specialised tools…
– PET (partial exploration)
– FAUST², StocHy (continuous space/hybrid systems)
– MultiGain (multi-objective + mean payoff)
– Tempest (permissive + shielding)
– PAYNT (POMDPs + probabilistic programs)
– Prophesy (parametric techniques)
Modelling languages
- **Example formal modelling languages**
- **PRISM**: textual language, based on guarded commands
- **Modest**: expressive language for stochastic hybrid automata
- **Some key modelling language features**
- *nondeterministic + probabilistic* behaviour
- *compositional* model specifications
- components, parallel composition, communication
- *parameterised* models
- probabilities, sizes, components
PRISM modelling language
- PRISM modelling language
- de-facto standard for probabilistic model checkers
- key ingredients: modules, variables, guarded commands
- language features: nondeterminism + probability, parallel composition, costs/rewards, parameters
PRISM modelling language
- **PRISM modelling language**
- de-facto standard for probabilistic model checkers
- key ingredients: modules, variables, guarded commands
- language features: nondeterminism + probability, parallel composition, costs/rewards, parameters
---
Example (PRISM-games)
```plaintext
// Model type: concurrent stochastic game
player p1 user1 endplayer player p2 user2 endplayer
// Parameters
const int emax; const double q1; const double q2 = 0.9 * q1;
// Modules: users (senders) + channel
module user1
s1 : [0..1] init 0; // has player 1 sent?
e1 : [0..emax] init emax; // energy level of player 1
[w1] true -> (s1'=0); // wait
[t1] e1>0 -> (s1'=c' ? 0 : 1) & (e1'=e1-1); // transmit
endmodule
module user2 = user1 [ s1=s2, e1=e2, w1=w2, t1=t2 ] endmodule
module channel
c : bool init false; // is there a collision?
[t1,w2] true -> q1 : (c'=false) + (1-q1) : (c'=true); // only user 1 transmits
[w1,t2] true -> q1 : (c'=false) + (1-q1) : (c'=true); // only user 2 transmits
[t1,t2] true -> q2 : (c'=false) + (1-q2) : (c'=true); // both users transmit
endmodule
// Reward structures: energy usage
rewards "energy" [t1] true: 1.5; [t2] true: 1.2; endrewards
```
• **PRISM modelling language**
– de-facto standard for probabilistic model checkers
– key ingredients: *modules, variables, guarded commands*
– language features: *nondeterminism + probability, parallel composition, costs/rewards, parameters*
• **Quite simplistic, low-level**
– e.g., no control flow, functions, mostly finite variables, ...
• **But:**
– uniform language for many types of probabilistic model
– many translations exist from more expressive languages
– forces users to confront state space explosion?
– well suited to *symbolic* methods (NB: but not to simulation)
Modelling languages
• Example formal modelling languages
– **PRISM**: textual language, based on guarded commands
– **Modest**: expressive language for stochastic hybrid automata
• Some key modelling language features
– **nondeterministic + probabilistic** behaviour
– **compositional** model specifications
• components, parallel composition, communication
– **parameterised** models
• probabilities, sizes, components
• Challenges
– language/tool **interoperability**
• e.g., JANI (models), PPDDL (planning), HOAF (automata), tool APIs
– modelling **stochasticity/uncertainty**
• probabilistic programming languages?
Multi-agent verification
Verification with stochastic games
• How do we plan rigorously with…
– multiple autonomous agents acting concurrently
– competitive or collaborative behaviour between agents, possibly with differing/opposing goals
– e.g. security protocols, algorithms for distributed consensus, energy management, autonomous robotics, auctions
• Verification with stochastic multi-player games
– verification (and synthesis) of strategies that are robust in adversarial settings and stochastic environments
Stochastic multi-player games
- Stochastic multi-player games
- strategies + probability + multiple players
- for now: turn-based (player \(i\) controls states \(S_i\))
Markov decision processes (MDPs)
Turn-based stochastic games (TSGs)
Property specification: rPATL
- **rPATL** (reward probabilistic alternating temporal logic)
- branching-time temporal logic for stochastic games
- **CTL, extended with:**
- coalition operator $\langle\langle C \rangle\rangle$ of ATL
- probabilistic operator $P$ of PCTL
- generalised (expected) reward operator $R$ from PRISM
- **In short:**
- zero-sum, probabilistic reachability + expected total reward
- **Example:**
- $\langle\langle \{robot_1, robot_3\} \rangle\rangle \ P_{>0.99} [ F_{\leq 10} (goal_1 \lor goal_3) ]$
- “robots 1 and 3 have a strategy to ensure that the probability of reaching the goal location within 10 steps is >0.99, regardless of the strategies of other players”
Model checking rPATL
• Main task: checking individual P and R operators
– reduces to solving a (zero-sum) stochastic 2-player game
– e.g. max/min reachability probability: \( \sup_{\sigma_1} \inf_{\sigma_2} \Pr_{s_1, s_2} (F \checkmark) \)
– complexity: \( \text{NP} \cap \text{coNP} \) (if we omit some reward operators)
• We again use value iteration
– values \( p(s) \) are the least fixed point of:
\[
p(s) = \begin{cases}
1 & \text{if } s \models \checkmark \\
\max_a \sum_{s'} \delta(s, a)(s') \cdot p(s') & \text{if } s \not\models \checkmark \text{ and } s \in S_1 \\
\min_a \sum_{s'} \delta(s, a)(s') \cdot p(s') & \text{if } s \not\models \checkmark \text{ and } s \in S_2
\end{cases}
\]
– and more: graph-algorithms, sequences of fixed points, …
Applications
- Example application domains (PRISM–games)
- collective decision making and team formation protocols
- security: attack–defence trees; network protocols
- human–in–the–loop UAV mission planning
- autonomous urban driving
- self–adaptive software architectures
Concurrent stochastic games
• Motivation:
– more realistic model of components operating concurrently, making action choices without knowledge of others
Turn-based stochastic games (TSGs)
Concurrent stochastic games (CSGs)
CSG for 2 robots on a 3x1 grid
CSG for 2 robots on a 3x1 grid
Concurrent stochastic games
- **Concurrent stochastic games (CSGs)**
- players choose actions concurrently & independently
- jointly determines (probabilistic) successor state
- \( \delta : S \times (A_1 \cup \{\bot\}) \times \ldots \times (A_n \cup \{\bot\}) \rightarrow \text{Dist}(S) \)
- generalises turn–based stochastic games
- **We again use the logic rPATL for properties**
- **Same overall rPATL model checking algorithm [QEST’18]**
- key ingredient is now solving (zero–sum) 2–player CSGs
- this problem is in PSPACE
- note that optimal strategies are now randomised
We again use a value iteration based approach
- e.g. max/min reachability probabilities
- \( \sup_{\sigma_1} \inf_{\sigma_2} \Pr_s^{\sigma_1, \sigma_2} (F \checkmark) \) for all states \( s \)
- values \( p(s) \) are the least fixed point of:
\[
p(s) = \begin{cases}
1 & \text{if } s \vdash \checkmark \\
\text{val}(Z) & \text{if } s \nvdash \checkmark
\end{cases}
\]
- where \( Z \) is the matrix game with \( z_{ij} = \sum_s \delta(s,(a_i,b_j))(s') \cdot p(s') \)
So each iteration solves a matrix game for each state
- LP problem of size \(|A|\), where \( A = \) action set
Example: Future markets investor
• Example rPATL query:
– $\langle \langle \text{investor}_1, \text{investor}_2 \rangle \rangle R_{\text{max}}^{\text{profit}} = ?^2$ [ F finished$_{1,2}$ ]
– i.e. maximising joint profit
• Results: with (left) and without (right) fluctuations
– optimal (randomised) investment strategies synthesised
– CSG yields more realistic results (market has less power due to limited observation of investor strategies)
Equilibria-based properties
- **Motivation:**
- players/components may have distinct objectives but which are not directly opposing (non zero-sum)
- *We use Nash equilibria (NE)*
- no incentive for any player to unilaterally change strategy
- actually, we use $\epsilon$-NE, which always exist for CSGs
- a strategy profile $\sigma=(\sigma_1,\ldots,\sigma_n)$ for a CSG is an $\epsilon$-NE for state $s$ and objectives $X_1,\ldots,X_n$ iff:
- $\Pr_s \sigma (X_i) \geq \sup \{ \Pr_s \sigma' (X_i) \mid \sigma' = \sigma_{-i}[\sigma_i'] \text{ and } \sigma_i' \in \Sigma_i \} - \epsilon$ for all $i$
Social-welfare Nash equilibria
- **Key idea:** formulate model checking (strategy synthesis) in terms of social-welfare Nash equilibria (SWNE)
- these are NE which maximise the sum $E_s^\sigma (X_1) + \ldots E_s^\sigma (X_n)$
- i.e., optimise the players combined goal
- **We extend rPATL accordingly**
**Zero-sum properties**
$\langle\langle \text{robot}_1 \rangle\rangle_{\max} = ? \ P [ F^{\leq k} \ \text{goal}_1 ]$
**Equilibria-based properties**
$\langle\langle \text{robot}_1: \text{robot}_2 \rangle\rangle_{\max} = ?$
$(P [ F^{\leq k} \ \text{goal}_1 ] + P [ F^{\leq k} \ \text{goal}_2 ])$
find a robot 1 strategy which maximises the probability of it reaching its goal, regardless of robot 2
find (SWNE) strategies for robots 1 and 2 where there is no incentive to change actions and which maximise joint goal probability
Model checking for extended rPATL
- Model checking for CSGs with equilibria
- first: 2–coalition case [FM’19]
- needs solution of bimatrix games
- (basic problem is EXPTIME)
- we adapt a known approach using labelled polytopes, and implement with an SMT encoding
- We further extend the value iteration approach:
\[
p(s) = \begin{cases}
(1,1) & \text{if } s \models \checkmark_1 \land \checkmark_2 \\
(p_{\text{max}}(s, \checkmark_2),1) & \text{if } s \models \checkmark_1 \land \neg \checkmark_2 \\
(1, p_{\text{max}}(s, \checkmark_1)) & \text{if } s \models \neg \checkmark_1 \land \checkmark_2 \\
\text{val}(Z_1, Z_2) & \text{if } s \models \neg \checkmark_1 \land \neg \checkmark_2
\end{cases}
\]
- where $Z_1$ and $Z_2$ encode matrix games similar to before
Example: multi–robot coordination
• 2 robots navigating an $I \times I$ grid
– start at opposite corners, goals are to navigate to opposite corners
– obstacles modelled stochastically: navigation in chosen direction fails with probability $q$
• We synthesise SWNEs to maximise the average probability of robots reaching their goals within time $k$
– $\langle \langle \text{robot}_1: \text{robot}_2 \rangle \rangle_{\text{max}} = \left( P \left[ F \leq k \text{ goal}_1 \right] + P \left[ F \leq k \text{ goal}_2 \right] \right)$
• Results (10 $\times$ 10 grid)
– better performance obtained than using zero–sum methods, i.e., optimising for robot 1, then robot 2
Conclusions
Conclusions
- **Probabilistic model checking**
- temporal logics & automata
- tools, techniques, modelling languages
- multi-agent systems
- **Challenges**
- partial information/observability
- managing model uncertainty
- integration with machine learning
- continuous variables/state spaces
- scalability & efficiency vs. accuracy
More details and references [here](#)
|
{"Source-Url": "https://www.cs.ox.ac.uk/people/david.parker/talks/dave-dagstuhl23pmctut.pdf", "len_cl100k_base": 5775, "olmocr-version": "0.1.50", "pdf-total-pages": 45, "total-fallback-pages": 0, "total-input-tokens": 86159, "total-output-tokens": 7638, "length": "2e12", "weborganizer": {"__label__adult": 0.0006175041198730469, "__label__art_design": 0.0006036758422851562, "__label__crime_law": 0.0010385513305664062, "__label__education_jobs": 0.0013074874877929688, "__label__entertainment": 0.00017452239990234375, "__label__fashion_beauty": 0.00030112266540527344, "__label__finance_business": 0.0005121231079101562, "__label__food_dining": 0.0007071495056152344, "__label__games": 0.004123687744140625, "__label__hardware": 0.0015287399291992188, "__label__health": 0.0012083053588867188, "__label__history": 0.0006208419799804688, "__label__home_hobbies": 0.00022983551025390625, "__label__industrial": 0.0012760162353515625, "__label__literature": 0.0005846023559570312, "__label__politics": 0.0007181167602539062, "__label__religion": 0.0007767677307128906, "__label__science_tech": 0.2379150390625, "__label__social_life": 0.0001959800720214844, "__label__software": 0.00727081298828125, "__label__software_dev": 0.73583984375, "__label__sports_fitness": 0.0007867813110351562, "__label__transportation": 0.0013685226440429688, "__label__travel": 0.00032591819763183594}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 19516, 0.00924]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 19516, 0.23675]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 19516, 0.68717]], "google_gemma-3-12b-it_contains_pii": [[0, 130, false], [130, 309, null], [309, 513, null], [513, 699, null], [699, 720, null], [720, 1037, null], [1037, 1618, null], [1618, 1633, null], [1633, 2188, null], [2188, 2825, null], [2825, 3687, null], [3687, 4348, null], [4348, 4686, null], [4686, 4782, null], [4782, 4876, null], [4876, 5585, null], [5585, 6286, null], [6286, 6673, null], [6673, 6703, null], [6703, 7378, null], [7378, 7979, null], [7979, 8550, null], [8550, 8992, null], [8992, 9259, null], [9259, 10458, null], [10458, 11057, null], [11057, 11709, null], [11709, 11734, null], [11734, 12235, null], [12235, 12479, null], [12479, 13189, null], [13189, 13987, null], [13987, 14272, null], [14272, 14500, null], [14500, 14531, null], [14531, 14562, null], [14562, 15156, null], [15156, 15738, null], [15738, 16191, null], [16191, 16802, null], [16802, 17664, null], [17664, 18441, null], [18441, 19115, null], [19115, 19127, null], [19127, 19516, null]], "google_gemma-3-12b-it_is_public_document": [[0, 130, true], [130, 309, null], [309, 513, null], [513, 699, null], [699, 720, null], [720, 1037, null], [1037, 1618, null], [1618, 1633, null], [1633, 2188, null], [2188, 2825, null], [2825, 3687, null], [3687, 4348, null], [4348, 4686, null], [4686, 4782, null], [4782, 4876, null], [4876, 5585, null], [5585, 6286, null], [6286, 6673, null], [6673, 6703, null], [6703, 7378, null], [7378, 7979, null], [7979, 8550, null], [8550, 8992, null], [8992, 9259, null], [9259, 10458, null], [10458, 11057, null], [11057, 11709, null], [11709, 11734, null], [11734, 12235, null], [12235, 12479, null], [12479, 13189, null], [13189, 13987, null], [13987, 14272, null], [14272, 14500, null], [14500, 14531, null], [14531, 14562, null], [14562, 15156, null], [15156, 15738, null], [15738, 16191, null], [16191, 16802, null], [16802, 17664, null], [17664, 18441, null], [18441, 19115, null], [19115, 19127, null], [19127, 19516, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 19516, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 19516, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 19516, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 19516, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 19516, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 19516, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 19516, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 19516, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 19516, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 19516, null]], "pdf_page_numbers": [[0, 130, 1], [130, 309, 2], [309, 513, 3], [513, 699, 4], [699, 720, 5], [720, 1037, 6], [1037, 1618, 7], [1618, 1633, 8], [1633, 2188, 9], [2188, 2825, 10], [2825, 3687, 11], [3687, 4348, 12], [4348, 4686, 13], [4686, 4782, 14], [4782, 4876, 15], [4876, 5585, 16], [5585, 6286, 17], [6286, 6673, 18], [6673, 6703, 19], [6703, 7378, 20], [7378, 7979, 21], [7979, 8550, 22], [8550, 8992, 23], [8992, 9259, 24], [9259, 10458, 25], [10458, 11057, 26], [11057, 11709, 27], [11709, 11734, 28], [11734, 12235, 29], [12235, 12479, 30], [12479, 13189, 31], [13189, 13987, 32], [13987, 14272, 33], [14272, 14500, 34], [14500, 14531, 35], [14531, 14562, 36], [14562, 15156, 37], [15156, 15738, 38], [15738, 16191, 39], [16191, 16802, 40], [16802, 17664, 41], [17664, 18441, 42], [18441, 19115, 43], [19115, 19127, 44], [19127, 19516, 45]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 19516, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-29
|
2024-11-29
|
5fba538c22404b5dcea8700f04a30cf17a09a86c
|
GRAPHCORE OVERVIEW AND ONBOARDING TRAINING FOR TAMU
February 21, 2023
Alexander Tsyplikhin
AGENDA
• Introduction to Graphcore, IPU, and Poplar
• Hands-on: ssh into the POD, enable the SDK, clone tutorials, binary caching, run example
• TensorFlow2
• Hands-on: Port a Keras script, leverage loop on device, replicate and run data-parallel, pipeline
• PyTorch
• Hands-on: PopTorch example, DataLoader, options to optimize performance
GRAPHCORE OVERVIEW
GRAPHCORE ENABLING MACHINE INTELLIGENCE
• Founded in 2016
• Technology: Intelligence Processor Unit (IPU)
• Team: ~500
• Offices: UK, US, China, Poland
• Raised >$710M
GRAPHCORE IPU LETS INNOVATORS CREATE THE NEXT BREAKTHROUGHS IN MACHINE INTELLIGENCE
MACHINE INTELLIGENCE REPRESENTS A COMPLETELY NEW COMPUTE WORKLOAD
Massive parallelism
Sparsity in data structures
Low precision compute
Model parameter re-use
Static graph structure
LEGACY PROCESSOR ARCHITECTURES HAVE BEEN REPURPOSED FOR ML
- **CPU**
- Apps and Web/
- Scalar
- **GPU**
- Graphics and HPC/
- Vector
A NEW PROCESSOR IS REQUIRED FOR THE FUTURE
**CPU**
Apps and Web/
Scalar
**GPU**
Graphics and HPC/
Vector
**IPU**
Artificial Intelligence/
Graph
IPU – ARCHITECTURED FOR AI
Massive parallelism with ultrafast memory access
**Parallelism**
**Processors**
- Designed for scalar processes
**Memory**
- Off-chip memory
**Memory Access**
**CPU**
- SIMD/SIMT architecture. Designed for large blocks of dense contiguous data
**GPU**
- Model and data spread across off-chip and small on-chip cache, and shared memory
**IPU**
- Massively parallel MIMD. Designed for fine-grained, high-performance computing
Model and data tightly coupled, and large locally distributed SRAM
PROVEN IPU ADVANTAGE
SELECT CASE STUDIES ACROSS MANY INDUSTRIES & FIELDS
HEALTHCARE
CASE STUDY: NLP
FINANCE – OPTION PRICING
CASE STUDY: SIM
AI SaaS – TEXT ANALYTICS
CASE STUDY: NLP
RESEARCH / BIG LABS
CASE STUDY
COMPUTATIONAL CHEMISTRY
CASE STUDY: GNN
SMART CITY
CASE STUDY: CV
FINANCE - INSURANCE
CASE STUDY: CV
WEATHER FORECASTING
CASE STUDY: SIM
HIGH ENERGY PHYSICS
CASE STUDY
DYNAMIC GRAPHS
CASE STUDY: GNN
IPU COMPUTATIONAL ADVANTAGES
Heterogeneous gather/scatter operations. E.g. GNNs
Group and depthwise convolutions. E.g. ResNeXt, EfficientNet
Vector operations with low arithmetic intensity. E.g. Sparse matmuls
Dense as well as Sparse Matrix Multiplication. E.g. Transformers
Hardware accelerated Random Number Generation. E.g. Random Projections
Hard to vectorize workloads. E.g. CRR algorithm for option pricing
References:
https://www.graphcore.ai/performance-results
https://www.graphcore.ai/posts/how-we-made-efficientnet-more-efficient
https://www.graphcore.ai/posts/delving-deep-into-modern-computer-vision-models
WORKLOADS THAT CAN’T EASILY BE VECTORIZED
- Workloads with while loops that continue until convergence is achieved e.g. ray tracing
- Workloads where different compute paths are required depending on the inputs e.g. CRR model
- Tree-based models with unbalanced trees of different depth
Deep Trench Capacitor
- Efficient power delivery
- Enables increase in operational performance
Wafer-On-Wafer
- Advanced silicon 3D stacking technology
- Closely coupled power delivery die
- Higher operating frequency and enhanced overall performance
IPU-Tiles™
- 1472 independent IPU-Tiles™ each with an IPU-Core™ and In-Processor-Memory™
IPU-Core™
- 1472 independent IPU-Core™
- 8832 independent program threads executing in parallel
In-Processor-Memory™
- 900MB In-Processor-Memory™ per IPU
- 65.4TB/s memory bandwidth per IPU
BOW IPU PROCESSOR
Solder Bumps
IPU-Links™
- 10x IPU-Links, 320GB/s chip to chip bandwidth
IPU-Exchange™
- 11 TB/s all to all IPU-Exchange™
- Non-blocking, any communication pattern
PCIe
- PCI Gen4 x16
- 64 GB/s bidirectional bandwidth to host
EXECUTION MODEL
BOW-2000 IPU MACHINE
IU blade form factor delivering 1.4 PetaFLOPS AI Compute
Disaggregated AI/ML accelerator platform
Excellent performance & TCO leveraging In-Processor memory & IPU-Exchange
IPU-Links scale to Bow Pod64
Expansion to Bow Pod256 and beyond with IPU-GW Links
BOW-2000: THE BUILDING BLOCK OF LARGE PODS
4x Bow IPUs
- 1.4 PFLOP₁₆ compute
- 5,888 processor cores
- > 35,000 independent parallel threads
Exchange Memory
- 3.6GB In-Processor Memory @ 260 TB/s
- 128GB Streaming Memory DRAM (up to 256GB)
IPU-Fabric managed by IPU-GW
- Host-Link – 100GE to Poplar Server for standard data center networking
- IPU-Link – 2D Torus for intra-POD64 communication
- GW-Link - 2x 100Gbps Gateway-Links for rack-to-rack – flexible topology
% x16 IPU-Link [64GB/s]
% Host-Link Network I/F [100Gbps]
% IPU-GW Link [100Gbps]
% x8 PCIe G4 [32GB/s]
HOST AND IPU-FABRIC ENABLES LARGE SCALEOUT PODS
Host-Links:
100Gbps connectivity for each Bow-2000 to host server
Enabling disaggregation of host server, with optimal server/Bow-2000 ratio.
IPU-Links (part of IPU-Fabric):
2D Torus for IPU communication
Providing high bandwith connectivity across IPUs up to Pod64
GW-Links (part of IPU-Fabric):
2x 100Gbps Gateway-Links for rack-to-rack communication
Redundant rack-to-rack communication for large scaleout beyond Pod64
2.8 Tbps* ultra-low latency fabric designed for AI
*Bandwidth for a Bow-2000
x16 IPU-Link 64GB/s
100Gbps Host-Link Network I/F
100Gbps IPU-GW Link
x8 PCIe G4 32GB/s
HANDBS-ON:
GET STARTED
RUN AN EXAMPLE
bit.ly/tamu2302221
STANDARD ML FRAMEWORK SUPPORT
Develop models using standard high-level frameworks or port existing models
- PyTorch
- TensorFlow
- PyTorch Lightning
- HUGGING FACE
- PyG
- Keras
- PaddlePaddle
- HALO
Easy port of high-level framework models
Existing models on alternative platforms
POPLAR®
IPU-Processor Platforms
GRAPHCORE SOFTWARE MATURITY
- NLP/TRANSFORMERS
- IMAGE CLASSIFICATION/CNNs
- OBJECT DETECTION
- LARGE MODELS
- MLPERF
- CONDITIONAL SPARSITY
- GNNS
- ML APPLICATIONS
- TUTORIALS
- CODE EXAMPLES
- DOCUMENTATION
- VIDEOS
- NATIVE IPU CODERS PROGRAM
- APPS PORTFOLIO
- FRONTENDS
- JUPYTER NOTEBOOKS
- FRAMEWORKS
- Keras
- ONNX
- FW BACKENDS
- XLA
- POPART+
- POPDIST
- PARTITIONER
- POPIR
- POPIT
- POPLIBS
- GCL
- POPLAR
- GRAPH ENGINE
- GRAPH COMPILER
- GC DEVICE ACCESS LAYER
- DRIVERS
- IPUOF DRIVER
- PCIe DRIVER
- POPLAR® SDK
- DEVELOPER ECOSYSTEM
- INFERENCE DEPLOYMENT TOOLKIT
- POPVISION TOOLS
- GRAPH ANALYZER
- SYSTEM ANALYZER
- DEBUGGER
- DEVELOPMENT ENVIRONMENT
- SYSTEM MONITORING
- PROMETHEUS
- GRAFANA
- JOB DEPLOYMENT
- K8S
- SLURM
- SYSTEM SOFTWARE
PROGRAMMING ON IPU
DOCS AND TUTORIALS
USEFUL ENV VARIABLES
FRAMEWORKS
POPVISION
DEVELOPER RESOURCES
DEVELOPER PORTAL
graphcore.ai/developer
- Public hub for developers to access:
- Software documentation
- How-to videos
- Code tutorial walkthroughs
- Performance Benchmarks
- Community support
- Developer news
- Learn about the Poplar® SDK and how to easily run ML models on IPU systems
• As part of our ethos to put power in the hands of AI developers, Graphcore open sourced in 2020
• PopLibs™, PopART, PyTorch & TensorFlow for IPU fully open source and available on GitHub
• Our code is public and open for code contributions from the wider ML developer community
github.com/graphcore
### TUTORIALS
Learn how to create and run programs using Poplar and PopLibs with our hands-on programming tutorials.
<table>
<thead>
<tr>
<th>Programs and Variables</th>
<th>Using PopLibs</th>
<th>Writing Vertex Code</th>
</tr>
</thead>
<tbody>
<tr>
<td>Profiling Output</td>
<td>Basic Machine Learning Example</td>
<td>Matrix-Vector Multiplication</td>
</tr>
<tr>
<td>Matrix-Vector Multiplication Optimization</td>
<td>Simple PyTorch for the IPU</td>
<td></td>
</tr>
</tbody>
</table>
#### Tutorial 1: programs and variables
Copy the file `mnist_tut/tutorials/start_tutorial.cpp` to your working directory and open it in an editor. The file contains the outline of a C++ program including some Poplar library headers and a namespace.
Graphs, variables and programs:
All Poplar programs require a `Graph` object to construct the computation graph. Graphs are always created for a specific target where the target is a description of the hardware being targeted, such as an IPU. To obtain the target we need to choose a device.
The tutorial uses a simulated target by default, so we can run any machine even if it has no Graphcore hardware attached. On systems with accelerator hardware, the `headerfile` path/`accessor` path contains API calls to enumerate and return devices - objects for the attached hardware.
Simulated devices are created with the `GraphDevice` class, which models the functionality of an IPU on the host. The `createDevice` function creates a new virtual device to work with. Once we have this device we can create a `Graph` object to target it.
- **Add the following code to the body of `main()`:**
```cpp
auto graph = createGraph();
```
---
#### Tutorial 5: a basic machine learning example
This tutorial contains a complete training program that performs a logistic regression on the MNIST data set, using gradient descent. The files for the demo are in `1x15.sh`.
There are no coding steps in the tutorial. The task is to understand the code, build it and run it. You can build the code using the supplied makefile.
Before you can run the code you will need to run the `get_mnist.sh` script to download the MNIST data.
The program accepts an optional command line argument to make it use the IPU hardware instead of a simulated IPU.
As you would expect, training is significantly faster on the IPU hardware.
**Copyright (c) 2018 Graphcore Ltd. All rights reserved.**
ENHANCED MODEL GARDEN
PUBLIC ACCESS TO WIDE VARIETY OF MODELS, READY TO RUN ON IPU
NEW FILTER/SEARCH CAPABILITY
DIRECT ACCESS TO GITHUB
PAPERSPACE NOTEBOOK LINKS
RESOURCES CENTRE
graphcore.ai/resources
- Central source of research papers, white papers, videos, on-demand webinars and documentation
- Product resources for ML Engineers & IT / Infrastructure Managers now available
USEFUL ENV VARIABLES
USEFUL ENV VARIABLES
LOGGING
Logging messages can be generated when your program runs. This is controlled by the environment variables described below. For more detailed information see the docs: https://docs.graphcore.ai/projects/poplar-user-guide/en/latest/env-vars.html
POPLAR_LOG_LEVEL: Enable logging for Poplar
POPLAR_LOG_DEST: Specify the destination for Poplar logging (“stdout”, “stderr” or a file name)
<table>
<thead>
<tr>
<th>Log Level</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>"OFF"</td>
<td>No logging information. The default.</td>
</tr>
<tr>
<td>"ERR"</td>
<td>Only error conditions will be reported.</td>
</tr>
<tr>
<td>"WARN"</td>
<td>Warnings when, for example, the software cannot achieve what was requested (for example, if the convolution planner can’t keep to the memory budget, or Poplar has determined that the model won’t fit in memory but the debug.allowOutOfMemory option is enabled).</td>
</tr>
<tr>
<td>"INFO"</td>
<td>Very high level information, such as PopLibs function calls.</td>
</tr>
<tr>
<td>"DEBUG"</td>
<td>Useful per-graph information.</td>
</tr>
<tr>
<td>"TRACE"</td>
<td>The most verbose level. All useful per-tile information.</td>
</tr>
</tbody>
</table>
SYNTHETIC-DATA
TF_POPLAR_FLAGS= "--use_synthetic_data --synthetic_data_initializer=random"
Used for measuring the IPU-only throughput and disregards any host/CPU activity.
CREATE EXECUTION PROFILE
POPLAR_ENGINE_OPTIONS='{"autoReport.all":"true", "autoReport.directory": "/report"}’
- The PopVision Graph Analyser uses report files generated during compilation and execution by the Poplar SDK.
- These files can be created using POPLAR_ENGINE_OPTIONS.
- In order to capture the reports needed for the PopVision Graph Analyser you only need to set POPLAR_ENGINE_OPTIONS='{"autoReport.all":"true"}' before you run a program. By default this will enable instrumentation and capture all the required reports to the current working directory.
EXECUTABLE CACHE
If you often run the same models you might want to enable executable caching to save time:
POPTORCH:
• You can do this by either setting the POPTORCH_CACHE_DIR environment variable or by calling poptorch.Options.enableExecutableCaching.
TENSORFLOW:
• You can use the flag --executable_cache_path to specify a directory where compiled files will be placed. Fused XLA/HLO graphs are hashed with a 64-bit hash and stored in this directory.
**Warning**
The cache directory might grow large quickly. Poplar doesn’t evict old models from the cache and, depending on the number and size of your models and the number of IPUs used, the executables might be quite large.
It is your responsibility to delete the unwanted cache files.
**GRAPHCORE COMMAND LINE TOOLS**
- **gc-info** Determines what IPU cards are present in the system.
- **gc-inventory** Lists device IDs, physical parameters and firmware version numbers.
- **gc-reset** Resets an IPU device after reboot. Note that each IPU must be reset after the host machine is rebooted.
- **gc-exchangetest** Allows you to test the internal exchange fabric in an IPU.
- **gc-memorytest** Tests all the memory in an IPU, reporting any tiles that fail.
- **gc-links** Displays the status and connectivity of each of the IPU-Links that connect the C2 IPU-Processor cards together. See also *IPU-Link channel mapping*.
- **gc-powerertest** Tests power consumption and temperature of the C2 IPU-Processor cards.
- **gc-hosttraffictest** Allows you to test the data transfer between the host machine and the IPUs (in both directions).
- **gc-putraficctest** Allows you to test the data transfer between IPUS.
- **gc-docker** Allows you to use IPU devices in Docker containers.
See: [https://documents.graphcore.ai/](https://documents.graphcore.ai/)
TF2/KERAS ON IPU
KERAS ON IPU
• IPU optimized Keras Model and Sequential are available for the IPU. These have the following features:
* On-device training loop for reduction of communication overhead.
* Gradient accumulation for simulating larger batch sizes.
* Automatic data-parallelisation of the model when placed on a multi-IPU device.
import tensorflow as tf
from tensorflow.keras.layers import *
# GPU
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.cifar10.load_data()
x_train = x_train.astype('float32') / 255.0
y_train = tf.keras.utils.to_categorical(y_train, 10)
ds_train = tf.data.Dataset.from_tensor_slices((x_train, y_train)).batch(64, drop_remainder=True)
model = tf.keras.Sequential([
Conv2D(32, (3, 3), padding='same', input_shape=x_train.shape[1:]),
Activation('relu'),
Conv2D(32, (3, 3), padding='same'),
Activation('relu'),
MaxPooling2D(pool_size=(2, 2)),
Dropout(0.25),
Conv2D(64, (3, 3), padding='same'),
Activation('relu'),
Conv2D(64, (3, 3), padding='same'),
Activation('relu'),
MaxPooling2D(pool_size=(2, 2)),
Dropout(0.25),
Flatten(),
Dense(512),
Activation('relu'),
Dropout(0.5),
Dense(10),
Activation('softmax')
])
model.compile(loss='categorical_crossentropy',
optimizer=tf.optimizers.SGD(learning_rate=0.016),
metrics=['accuracy'])
model.fit(ds_train, epochs=40)
# IPU
+ cfg = ipu.config.IPUConfig()
+ cfg.auto_select_ipus = 1
+ cfg.configure_ipu_system()
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.cifar10.load_data()
x_train = x_train.astype('float32') / 255.0
y_train = tf.keras.utils.to_categorical(y_train, 10)
ds_train = tf.data.Dataset.from_tensor_slices((x_train, y_train)).batch(64, drop_remainder=True)
model = tf.keras.Sequential([
Conv2D(32, (3, 3), padding='same', input_shape=x_train.shape[1:]),
Activation('relu'),
Conv2D(32, (3, 3), padding='same'),
Activation('relu'),
MaxPooling2D(pool_size=(2, 2)),
Dropout(0.25),
Conv2D(64, (3, 3), padding='same'),
Activation('relu'),
Conv2D(64, (3, 3), padding='same'),
Activation('relu'),
MaxPooling2D(pool_size=(2, 2)),
Dropout(0.25),
Flatten(),
Dense(512),
Activation('relu'),
Dropout(0.5),
Dense(10),
Activation('softmax')
])
model.compile(loss='categorical_crossentropy',
optimizer=tf.optimizers.SGD(learning_rate=0.016),
metrics=['accuracy'])
model.fit(ds_train, epochs=40)
$ python3 gpu_keras_cnn.py
Train for 1560 steps
Epoch 1/40
1560/1560 [======================================] - 8s 5ms/step - loss: 2.168
Epoch 2/40
1560/1560 [======================================] - 5s 3ms/step - loss: 1.880
Epoch 3/40
1560/1560 [======================================] - 5s 3ms/step - loss: 1.652
Epoch 4/40
75/1560 [.........................................] - ETA: 5s - loss: 1.5328
2020-05-12 16:40:32.449285: I tensorflow/compiler/plugin/poplar/driver/pPrincipalParserPlugin: F66a6e6ce3
2020-05-12 16:40:34.523582: I tensorflow/core/platform/proto_tools/cpu_utils.cc:250
1560/1560 [======================================] - 2s 2ms/step - loss: 0.0500 - accuracy: 0.997
Epoch 2/40
1560/1560 [======================================] - 1s 593us/step - loss: 0.0408 - accuracy: 1.000
Epoch 3/40
1560/1560 [======================================] - 1s 592us/step - loss: 0.0357 - accuracy: 1.000
Epoch 4/40
1560/1560 [======================================] - 1s 597us/step - loss: 0.0325 - accuracy: 1.000
Epoch 5/40
1560/1560 [======================================] - 1s 600us/step - loss: 0.0299 - accuracy: 1.000
Epoch 6/40
1560/1560 [======================================] - 1s 600us/step - loss: 0.0278 - accuracy: 1.000
Epoch 7/40
1560/1560 [======================================] - 1s 599us/step - loss: 0.0258 - accuracy: 1.000
Epoch 8/40
1560/1560 [======================================] - 1s 598us/step - loss: 0.0241 - accuracy: 1.000
Epoch 9/40
1560/1560 [======================================] - 1s 600us/step - loss: 0.0224 - accuracy: 1.000
Epoch 10/40
1560/1560 [======================================] - 1s 601us/step - loss: 0.0208 - accuracy: 1.000
Epoch 11/40
1560/1560 [======================================] - 1s 601us/step - loss: 0.0193 - accuracy: 1.000
Epoch 12/40
1560/1560 [======================================] - 1s 600us/step - loss: 0.0178 - accuracy: 1.000
Epoch 13/40
1560/1560 [======================================] - 1s 601us/step - loss: 0.0164 - accuracy: 1.000
Epoch 14/40
1560/1560 [======================================] - 1s 601us/step - loss: 0.0150 - accuracy: 1.000
Epoch 15/40
1560/1560 [======================================] - 1s 601us/step - loss: 0.0136 - accuracy: 1.000
Epoch 16/40
1560/1560 [======================================] - 1s 601us/step - loss: 0.0122 - accuracy: 1.000
Epoch 17/40
KERAS TUTORIAL
https://github.com/graphcore/tutorials/tree/master/tutorials/tensorflow2/keras
INTRO TO POPTORCH
GRAPHCORE
WHAT IS POPTORCH?
WHAT IS POPTORCH?
- PopTorch is a set of extensions for PyTorch to enable PyTorch models to run on Graphcore's IPU hardware.
- PopTorch supports both inference and training. To run a model on the IPU you wrap your existing PyTorch model in either a PopTorch inference wrapper or a PopTorch training wrapper.
- You can provide further annotations to partition the model across multiple IPUs. Using the user-provided annotations, PopTorch will use PopART to parallelise the model over the given number of IPUs.
- Additional parallelism can be expressed via a replication factor which enables you to data-parallelise the model over more IPUs.
- Under the hood PopTorch uses TorchScript, an intermediate representation (IR) of a PyTorch model, using the torch.jit.trace API. To learn more about TorchScript and JIT, you can go through PyTorch’s tutorial: https://pytorch.org/tutorials/beginner/Intro_to_TorchScript_tutorial.html
- Not all PyTorch operations have been implemented by the backend yet and you can find the list of supported operations here: https://docs.graphcore.ai/projects/poptorch-user-guide/en/latest/supported_ops.html
Define a model within PyTorch
Create an IPU execution wrapper around the model and run as normal
PopTorch uses the `torch.jit.trace` API to trace the model to PyTorch IR
Compile the graph in PopART and then run on one or more IPUs
Examples available from https://github.com/graphcore/examples
GETTING STARTED: TRAINING A MODEL
1. Import packages
PopTorch is a separate package from PyTorch, and must be imported.
2. Load dataset using torchvision.datasets and poptorch.DataLoader
In order to make data loading easier and more efficient, PopTorch offers an extension of torch.utils.data.DataLoader class: poptorch.DataLoader class is specialised for the way the underlying PopART framework handles batching of data.
3. Define model and loss function using torch API
The only difference here from pure PyTorch is the loss computation, which has to be part of the forward function. This is to ensure the loss is computed on the IPU and not on the CPU, and to give us as much flexibility as possible when designing more complex loss functions.
4. Prepare training
Instantiate compilation and execution options, these are used by PopTorch’s wrappers such as `poptorch.DataLoader` and `poptorch.trainingModel`.
5. Train the model
Define the optimizer using PyTorch’s API.
Use `poptorch.trainingModel` wrapper, to wrap your PyTorch model. This wrapper will trigger the compilation of our model, using TorchScript, and manage its translation to a program the IPU can run. Then run your training loop.
```python
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='MNIST training in PopTorch')
parser.add_argument('--batch-size', type=int, default=8, help='Batch size for training (default: 8)
parser.add_argument('--test-batch-size', type=int, default=10, help='Batch size for testing
parser.add_argument('--epochs', type=int, default=10, help='Number of epochs to train (default: 10)
args = parser.parse_args()
training_data = torch.utils.data.DataLoader(
torchvision.datasets.MNIST('mnist_data/', train=True, download=True),
batch_size=args.batch_size, shuffle=True, drop_last=True)
test_data = torch.utils.data.DataLoader(
torchvision.datasets.MNIST('mnist_data/', train=False, download=True),
batch_size=1, shuffle=True, drop_last=True)
model = Network()
training_model = TrainingModelWithLoss(model)
optimizer = optim.SGD(model.parameters(), lr=args.lr)
# Run training
for _ in range(args.epochs):
for data, labels in training_data:
preds, losses = training_model(data, labels)
optimizer.zero_grad()
losses.backward()
optimizer.step()
# Run validation
sum_acc = 0.0
with torch.no_grad():
for data, labels in test_data:
output = model(data)
sum_acc += accuracy(output, labels)
print(f'Accuracy on test set: {sum_acc / len(test_data):.2f}')
```
POPTORCH TUTORIAL
https://github.com/graphcore/tutorials/tree/master/tutorials/pytorch/tut1_basics
The compilation and execution on the IPU can be controlled using `poptorch.Options`.
Some examples:
(i) **deviceIterations**
This option specifies the number of batches that is prepared by the host (CPU) for the IPU. The higher this number, the less the IPU has to interact with the CPU, for example to request and wait for data, so that the IPU can loop faster. However, the user will have to wait for the IPU to go over all the iterations before getting the results back. The maximum is the total number of batches in your dataset, and the default value is 1.
(ii) **replicationFactor**
This is the number of replicas of a model. We use replicas as an implementation of data parallelism. To achieve the same behavior in pure PyTorch, you'd wrap your model with `torch.nn.DataParallel`, but with PopTorch, this is an option.
INFERENCEx
• To run inference, you use `poptorch.inferenceModel` class, which has a similar API to `poptorch.trainingModel` except that it doesn't need an optimizer.
• See tutorial example here: https://github.com/graphcore/tutorials/tree/master/tutorials/pytorch/tut1_basics#running-our-model-for-inference-on-an-ipu
MORE INFO
• PyTorch for the IPU: User Guide
• GitHub tutorial
https://github.com/graphcore/examples/tree/master/tutorials/pytorch/tut1_basics
• Code examples on GitHub
https://github.com/graphcore/examples/tree/master/code_examples/pytorch/mnist
• Video tutorial on our developer page
https://www.graphcore.ai/developer
Getting started with PyTorch for the IPU
Running a basic model for training and inference
POPLAR™ POPVISION TOOLS
GRAPH ANALYSER
Useful for analysing and optimising the memory use and execution performance of ML models on the IPU
SYSTEM ANALYSER
Graphical view of the timeline of host-side application execution steps
“Our team was very impressed by the care and effort Graphcore has clearly put into the PopVision graph and system analysers. It’s hard to imagine getting such a helpful and comprehensive profiling of the code elsewhere, so this was really a standout feature in our IPU experience.”
Dominique Beaini, Valence Discovery, a leader in AI-first drug design
You can use the PopVision Graph Analyser tool to debug IPU programs and generate reports on compilation and execution of the program.
This tool can be downloaded from the Graphcore customer support portal: https://downloads.graphcore.ai/.
There is a built-in help system within the tool for any questions you might have about producing and analysing reports.
PopVision Graph Analyser
Several new features including:
- A new file format for the graph and execution profile, resulting in a 50% file size reduction
- Enhanced PopLibs debug information
Liveness Report
The debug information shown for a variable now displays enhanced information. For each variable that has debug information, you can now see the PopLibs API that created it, its arguments and its outputs.
Enhanced debug information has been added to program steps. Program steps show Poplar and PopLibs debug information such as which PopLibs API created that program step, its arguments and its outputs.
Getting started video available on the developers portal
Check out the integrated help or visit our developer portal for more information
The PopVision System Analyser allows developers to understand the execution of programs running on the host processor which control the IPU(s). The System Analyser shows the interaction between the host and the IPU(s) so that developers can understand where the bottlenecks are in the execution of their applications.
The PopVision System Analyser visualises the information collected by the PopVision Trace Instrumentation Library which is part of the Poplar SDK.
Visit our developer portal for more information and the latest documentation:
https://www.graphcore.ai/developer
ANY QUESTIONS, REQUESTS, BUGS...
https://www.graphcore.ai/support
THANK YOU
Alexander Tsyplikhin
alext@graphcore.ai
|
{"Source-Url": "https://hprc.tamu.edu/files/training/2023/Spring/TAMU_Graphcore_Workshop_2023-02-21.pdf", "len_cl100k_base": 7152, "olmocr-version": "0.1.50", "pdf-total-pages": 61, "total-fallback-pages": 0, "total-input-tokens": 72879, "total-output-tokens": 9901, "length": "2e12", "weborganizer": {"__label__adult": 0.00036215782165527344, "__label__art_design": 0.00041031837463378906, "__label__crime_law": 0.00024819374084472656, "__label__education_jobs": 0.0006275177001953125, "__label__entertainment": 9.548664093017578e-05, "__label__fashion_beauty": 0.00016701221466064453, "__label__finance_business": 0.00032591819763183594, "__label__food_dining": 0.00028204917907714844, "__label__games": 0.0006837844848632812, "__label__hardware": 0.005428314208984375, "__label__health": 0.00030803680419921875, "__label__history": 0.00022542476654052737, "__label__home_hobbies": 0.00011086463928222656, "__label__industrial": 0.0007739067077636719, "__label__literature": 0.00015056133270263672, "__label__politics": 0.00018680095672607425, "__label__religion": 0.0004711151123046875, "__label__science_tech": 0.0709228515625, "__label__social_life": 7.909536361694336e-05, "__label__software": 0.01519012451171875, "__label__software_dev": 0.90185546875, "__label__sports_fitness": 0.0002834796905517578, "__label__transportation": 0.00040078163146972656, "__label__travel": 0.00015532970428466797}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27408, 0.03957]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27408, 0.32249]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27408, 0.74175]], "google_gemma-3-12b-it_contains_pii": [[0, 93, false], [93, 443, null], [443, 462, null], [462, 631, null], [631, 715, null], [715, 715, null], [715, 898, null], [898, 1045, null], [1045, 1192, null], [1192, 1719, null], [1719, 2141, null], [2141, 2958, null], [2958, 3246, null], [3246, 4028, null], [4028, 4044, null], [4044, 4324, null], [4324, 4900, null], [4900, 5541, null], [5541, 5581, null], [5581, 5600, null], [5600, 5600, null], [5600, 5920, null], [5920, 6726, null], [6726, 6807, null], [6807, 6827, null], [6827, 7130, null], [7130, 7434, null], [7434, 9780, null], [9780, 9946, null], [9946, 9946, null], [9946, 10166, null], [10166, 10187, null], [10187, 11242, null], [11242, 11416, null], [11416, 11983, null], [11983, 12731, null], [12731, 13795, null], [13795, 13812, null], [13812, 14145, null], [14145, 16305, null], [16305, 16305, null], [16305, 18814, null], [18814, 18909, null], [18909, 18938, null], [18938, 18956, null], [18956, 20097, null], [20097, 20394, null], [20394, 20428, null], [20428, 21146, null], [21146, 21603, null], [21603, 23059, null], [23059, 23159, null], [23159, 24203, null], [24203, 24523, null], [24523, 25013, null], [25013, 25597, null], [25597, 25958, null], [25958, 26711, null], [26711, 27291, null], [27291, 27358, null], [27358, 27408, null]], "google_gemma-3-12b-it_is_public_document": [[0, 93, true], [93, 443, null], [443, 462, null], [462, 631, null], [631, 715, null], [715, 715, null], [715, 898, null], [898, 1045, null], [1045, 1192, null], [1192, 1719, null], [1719, 2141, null], [2141, 2958, null], [2958, 3246, null], [3246, 4028, null], [4028, 4044, null], [4044, 4324, null], [4324, 4900, null], [4900, 5541, null], [5541, 5581, null], [5581, 5600, null], [5600, 5600, null], [5600, 5920, null], [5920, 6726, null], [6726, 6807, null], [6807, 6827, null], [6827, 7130, null], [7130, 7434, null], [7434, 9780, null], [9780, 9946, null], [9946, 9946, null], [9946, 10166, null], [10166, 10187, null], [10187, 11242, null], [11242, 11416, null], [11416, 11983, null], [11983, 12731, null], [12731, 13795, null], [13795, 13812, null], [13812, 14145, null], [14145, 16305, null], [16305, 16305, null], [16305, 18814, null], [18814, 18909, null], [18909, 18938, null], [18938, 18956, null], [18956, 20097, null], [20097, 20394, null], [20394, 20428, null], [20428, 21146, null], [21146, 21603, null], [21603, 23059, null], [23059, 23159, null], [23159, 24203, null], [24203, 24523, null], [24523, 25013, null], [25013, 25597, null], [25597, 25958, null], [25958, 26711, null], [26711, 27291, null], [27291, 27358, null], [27358, 27408, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 27408, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27408, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27408, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27408, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27408, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27408, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27408, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27408, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27408, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27408, null]], "pdf_page_numbers": [[0, 93, 1], [93, 443, 2], [443, 462, 3], [462, 631, 4], [631, 715, 5], [715, 715, 6], [715, 898, 7], [898, 1045, 8], [1045, 1192, 9], [1192, 1719, 10], [1719, 2141, 11], [2141, 2958, 12], [2958, 3246, 13], [3246, 4028, 14], [4028, 4044, 15], [4044, 4324, 16], [4324, 4900, 17], [4900, 5541, 18], [5541, 5581, 19], [5581, 5600, 20], [5600, 5600, 21], [5600, 5920, 22], [5920, 6726, 23], [6726, 6807, 24], [6807, 6827, 25], [6827, 7130, 26], [7130, 7434, 27], [7434, 9780, 28], [9780, 9946, 29], [9946, 9946, 30], [9946, 10166, 31], [10166, 10187, 32], [10187, 11242, 33], [11242, 11416, 34], [11416, 11983, 35], [11983, 12731, 36], [12731, 13795, 37], [13795, 13812, 38], [13812, 14145, 39], [14145, 16305, 40], [16305, 16305, 41], [16305, 18814, 42], [18814, 18909, 43], [18909, 18938, 44], [18938, 18956, 45], [18956, 20097, 46], [20097, 20394, 47], [20394, 20428, 48], [20428, 21146, 49], [21146, 21603, 50], [21603, 23059, 51], [23059, 23159, 52], [23159, 24203, 53], [24203, 24523, 54], [24523, 25013, 55], [25013, 25597, 56], [25597, 25958, 57], [25958, 26711, 58], [26711, 27291, 59], [27291, 27358, 60], [27358, 27408, 61]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27408, 0.02186]]}
|
olmocr_science_pdfs
|
2024-12-02
|
2024-12-02
|
e7c25d2bbf9a8ab94724c40b7e68494258472438
|
StdTrip: An a priori design approach and process for publishing Open Government Data*
Percy E. Salas¹, Karin K. Breitman¹, Marco A. Casanova¹, José Viterbo²
¹Department of Informatics – PUC-Rio
Rio de Janeiro, RJ – Brazil CEP 22451-900
²Departamento de Ciência e Tecnologia – UFF
Rio das Ostras, RJ – Brazil CEP 28.890-000
{psalas, karin, casanova, viterbo}@inf.puc-rio.br
Abstract. Open Government Data (OGD) consists in the publication of public information data in formats that allow it to be shared, discovered, accessed and easily manipulated by those desiring the data. This approach requires the triplification of datasets, i.e., the conversion to RDF of database schemas and their instances. A key issue in this process is deciding how to represent database schema concepts in terms of RDF classes and properties. This is done by mapping database concepts to an RDF vocabulary, used as the base in which to generate the triples from. The construction of this vocabulary is extremely important, because the more standards are reused, the easier it will be to interlink the result to existing datasets. However, today’s tools do not support reuse of standard vocabularies in the triplification process, but rather they create new vocabularies. In this paper, we present the StdTrip process that guides users in the triplification process, while promoting the reuse of standard, W3C recommended, RDF vocabularies in the first place and, if not possible, by suggesting the reuse of other vocabularies already in employed by other RDF datasets on the Web.
1. Introduction
Open Government Data (OGD) means the publication of information produced, archived and distributed by public organizations (e.g. legal, financial, bibliographic) in open raw formats, and ways that make it accessible and readily available to all and allow reuse, such as the creation of data mashups, i.e., the merging of data from different data sources, producing comparative views of the combined information [Accar et al. 2009].
A database dump or zipped packages for bulk data download is a traditional – and crude – approach for publishing government data. In this case, third parties are capable of using tools to separate and extract the data from the HTML code, transforming it into a more automatic reusable format, and then mashing it up with other sources. However, this approach requires a large effort on the data consumer side. There are cases in which governments are providing access to information through specific APIs. In most cases, this means that the consumer has access to the data only in the way
* This research was made possible by grants number [E-26/170028/2008], from FAPERJ, and [557.128/2009-9], from CNPq, at the Brazilian Web Science Institute.
the producer thinks it should be accessed, e.g., through certain methods. The consumer does not have access to the raw data or to a holistic view of it.
Nevertheless, the focus of OGD is on publishing data that can be shared, discovered, accessed, and easily manipulated by those desiring the data [Bennet & Harvey 2009]. The Semantic Web provides a common framework that allows data to be shared and reused across applications, enterprises, and community boundaries. It offers technologies to describe, model and query these data. With the adoption of the Semantic Web approach, public organizations would be able to publish datasets annotated with domain-specific vocabularies, and offer query interfaces for applications in which to access public information in a non-predefined way. This would greatly improve the ability of third parties to use the information provided by governments in ways not previously available or planned.
A fundamental step in this approach consists in the conversion of a myriad of public information datasets, represented by database schemas and their instances, to RDF datasets. A key issue in this process, known as triplification, is deciding how to represent database schema concepts in terms of RDF classes and properties. This is done by mapping database concepts to an RDF vocabulary, to be used as the base in which to generate the RDF triples from. The construction of this vocabulary is extremely important, because the more one reuses well known standards, the easier it will be to interlink the result to other existing datasets [Breslin et al. 2009].
There are triplifying engines that provide support to the mechanical process of transforming relational data to RDF triples [Auer et al 2009, D2R Server1, OpenLink Virtuoso2]. However, they offer very little support to users during the conceptual modeling stage. In this paper, we present the StdTrip process that guides users in this process, while promoting the reuse of standard, W3C recommended, RDF vocabularies in the first place and, if not possible, by suggesting the reuse of other vocabularies already in employed by other RDF datasets on the Web.
The rest of this paper is divided as follow. In Section 2, we discuss the basic concepts involved in the process of interlinking newly produced datasets to existing ones. In Section 3, we explain the a priori matching approach. In Section 4, we present the StdTrip process to be used in the conceptual modeling stages of the triplification process. Finally, in Section 5, we discuss some limitations of our approach and the challenges to be met in the future.
2. Basic Concepts
Before describing our approach, we call attention to the process of interlinking newly produced datasets to existing ones. Briefly, this process consists of connecting the subject URI from one dataset with an object URI from another dataset by using links, expressed as RDF triples [Bizer et al. 2007].
This matching operation takes two vocabularies3 as input and produces a mapping between elements of the two. Many techniques support this process. e.g.
---
1 http://www4.wiwiss.fu-berlin.de/bizer/d2r-server/
2 http://virtuoso.openlinksw.com/
3 We use the term vocabulary in a very loose sense, inclusive of the notions of thesauri, ontologies and database schema, i.e., a generalization to designate any conceptual model that represents the organization of a data collection.
ontology alignment, schema matching and data fusion. Good surveys of such techniques are presented by [Rahm & Bernstein 2001], [Euzenat & Shvaiko 2007] and [Bleiholder & Nauman 2008].
Matching approaches may be classified as syntactic vs. semantic and, orthogonally, as a priori vs. a posteriori [Casanova et al. 2007]. The syntactic approach consists of matching two vocabularies based on syntactical hints, such as attribute data types and naming similarities. The semantic approach uses semantic clues to generate hypotheses about vocabulary matching. It generally tries to detect how real world objects are represented in different datasets, and leverages on the information obtained to match different URIs. Both syntactic and semantic approaches work a posteriori, in the sense that they start with existing datasets, and try to identify links between the two. This task is particularly time consuming, effort intensive and difficult to automate, as hinted by the simple example that follows, illustrated by Figure 1.
Consider two triple datasets, D1 and D2, whose application domains are not entirely clear. Assume that D1 has a set of classes named Games, with properties Name and ESRB (Entertainment Software Rating Board), and D2 has a set of classes named Gaming, with properties Name, Price, and Rating, as shown in Figure 1. Using only syntactical similarity, Games would probably match with Gaming, and the Name property in both sets would definitely match with one another, but ESRB would not match with Rating.
Now, if D1 and D2 describe stores that deal with computer game, e.g. BestBuy and Amazon, this matching is reasonable, though it still misses the match between ESRB and Rating, which can be assumed to refer to ratings assigned by the ESRB. However, if D1 describes the dataset of a travel agency specializing in safaris, matching Game (big game hunting) with Gaming (computer games) is obviously inaccurate. Unless the two datasets share a common vocabulary, there is no way to fully automate this process, human intervention will always be needed to identify possible matches and disambiguate dubious ones.
3. Designing for interoperability: The A Priori Approach
The *a priori* matching approach emphasizes that, “when specifying databases that need to interact with others, the designer should first select an appropriate standard, if one exists, to guide design of the resulting database. If none exists, the designer should publish a proposal for a common schema covering the application domain” [Casanova et al. 2007]. The same philosophy is applicable to Linked Data – the Semantic Web
standard upon is based the publication of OGD –, as stated by Bizer, Cyganiak and Heath: “in order to make it as easy as possible for client applications to process your data, you should reuse terms from well-known vocabularies wherever possible. You should only define new terms yourself if you can not find required terms in existing vocabularies” [Bizer et al. 2007].
Unfortunately, that is not what happens in practice. Most teams prefer to create new vocabularies (as do the vast majority of triplification tools), rather than spending time and effort to search for adequate matches [Kinsella et al. 2008]. We believe that is mostly due to the distributed nature of the Web itself, i.e., there is no central authority one can consult. Semantic search engines, such as Watson⁴, function as an approximation. Notwithstanding there are numerous standards that designers can not ignore when specifying triple sets and publishing their content. Table 1 presents a list of some of these. Again, the term standard is used in loose way, in that it encompasses vocabularies with different status (recommended, submitted, etc.) in regards with standard authorities.
Based on the notion that good design, based on agreed upon standards, will promote and facilitate future interoperability, we propose the StdTrip Process, detailed in the next section.
<table>
<thead>
<tr>
<th>Ontology Name</th>
<th>Prefix</th>
<th>Namespace</th>
</tr>
</thead>
<tbody>
<tr>
<td>Change Set</td>
<td>cs</td>
<td><a href="http://purl.org/vocab/changeset/schema#">http://purl.org/vocab/changeset/schema#</a></td>
</tr>
<tr>
<td>DBpedia Ontology</td>
<td>dbpedia</td>
<td><a href="http://dbpedia.org/ontology/">http://dbpedia.org/ontology/</a></td>
</tr>
<tr>
<td>Dcat: Data Catalog Vocabulary</td>
<td>dcat</td>
<td><a href="http://www.w3.org/ns/dcat#">http://www.w3.org/ns/dcat#</a></td>
</tr>
<tr>
<td>Dublin Core</td>
<td>dc</td>
<td><a href="http://purl.org/dc/elements/1.1/">http://purl.org/dc/elements/1.1/</a></td>
</tr>
<tr>
<td>Dublin Core Terms</td>
<td>dcterms</td>
<td><a href="http://purl.org/dc/terms/">http://purl.org/dc/terms/</a></td>
</tr>
<tr>
<td>FOAF: Friend Of A Friend</td>
<td>foaf</td>
<td><a href="http://xmlns.com/foaf/0.1/">http://xmlns.com/foaf/0.1/</a></td>
</tr>
<tr>
<td>Geo: Geo Positioning</td>
<td>geo</td>
<td><a href="http://www.w3.org/2003/01/geo/wgs84_pos#">http://www.w3.org/2003/01/geo/wgs84_pos#</a></td>
</tr>
<tr>
<td>GeoNames</td>
<td>gn</td>
<td><a href="http://www.geonames.org/ontology#">http://www.geonames.org/ontology#</a></td>
</tr>
<tr>
<td>MOAT: Meaning Of A Tag</td>
<td>moat</td>
<td><a href="http://moat-project.org/ns#">http://moat-project.org/ns#</a></td>
</tr>
<tr>
<td>Music Ontology</td>
<td>mo</td>
<td><a href="http://purl.org/ontology/mo/">http://purl.org/ontology/mo/</a></td>
</tr>
<tr>
<td>Programmes Ontology</td>
<td>po</td>
<td><a href="http://purl.org/ontology/po/">http://purl.org/ontology/po/</a></td>
</tr>
<tr>
<td>SIOC: Semantically-Interlinked Online Communities</td>
<td>sioc</td>
<td><a href="http://rdfs.org/sioc/ns#">http://rdfs.org/sioc/ns#</a></td>
</tr>
<tr>
<td>SKOS: Simple Knowledge Organization System</td>
<td>skos</td>
<td><a href="http://www.w3.org/2004/02/skos/core#">http://www.w3.org/2004/02/skos/core#</a></td>
</tr>
<tr>
<td>void: Vocabulary of Interlinked Datasets</td>
<td>void</td>
<td><a href="http://rdfs.org/ns/void#">http://rdfs.org/ns/void#</a></td>
</tr>
</tbody>
</table>
4. StdTrip Process
The StdTrip process aims at guiding users during the conceptual modeling stages of the triplification process. A good metaphor for it is that of translation, from the relational, to the RDF-triple model. Most triplifying tools today do that by mapping tables to RDF classes, and attributes to RDF properties, with no concern with identifying possible matches with existing standard vocabularies. Instead, these tools create new
⁴ http://watson.kmi.open.ac.uk/WatsonWUI/
vocabularies. However, we believe that the use of standards in schema design is the only viable way to guarantee future interoperability [Breitman et al. 2006, Casanova et al. 2009, Leme et al. 2010]. The StdTrip process is anchored in this principle, and strives to promote the reuse of standards by implementing a guided process (depicted in Figure 2), which comprises the six steps, summarized as follows:
1. **Conversion.** This step consists in transforming the structure of the relational database to an RDF ontology. In this stage, the designer may rely on approaches such as W-Ray [Piccinini et al. 2010], in which he manually defines a set of database views that capture which data should be published, and then specifies templates that indicate how RDF triples should be generated.
2. **Alignment.** This step uses the K-match ontology alignment tool\(^5\) to match the ontology obtained in Step 1 with the set of standard vocabularies in Table 1 (and others, if the tool is so configured). This operation provides, for each schema element (table or attribute) a list of possible matches. For example, a table named Person would be matched to foaf:maker, dc:creator.
3. **Selection.** This step presents to the user a list of possibilities from which he or she can select the vocabulary element that best represents each concept in the database.
4. **Inclusion.** If, for a given element, the process does not yield any result (there is no element in the known vocabularies that matches the concept in the database), or none of suggestions in the list is considered adequate by the user, StdTrip provides a list of triples from other vocabularies that might be a possible match. This is done using Watson, a Web interface for searching ontologies and semantic documents using keywords. The rationale is the following “if your concept is not covered by any of the known standards, look around and see how others dealt with it. By choosing a vocabulary already in use, you will make it easier to interlink your vocabulary in the future, than by creating a brand new vocabulary.”
5. **Completion.** If none works, users are directed to the Best Practice Recipes for Publishing RDF Vocabularies [Berrueta et al. 2008].
6. **Output.** The process outputs two artifacts: (1) a configuration file, to serve as the parameterization for a standard triplification tool. (2) an ontology that maximizes contains the mappings of the original database schema to standard RDF vocabularies.
---
5 K-match is a tool that combines the ontology matchers that obtained the highest rank for the last OAEI benchmark, i.e., Lily, Aroma and Anchor-Flood [Euzenat et al. 2009]. By combining the results from each matcher individually, K-match yields yet more accurate results.
5. Conclusions
We introduced the StdTrip process, that emphasizes a standard-based, a priori design of triples to promote interoperability and reuse, and to facilitate integration with other datasets. In parallel with the StdTrip, but still work in progress, we are developing a companion tool that, combined with any triplification tool, guides users in the process of modeling their original databases in terms of well-known, de facto RDF standard vocabularies. StdTrip is a finalist at the Triplification Challenge, the yearly organized competition that awards prizes to the most promising approaches using Semantic Web and Linked Data technologies [Salas et al. 2010]. Winners will be known during the International Conference on Semantic Systems, in Austria this coming September.
StdTrip was initially conceived to serve as an aid in a training course on Publishing Open Government Data in Brazil. Target audiences were assumed to have no familiarity with Semantic Web techniques, in general, nor with RDF vocabularies, in particular. To promote vocabulary and standard reuse, we needed to provide a tool that “had it all in one place”. The StdTrip approach served an educational purpose by “reminding” or by introducing vocabulary concepts users were unaware of.
The approach can be improved as follows. First, we must create an RDF graph representation of the database schema to be able to use the matching tool. The process implemented today is similar to the one used by the D2RServer tool, and it is very simple. Several improvements are possible. First, the structure of the database itself might be useful, e.g., foreign-keys should be mapped to object properties. We intend to experiment with reverse engineering the relational database, i.e., mapping relations schemes into entity-relationship diagrams [Casanova and Sá, 1984]. Entity relationship diagrams will provide good abstractions, e.g., subset, partonomy, that can be used to enrich and correlate RDF triple sets.
Secondly, we must observe that the database schema names, including table and column names, are typically inappropriate to be externalized. This implies that the designer must first define an external vocabulary, that is, a set of terms that will be used to communicate the data, materialized in the form of RDF triples, to Web users. That is to say that artificially generated primary keys, foreign keys that refer to such primary keys, attributes with domains that encode classifications or similar artifacts, if selected for the triplification process, should have their internal values replaced by their respective external definitions. For example, a classification code should be replaced by the description of the classification. Instance based approaches, such as the one proposed by Wang et al. [2004], might be useful. For example, an attribute named Ir675F, with the following format XXX-XXXXXXXXXX (where Xs are numbers) may easily be automatically identified as ISBN numbers. Finally, following the work of
[Sorrentino et al. 2009], we plan to use Wordnet extensions to expand and normalize the meaning of database comments, and use them as a source for additional semantics.
Furthermore, as users are likely to be confronted with more than one choice, e.g., foaf:Person or foaf:Agent, it would be a good idea to include a rationale capturing mechanism, even if informal, to register design decisions during the modeling (Steps 3 and 4). A what-who-why memory is a beneficial asset for future improvements and redesign of the dataset.
References
Wang, J., Wen, J., Lochovsky, F., and Ma, W. “Instance-based schema matching for web databases by domain-specific query probing”. In Proc. of the 13th Int’l. Conf. on Very Large Data Bases, pages 408–419.
|
{"Source-Url": "http://www-di.inf.puc-rio.br/~casanova//Publications/Papers/2010-Papers/2010-SBBD-StdTrip.pdf", "len_cl100k_base": 4454, "olmocr-version": "0.1.53", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 20383, "total-output-tokens": 5671, "length": "2e12", "weborganizer": {"__label__adult": 0.0003616809844970703, "__label__art_design": 0.0009469985961914062, "__label__crime_law": 0.0011472702026367188, "__label__education_jobs": 0.003604888916015625, "__label__entertainment": 0.00020205974578857425, "__label__fashion_beauty": 0.00024700164794921875, "__label__finance_business": 0.0019025802612304688, "__label__food_dining": 0.0004696846008300781, "__label__games": 0.0007185935974121094, "__label__hardware": 0.0007739067077636719, "__label__health": 0.0008974075317382812, "__label__history": 0.0009250640869140624, "__label__home_hobbies": 0.00016808509826660156, "__label__industrial": 0.0006260871887207031, "__label__literature": 0.0009369850158691406, "__label__politics": 0.0014591217041015625, "__label__religion": 0.0005741119384765625, "__label__science_tech": 0.36376953125, "__label__social_life": 0.00031280517578125, "__label__software": 0.11138916015625, "__label__software_dev": 0.50732421875, "__label__sports_fitness": 0.00021719932556152344, "__label__transportation": 0.0007624626159667969, "__label__travel": 0.00035119056701660156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22376, 0.03116]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22376, 0.43908]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22376, 0.85642]], "google_gemma-3-12b-it_contains_pii": [[0, 2762, false], [2762, 6181, null], [6181, 8805, null], [8805, 12351, null], [12351, 15121, null], [15121, 18132, null], [18132, 20961, null], [20961, 22376, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2762, true], [2762, 6181, null], [6181, 8805, null], [8805, 12351, null], [12351, 15121, null], [15121, 18132, null], [18132, 20961, null], [20961, 22376, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 22376, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22376, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22376, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22376, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 22376, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22376, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22376, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22376, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22376, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22376, null]], "pdf_page_numbers": [[0, 2762, 1], [2762, 6181, 2], [6181, 8805, 3], [8805, 12351, 4], [12351, 15121, 5], [15121, 18132, 6], [18132, 20961, 7], [20961, 22376, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22376, 0.17582]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
7169c5313a2f97adee7b8317563705013754be4d
|
Toward Constrained Semantic WoT
Remy Rojas, Lionel Médini, Amélie Cordier
To cite this version:
HAL Id: hal-01515382
https://hal.archives-ouvertes.fr/hal-01515382
Submitted on 27 Apr 2017
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.
Toward Constrained Semantic WoT
Remy Rojas
Univ Lyon
LIRIS, CNRS UMR5205
F-69622, Villeurbanne, France
remy.rojas@protonmail.com
Lionel Médini
Univ Lyon, Université Lyon 1
LIRIS, CNRS UMR5205
F-69622, Villeurbanne, France
firstname.lastname@liris.cnrs.fr
Amélie Cordier
Univ Lyon, Université Lyon 1
LIRIS, CNRS UMR5205
F-69622, Villeurbanne, France
firstname.lastname@liris.cnrs.fr
ABSTRACT
More and more things are now connected to the Internet and become part of the Web of Things. The notion of “thing” encompasses various types of devices, from complex robots to simple sensors. In particular, things may rely on limited memory, storage and computing capabilities. We propose an architecture able to embed both semantic and RESTful technologies into constrained things, while being generic and reconfigurable. It combines emerging standards such as CoAP and Hydra to split RDF graphs, process requests, and generate responses on-the-fly. We validate our proposition by implementing such a Server in an Arduino UNO.
Keywords
Semantic Web of Things; constrained, embedded, REST, Hydra, CoAP, arduino
1. INTRODUCTION
One of the WoT challenges is to provide building blocks for applications able to compose services offered by things as standard Web resources [4]. Relying on the Web – and REST principles – as a platform provides WoT applications with efficiency and scalability. One trend of the Web community consists in providing semantic, hypermedia-based documentations for Web APIs (aka RESTful services). This way, intelligent clients can navigate among resources and decide which service to use for a given purpose [14]. Achieving and combining these two objectives is an important direction towards which the W3C WoT Interest Group\(^1\) aims.
A promising solution consists in defining architectures able to provide clients with semantically described RESTful services (e.g. servients\(^2\) or avatars [8]), using for instance the Hydra [6] or the Thing Description\(^3\) vocabularies. From a pragmatic point of view, even if these architectures can theoretically be embedded in things, they can require a large amount of resources that may not be available on all devices. Indeed, there is currently no technology stack that allows at the same time discoverability, scalable access through Web standards and semantic interoperability, aimed to fit in constrained devices\(^4\). In order for such an architecture to meet the requirements of both the semantic WoT and constrained devices, it must satisfy the following requirements:
- **Energy efficiency**: Energy consumption of devices, especially battery-powered, should be optimized. In particular, during wireless network communications, the quantity of data transmitted should be minimized.
- **Computational resource efficiency**: Inside a server, implementing the network protocol stack requires computing resources. On constrained devices, such implementations should choose the adequate protocols to keep their memory footprint minimal.
- **Self-description**: Constrained devices should memorize their configuration in non-volatile memory, so that they can harmlessly be shut down and restarted, and send their API documentation to clients.
- **Availability**: Endpoints generated by constrained devices should be available as a Web resource and the required operations to solve requests should be kept minimal to limit processing time.
- **Scalability**: Web Servers embedded in constrained devices should be optimized to maximize the number of clients they can efficiently handle.
We herein propose a generic architecture designed to fit inside constrained devices, taking into account their limited resources while allowing them to provide clients with discoverable and interoperable access to their sensors and actuators. Our approach relies on two key technologies: Hydra for reconfigurable thing API documentations, and CoAP for block-wise transfers, which allow analysing and generating RDF graphs on the go. We intend to show how today’s Web tools can be used to embed semantic, RESTful and auto-descriptive services on such constrained devices. Our approach targets things equipped with a network interface capable of implementing the IP protocol and minimally constrained devices refer to connected things equipped with bare minimal power, energy, communication capabilities, and computing power (memory, processing, storage).
\(^1\)https://www.w3.org/WoT/IG/
\(^2\)https://w3c.github.io/wot/architecture/wot-architecture.html\#general-description-of-wot-servient
\(^3\)https://w3c.github.io/wot/current-practices/
\(^4\)wot-practices.html\#thing-description
structured with CPU, RAM and persistent memory, plus enough program memory to store the algorithms implementing this approach. To demonstrate our design we implement our solution in a constrained device: the Arduino UNO\(^5\).
Section 2 presents a state of the art regarding both semantics in the WoT and Technical aspects of Constrained Devices. Section 3 describes our proposition of architecture, along with the algorithm that links API semantic descriptions with the internal capabilities of a thing. Section 4 presents our implementation and evaluates our proposition against the above criteria. Section 5 concludes the paper.
2. STATE OF THE ART
2.1 Semantic Web and the IoT
Today, efforts are focused on solving heterogeneity of hardware, software, and syntactic formats in the IoT\(^1\). Through the IERC AC4\(^10\), Serrano et al. identified the problems yet to be solved in order to reach interoperability and underline the current lack of a widely used standard. Additionally, a number of initiatives tend to describe similar concepts and end up generating redundant ontologies, thus inducing the need of a commonly shared and accepted ontology\(^5\). This tendency is reinforced with projects such as Schema.org, a vocabulary created to promote the usage of a Web of Data which employs common semantics.
On the other hand, the Linked Data initiative\(^6\) encourages entities to publish structured data enriched with semantics and relies on the notion of hypermedia link to map them together. Lanthaler et al. point out that unfortunately, Linked data principles have not yet found widespread adoption among Web APIs\(^6\). Even though semantically annotating data is a big challenge today at a global scope, the services that deliver this data need also to be given meaning. This is especially true in IoT where heterogeneous devices, communication schemes and data are encountered. Guinard et al. proposed a semantic description of services in the WoT by the means of JSON on Wireless Sensor Networks\(^7\). Their work stresses the use of RESTful architectures as part of the WoT. Lanthaler et al. share the same vision, in which the description of services that link the data also need to be specified with semantics. Their efforts resulted in Hydra\(^6\), a vocabulary designed to describe Web APIs in RDF applying Linked Data principles to RESTful services.
An example of application of Hydra in the WoT can be found in\(^13\). Ventura et al. demonstrate how a semantic web client is able to discover self-describing APIs and to query and build request sequences with no previous knowledge of these APIs. Their implementation uses Notation3 (N3) pre and postconditions rules to describe services, and JSON-LD\(^7\) as a vehicle to transport self-describing state transfers. Although we use this work as one of the starting points of our contribution, it is unfortunately too heavy to be embedded in constrained devices.
2.2 Constrained Devices and the Web
A Constrained Device or Node, as defined in IETF’s RFC 7228 “Terminology for Constrained-Node Networks”, is a device where “the characteristics that are often taken for granted for an Internet node are not attainable at the time of writing, due to constraints of cost and physical nature, such as limited battery and computing power, little memory, and insufficient wireless bandwidth and ability to communicate”\(^2\). Some facets often apply combinations of maximum code complexity (ROM, Flash), size of state complexity (RAM), processing power, available power, and user interface and accessibility in deployment.
Research work in the Sensor Network field faces challenges that are often applied to constrained nodes. Wireless Sensor Networks have also implemented power saving modes of operation such as Power Aware Sensor Model, Event Generation Model, Energy workload Model among others\(^12\). Another Sensor Network initiative\(^9\) reuses concepts from smart homes such as the 6LoWPAN TCP/IP stack on top of which sensor data is expressed in JSON rather than XML, since the payload size is decreased. To tackle this issue, the W3C has initiated work on Efficient XML Interchange (EXI)\(^8\), which aims at dramatically reducing message payloads. These works stress the importance of REST architectures on top of HTTP and minimal payload size.
However, even though HTTP and TCP are widely accepted and used in today’s WWW, there exist alternatives better adapted to Constrained Devices. Constrained Application Protocol (CoAP)\(^11\) was conceived by the IETF CoRE task force\(^3\). It has been specially designed to fit Constrained Devices, by implementing a minimal header, while still enabling devices to keep track of multiple client requests, URI components, payload types, message codes, amongst other features found in traditional HTTP/TCP. As Castellani et al. mention, CoAP’s similarity to the aforementioned protocols makes it easy for HTTP clients or servers to interact, since all that is needed is a translation-proxy between them\(^3\). Moreover, CoAP servers are able to implement REST principles, even while relying on UDP, a simpler protocol compared to TCP’s and its range of technologies.
CBOR\(^10\) stands for Concise Binary Object Representation. A JSON-compatible model expressed in binary. Its code size is greatly reduced in comparison to traditional JSON. It is an advantageous approach when dealing with tight and bad quality networks, since the data to be transmitted does not require a significant number of packets. We find it disadvantageous to use since we already process JSON. Developing a module to encode/decode CBOR is an additional unnecessary load for an already limited memory.
3. ARCHITECTURE
We herein propose the conceptual architecture of a server designed to be implemented in constrained devices, and able to communicate with its clients by exchanging RDF graphs, serialized in JSON-LD. Network communications rely on the CoAP protocol that fits both constrained devices and REST. As the server exposes a semantic and RESTful API, it documents this API according to the Hydra specification.
Through this means, it can handle three types of requests:
- The server responds to documentation requests by sending an RDF document generated according to the device internal configuration.
\(^3\)https://www.w3.org/XML/EXI/
\(^9\)https://datatracker.ietf.org/wg/core/documents/
\(^10\)urlhttp://cbor.io
Configuration requests allow clients to choose which of the available operations on the object are to be enabled, disabled or configured. This gives the user control over which services are available at any given time. With the help of non-volatile memory, the state of enabled operations can be stored, which makes such configuration resilient to shutdowns, down-time and power shortages.
Operational requests allow clients to query the sensors and actuators connected to the device and enabled in its configuration, in a semantic and RESTful manner.
The different building blocks of our architecture are depicted in Figure 1 and Figure 2. The most important of them are detailed below.
The RAM contains complete representations of the server current configuration. Clients can only request services provided by operations stored in RAM at the time of the request. RAM variables establish the link between the semantic layer and the internal functions that access the configuration and the devices. These representations are necessary for the main algorithm to execute the correct function and write a complete response, including any result obtained from a correctly requested service.
The Device Configuration stores information about the state and configuration of the object. It may vary from object to object, but the interest is that probably not all the possible capabilities of an object need nor can be available at any given time. It stores the service configurations that were made available by users as well as the involved physical components. It also acts as a backup to restore the setup previous to a power cut, intentional or not.
The Semantic Service Repository stores JSON-LD Semantic annotations. The algorithm refers to this memory space whenever it needs to send or interpret JSON-LD documents.
The design of the server relies on the following technical principles. Switching to CoAP from traditional HTTP gives a more in-depth packet control and allows for streaming of large payloads. Indeed, using the CoAP Block-wise Transfer option on top of UDP as a synchronous transport solution removes package size limitations. Taking into consideration that most clients on the Web do not implement CoAP, we developed a simple translation proxy from and to HTTP meant to be ran outside the constrained device.
3.1 API and Semantics
To illustrate the semantic aspects of our approach, we propose the following application scenario: a crop field is populated with numerous constrained things, disseminated over the field. Each of these fixed things can bear different sensors and actuators. Mobile clients such as drones can move over the field, discover the available fixed things and interact with them. As all these things embed their own semantic descriptions, the client can more easily integrate data and service descriptions, reason about them, and provoke an “intelligent” global behavior, such as watering the parts of the field that lack water or guide other objects to cure diseases detected on the plants. Let us consider one of these single fixed things, equipped with a temperature sensor.
to sense weather conditions and an infrared LED that moving objects can use to proceed to the plant. It exposes a set of physical operations, aka Capabilities [8], and is able to serve a Hydra API documentation, as well as to respond to client requests concerning these capabilities.
By relying on Hypermedia, JSON-LD documents can reference context definitions and concepts that are served elsewhere. Using this mechanism, the constrained thing server only exposes the specific parts of its documentation and refers to a common ontology, shared with all other disseminated servers. Referencing this ontology allows to minimize the information embedded in the objects themselves, while maintaining semantic consistency. Figure 3 illustrates the minimal API description stored on the thing, and Figure 4 the global ontology 11.
At the root of the API is a Hydra EntryPoint that leads to a collection of the above mentioned Capabilities. A capability instance can expose one or both of the capability_retrieve and capability_update hydra operations. Our ontology relies on the SSN vocabulary 12 to define the respective outputs and inputs of these operations. In order for the things to be able to expose instances of ssn:Output/ssn:Input (which are disjoint) and hydra:Class, the ontology respectively provides the asawoo:Value and asawoo:Command classes. Things, however, are responsible to provide the data types they deal with. For instance, in our scenario, the thing uses SAREF 13 for describing a temperature, but another vocabulary could have been used.
The API documentation is queried and processed by clients. They can take advantage of the descriptions in this documentation according to the level of expressivity present in the descriptions and to the clients’ “understanding” (i.e. reasoning) capabilities. This allows them to query the services provided in RAM.
3.2 Startup
Whenever the device is powered up, reset, or flashed, the initial setup is immediately executed once. During this setup two classes are instantiated:
- Coap: our implementation of the CoAP protocol, which is used to handle incoming and outgoing packages. In it we find operations to manipulate payloads, as well as every function that will directly read and write a network packet.
- Resource Manager: a class created to handle representations of the semantic concepts, as well as the link between semantics and low level I/O functions, which most of the time involve Sensor/Actuator calls.
The server populates at startup a set of global variables concerning the enabled operations (list of services, service URIs, port mappings) from the Device Configuration, so that they are available in RAM. Although all possible operations are listed in the Semantic Service Repository, only the ones present in the configuration are instantiated as service templates that will be used to parse and serialize semantic information. Consequently, all necessary information is accessible to algorithm modules to perform operations. This behaviour is represented in Figure 1.a.
3.3 Thing Configuration
Enabling a service at runtime resembles a request processing, the only difference is instead of acting on a sensor/actuator, its provokes the writing of new information in the Device Configuration.
To enable/disable a service, the client must request the corresponding service URI and provide logical data about its new configuration. The semantics related to the availability of a service are defined by it’s boolean “EnabledStatus” property. Activation of a service is shown in Figure 1.b.
3.4 Request Processing
When a CoAP packet is received, relevant data relative to the currently requested service is saved, meanwhile the algorithm streams the incoming packages using block-wise,
and recycling the inbound buffers in an effort to maximize available space in memory.
Once all relevant information for a service is retrieved from the request and completeness is detected, the corresponding Sensor/Actuator function for that specific service is triggered. The return values are stored in a buffer. The server then sends the corresponding response using (once again) block-wise transfer. When writing into the outbound buffer, the JSON-LD payload is generated using the Service Template, and is complemented by the results retrieved from the operations on sensors and actuators, thus forming a complete response. The whole process is represented in Figure 2.a and Figure 2.b.
4. EVALUATION
We previously defined a set of criteria to enable constrained devices to integrate the semantic Web of Things: Discoverability, Self-description, Scalability, and Power and Computational Resource efficiency. As a proof of concept, we evaluate these criteria on an Arduino UNO implementation.
4.1 Implementation
The Arduino UNO and similar devices are microcontrollers conceived to host flashed C++ compiled code, also called sketch. We make use of libraries that let us interact with the physical/electronic modules as well as UDP packages. The Arduino UNO’s memory specification is detailed in Table 1. Arduino boards provide access to I/O ports, or pins. Either analog or digital, they connect the board to sensors and actuators through libraries provided by the SDK.
<table>
<thead>
<tr>
<th>Program Space</th>
<th>RAM</th>
<th>Non-volatile (EEPROM)</th>
</tr>
</thead>
<tbody>
<tr>
<td>32KB read-only</td>
<td>2KB read/write</td>
<td>1KB read/write</td>
</tr>
</tbody>
</table>
Table 1: Arduino UNO Memory Specification
Open source CoAP implementations are, to the best of our knowledge, not yet ported to Arduino UNO boards, which is why we developed our own. Due to its size, the Semantic Server Repository SSR needs to be stored in the device’s Program Space. The text based descriptions take several KBytes, and storing them as standard strings at runtime would easily overflow the Arduino’s RAM. AVR libraries available on Arduino boards provide a set of tools to manipulate Program Space pointers, which help overcome this issue. We use the non-volatile EEPROM memory to store the Device Configuration. By serializing the information about the ID and pins for a service, we effectively describe the physical configuration, as well as providing the necessary information to later fetch a service in the SSR, resulting in a list of enabled services in RAM. We developed a proxy translating headers from HTTP into CoAP and vice versa. It was developed with the TxThings\(^{14}\) library and the Twisted Framework\(^{15}\) in Python2. The implementation is represented in Figure 5.
4.2 Experimentation
Arduino devices provide a simple logging tool through a serial connection that allows us to print text during execution. Thanks to it and the observable behaviour of the board we are able to have some degree of debugging. We test the 3 primary capabilities of our architecture:
- **Service persistence/startup**: Verifying the configuration is correctly saved. The same service should respond before and after removing the power source, effectively shutting down the device. To do so, we simply power off the device after using a service. We succeed if the service yields the same previous behaviour.
- **Enabling a new service**: Making a new service available by modifying its Enabled property and specifying its configuration. This is done by performing a POST request on /service_name/enable, including information about the physical configuration in the payload. If successful, the device responds with a 2.04 Changed CoAP message. We then request the service itself and verify the output matches our expectations.
4.3 Results
The CoAP protocol offers the option for any party to set the payload size. We take advantage of this fact to ensure CoAP packets never encapsulate more than 64Bytes, thus transmitting 130Bytes at most between the proxy and the Arduino. Furthermore, taking into account the synchronous nature of the protocol, the bandwidth consumed remains under the maximum mentioned previously. We recall and evaluate the criteria we defined to embed a semantic server into a constrained device:
- Since most clients on the Web rather implement HTTP than CoAP, our HTTP translation Proxy compensates the discoverability drawbacks. Yet, it is not necessary to go through this proxy, which allows other CoAP clients to communicate directly, effectively widening the spectrum of possible requesting parties.
\(^{14}\)TxThings: https://github.com/mwasilak/txThings
\(^{15}\)Twisted Framework: http://twistedmatrix.com/trac/
- Services are serialized in JSON-LD and stored in Program Memory. Referencing further definitions on an external server allows us to save up to 31.2KBytes of data, close to 100% of total Program Memory. The remaining local semantics allows the API documentation to be self-descriptive, allowing semantic clients to converge requests at runtime.
- Power efficiency is achieved thanks to the persistence of configuration and services; we can imagine scenarios where current is cut on an object by an external factor or in periodic cycles to maximise its lifetime.
- Computational Resource Efficiency is achieved through the properties a service needs to be available; non-configured services stay in the SSR, which means they have no representation in RAM or the configuration, effectively reducing memory load. RAM usage can be visualised in table 2. With a cost of 93Bytes, 10 Capabilities can be instantiated simultaneously.
- Our architecture is able to apply some REST principles that facilitate scalability. Client-state representation is not kept in memory, and there is no out of the band knowledge necessary to retrieve URLs.
5. CONCLUSION
A big number of things are flourishing with the potential to integrate the Web in the coming years. As of today, no clear standard technology stack is ready to integrate them to the Web due to their heterogeneity. This is especially true for constrained devices, that can not rely on extensive resources to support typical Web technologies. Furthermore the price on hardware for Web-capable devices represents a major obstacle for the widespread adoption of these technologies. Embedding them in ever smaller devices minimizes the influence of this factor. The technical feasibility depended on the ability of the chosen tools and standards to fit in the constrained setup of the device. We can imagine better devices to embed the proposed architecture, but we intentionally chose an Arduino UNO to demonstrate that it is capable to cope with our expectations.
We herein proposed a minimal architecture to enhance constrained devices with semantics and improve their interoperability with Web standards. We contribute to a more distributed semantic Web, encouraging the creation of intelligent clients. Our contribution meet a certain number of criteria: discoverability through the use of commonly used technologies, power efficiency by implementing persistent configuration, computational resource efficiency by allowing only configured services to be available, self-description through semantic descriptions of APIs, and scalability by implementing REST principles.
We envisage further work towards implementing a RESTful agent instead of just servers, to learn and generate requests to other connected objects on the Web and then participate in physical mashups, as well as enabling the proxy to serve as a cache and content negotiator.
Acknowledgement
This work is supported by the French Agence Nationale pour la Recherche (ANR) under the grant <ANR-13-INFR-012>.
6. REFERENCES
|
{"Source-Url": "https://hal.archives-ouvertes.fr/hal-01515382/file/Constrained-semantic-web.pdf", "len_cl100k_base": 5308, "olmocr-version": "0.1.53", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 20433, "total-output-tokens": 6694, "length": "2e12", "weborganizer": {"__label__adult": 0.0005016326904296875, "__label__art_design": 0.001003265380859375, "__label__crime_law": 0.0004925727844238281, "__label__education_jobs": 0.0004436969757080078, "__label__entertainment": 0.000186920166015625, "__label__fashion_beauty": 0.0002474784851074219, "__label__finance_business": 0.0002791881561279297, "__label__food_dining": 0.0005326271057128906, "__label__games": 0.0006427764892578125, "__label__hardware": 0.0063629150390625, "__label__health": 0.0008726119995117188, "__label__history": 0.0006661415100097656, "__label__home_hobbies": 0.00017440319061279297, "__label__industrial": 0.0007576942443847656, "__label__literature": 0.0004954338073730469, "__label__politics": 0.0003786087036132813, "__label__religion": 0.0008535385131835938, "__label__science_tech": 0.37744140625, "__label__social_life": 0.00012731552124023438, "__label__software": 0.014404296875, "__label__software_dev": 0.59130859375, "__label__sports_fitness": 0.0003287792205810547, "__label__transportation": 0.001163482666015625, "__label__travel": 0.0003287792205810547}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29550, 0.03923]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29550, 0.31499]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29550, 0.88382]], "google_gemma-3-12b-it_contains_pii": [[0, 1033, false], [1033, 5685, null], [5685, 12124, null], [12124, 15251, null], [15251, 19025, null], [19025, 23730, null], [23730, 29550, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1033, true], [1033, 5685, null], [5685, 12124, null], [12124, 15251, null], [15251, 19025, null], [19025, 23730, null], [23730, 29550, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29550, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29550, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29550, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29550, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29550, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29550, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29550, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29550, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29550, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29550, null]], "pdf_page_numbers": [[0, 1033, 1], [1033, 5685, 2], [5685, 12124, 3], [12124, 15251, 4], [15251, 19025, 5], [19025, 23730, 6], [23730, 29550, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29550, 0.02326]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
8dd4a8c6428a530a98ddf65edc44915b31abfb06
|
Getting started with Kubernetes
Find out how Kubernetes is an elegant solution to a wide range of essential business problems.
What is Opensource.com?
**OPENSOURCE.COM** publishes stories about creating, adopting, and sharing open source solutions. Visit Opensource.com to learn more about how the open source way is improving technologies, education, business, government, health, law, entertainment, humanitarian efforts, and more.
Submit a story idea: https://opensource.com/story
Email us: open@opensource.com
SCOTT MCCARTY
SCOTT MCCARTY AT RED HAT, SCOTT MCCARTY IS TECHNICAL PRODUCT MANAGER for the container subsystem team, which enables key product capabilities in OpenShift Container Platform and Red Hat Enterprise Linux. Focus areas includes container runtimes, tools, and images. Working closely with engineering teams, at both a product and upstream project level, he combines personal experience with customer and partner feedback to enhance and tailor strategic container features and capabilities.
Scott is a social media start-up veteran, an e-commerce old timer, and a weathered government research technologist, with experience across a variety of companies and organizations, from seven person startups to 12,000 employee technology companies. This has culminated in a unique perspective on open source software development, delivery, and maintenance.
FOLLOW SCOTT MCCARTY
Twitter: https://twitter.com/fatherlinux
## INTRODUCTION
Kubernetes is a dump truck: Here’s why
## CHAPTERS
<table>
<thead>
<tr>
<th>Topic</th>
<th>Page</th>
</tr>
</thead>
<tbody>
<tr>
<td>How to navigate the Kubernetes learning curve</td>
<td>6</td>
</tr>
<tr>
<td>Kubernetes basics: Learn how to drive first</td>
<td>8</td>
</tr>
<tr>
<td>4 tools to help you drive Kubernetes</td>
<td>10</td>
</tr>
<tr>
<td>Why containers and Kubernetes have the potential to run almost anything</td>
<td>14</td>
</tr>
</tbody>
</table>
## GET INVOLVED | ADDITIONAL RESOURCES
<table>
<thead>
<tr>
<th>Topic</th>
<th>Page</th>
</tr>
</thead>
<tbody>
<tr>
<td>Write for Us</td>
<td>15</td>
</tr>
</tbody>
</table>
Kubernetes is a dump truck: Here’s why
Dump trucks are an elegant solution to a wide range of essential business problems.
**Dump trucks are elegant.** Seriously, stay with me for a minute. They solve a wide array of technical problems in an elegant way. They can move dirt, gravel, rocks, coal, construction material, or road barricades. They can even pull trailers with other pieces of heavy equipment on them. You can load a dump truck with five tons of dirt and drive across the country with it. For a nerd like me, that’s elegance.
But, they’re not easy to use. Dump trucks require a special driver’s license. They’re also not easy to equip or maintain. There are a ton of options when you buy a dump truck and a lot of maintenance. But, they’re elegant for moving dirt.
You know what’s not elegant for moving dirt? A late-model, compact sedan. They’re way easier to buy. Easier to drive. Easier to maintain. But, they’re terrible at carrying dirt. It would take 200 trips to carry five tons of dirt, and nobody would want the car after that.
Alright, you’re sold on using a dump truck, but you want to build it yourself. I get it. I’m a nerd and I love building things. But…
If you owned a construction company, you wouldn’t build your own dump trucks. You definitely wouldn’t maintain the supply chain to rebuild dump trucks (that’s a big supply chain). But you would learn to drive one.
OK, my analogy is crude but easy to understand. Ease of use is relative. Ease of maintenance is relative. Ease of configuration is relative. It really depends on what you are trying to do. Kubernetes [1] is no different.
Building Kubernetes once isn’t too hard. Equipping Kubernetes? Well, that gets harder. What did you think of KubeCon? How many new projects were announced? Which ones are “real”? Which ones should you learn? How deeply do you understand Harbor, TikV, NATD, Vitess, Open Policy Agent? Not to mention Envoy, eBPF, and a bunch of the underlying technologies in Linux? It feels a lot like building dump trucks in 1904 with the industrial revolution in full swing. Figuring out what screws, bolts, metal, and pistons to use. (Steampunk, anyone?)
Building and equipping Kubernetes, like a dump truck, is a technical problem you probably shouldn’t be tackling if you are in financial services, retail, biological research, food services, and so forth. But, learning how to drive Kubernetes is definitely something you should be learning.
Kubernetes, like a dump truck, is elegant for the wide variety of technical problems it can solve (and the ecosystem it drags along). So, I’ll leave you with a quote that one of my computer science professors told us in my first year of college. She said, “one day, you will look at a piece of code and say to yourself, ‘now that’s elegant!’”
Kubernetes is elegant.
Links
[1] https://kubernetes.io/
GETTING STARTED WITH KUBERNETES ! CC BY-SA 4.0 ! OPENSOURCE.COM
How to navigate the Kubernetes learning curve
Kubernetes is like a dump truck. It’s elegant for solving the problems it’s designed for, but you have to master the learning curve first.
THE JOURNEY TO KUBERNETES [1] often starts with running one container on one host. You quickly discover how easy it is to run new versions of software, how easy it is to share that software with others, and how easy it is for those users to run it the way you intended.
But then you need
- Two containers
- Two hosts
It’s easy to fire up one web server on port 80 with a container, but what happens when you need to fire up a second container on port 80? What happens when you are building a production environment and you need the containerized web server to fail over to a second host?
The short answer, in either case, is you have to move into container orchestration.
Inevitably, when you start to handle the two containers or two hosts problem, you’ll introduce complexity and, hence, a learning curve. The two services (a more generalized version of a container) / two hosts problem has been around for a long time and has always introduced complexity.
Historically, this would have involved load balancers, clustering software, and even clustered file systems. Configuration logic for every service is embedded in every system (load balancers, cluster software, and file systems). Running 60 or 70 services, clustered, behind load balancers is complex. Adding another new service is also complex. Worse, decommissioning a service is a nightmare. Thinking back on my days of troubleshooting production MySQL and Apache servers with logic embedded in three, four, or five different places, all in different formats, still makes my head hurt.
Kubernetes elegantly solves all these problems with one piece of software:
1. Two services (containers): Check
2. Two servers (high availability): Check
3. Single source of configuration: Check
4. Standard configuration format: Check
5. Networking: Check
6. Storage: Check
7. Dependencies (what services talk to what databases): Check
8. Easy provisioning: Check
9. Easy de-provisioning: Check (perhaps Kubernetes’ most powerful piece)
Wait, it’s starting to look like Kubernetes is pretty elegant and pretty powerful. It is. You can model an entire miniature IT universe in Kubernetes.
So yes, there is a learning curve when starting to use a giant dump truck (or any professional equipment). There’s also a learning curve to use Kubernetes, but it’s worth it because you can solve so many problems with one tool. If you are apprehensive about the learning curve, think through all the underlying networking, storage, and security problems in IT infrastructure and envision their solutions today—they’re not easier. Especially when you introduce more and more services, faster and faster. Velocity is the goal nowadays, so give special consideration to the provisioning and de-provisioning problem.
But don’t confuse the learning curve for building or equipping Kubernetes (picking the right mud flaps for your dump truck can be hard, LOL) with the learning curve for using it. Learning to build your own Kubernetes with so many different choices at so many different layers (container engine, logging, monitoring, service mesh, storage, networking), and then maintaining updated selections of each component every six months, might not be worth the investment—but learning to use it is absolutely worth it.
I eat, sleep, and breathe Kubernetes and containers every day, and even I struggle to keep track of all the major new projects announced literally almost every day. But there isn’t a day that I’m not excited about the operational benefits of having a single tool to model an entire IT universe. Also, remember Kubernetes has matured a ton and will continue to do so. Like Linux and OpenStack before it, the interfaces and de facto projects at each layer will mature and become easier to select.
Links
[1] https://kubernetes.io/
Kubernetes basics:
Learn how to drive first
Quit focusing on new projects and get focused on getting your Kubernetes dump truck commercial driver’s license.
RECENTLY, I SAW A THREAD ON REDDIT about essential Kubernetes projects[1]. People seem hungry to know the bare minimum they should learn to get started with Kubernetes. The “driving a dump truck analogy” helps frame the problem to stay on track. Someone in the thread mentioned that you shouldn’t be running your own registry unless you have to, so people are already nibbling at this idea of driving Kubernetes instead of building it.
The API is Kubernetes’ engine and transmission. Like a dump truck’s steering wheel, clutch, gas, and brake pedal, the YAML or JSON files you use to build your applications are the primary interface to the machine. When you’re first learning Kubernetes, this should be your primary focus. Get to know your controls. Don’t get sidetracked by all the latest and greatest projects. Don’t try out an experimental dump truck when you are just learning to drive. Instead, focus on the basics.
Defined and actual states
First, Kubernetes works on the principles of defined state and actual state.
Humans (developers/sysadmins/operators) specify the defined state using the YAML/JSON files they submit to the Kubernetes API. Then, Kubernetes uses a controller to analyze the difference between the new state defined in the YAML/JSON and the actual state in the cluster.
In the example “Defined state and actual state,” the Replication Controller sees the difference between the three pods specified by the user, with one Pod running, and schedules two more. If you were to log into Kubernetes and manually kill one of the Pods, it would start another one to replace it—over and over and over. Kubernetes does not stop until the actual state matches the defined state. This is super powerful.
Primitives
Next, you need to understand what primitives you can specify in Kubernetes.
It’s more than just Pods; it’s Deployments, Persistent Volume Claims, Services, routes, etc. With Kubernetes platform OpenShift [2], you can add builds and BuildConfigs. It will take you a day or so to get decent with each of these primitives. Then you can dive in deeper as your use cases become more complex.
Mapping developer-native to traditional IT environments
Finally, start thinking about how this maps to what you do in a traditional IT environment.
The user has always been trying to solve a business problem, albeit a technical one. Historically, we have used things like playbooks to tie business logic to sets of IT systems with a single language. This has always been great for operations staff, but it gets hairier when you try to extend this to developers.
We have never been able to truly specify how a set of IT systems should behave and interact together, in a de-
Kubernetes basics: Learn how to drive first
If you think about it, we are extending the ability to manage storage, network, and compute resources in a very portable and declarative way with the YAML/JSON files we write in Kubernetes, but they are always mapped back to “real” resources somewhere. We just don’t have to worry about it in developer mode.
So, quit focusing on new projects in the Kubernetes ecosystem and get focused on driving it.
Links
[1] https://www.reddit.com/r/kubernetes/comments/bsoi4x/what_are_the_essential_kubernetes_related/
4 tools to help you drive Kubernetes
Learning to drive Kubernetes is more important that knowing how to build it, and these tools will get you on the road fast.
I want to emphasize this point: the set of primitives that you need to learn are the easiest set of primitives that you can learn to achieve production-quality application deployments (i.e., high-availability [HA], multiple containers, multiple applications). Stated another way, learning the set of primitives built into Kubernetes is easier than learning clustering software, clustered file systems, load balancers, crazy Apache configs, crazy Nginx configs, routers, switches, firewalls, and storage backends—all the things you would need to model a simple HA application in a traditional IT environment (for virtual machines or bare metal).
In this article, I’ll share some tools that will help you learn to drive Kubernetes quickly.
1. Katacoda
Katacoda [1] is the easiest way to test-drive a Kubernetes cluster, hands-down. With one click and five seconds of time, you have a web-based terminal plumbed straight into a running Kubernetes cluster. It’s magnificent for playing and learning. I even use it for demos and testing out new ideas. Katacoda provides a completely ephemeral environment that is recycled when you finish using it.
Katacoda provides ephemeral playgrounds and deeper lab environments. For example, the Linux Container Internals Lab [4], which I have run for the last three or four years, is built in Katacoda.
Katacoda maintains a bunch of Kubernetes and cloud tutorials [5] on its main site and collaborates with Red Hat to support a dedicated learning portal for OpenShift [6]. Explore them both—they are excellent learning resources.
When you first learn to drive a dump truck, it’s always best to watch how other people drive first.
2. Podman generate kube
The `podman generate kube` command is a brilliant little subcommand that helps users naturally transition from a simple container engine running simple containers to a cluster use case running many containers (as I described in the last chapter). Podman [7] does this by letting you start a few containers, then exporting the working Kube YAML, and firing them up in Kubernetes. Check this out (psst, you can run it in this Katacoda lab [8], which already has Podman and OpenShift).
First, notice the syntax to run a container is strikingly similar to Docker:
```
podman run -dt two-pizza quay.io/fatherlinux/two-pizza
```
But this is something other container engines don’t do:
```
podman generate kube two-pizza
```
The output:
```yaml
# Generation of Kubernetes YAML is still under development!
# Save the output of this file and use kubectl create -f to import
# it into Kubernetes.
# Created with podman-1.3.1
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: "2019-06-07T08:08:12Z"
labels:
app: two-pizza
name: two-pizza
spec:
containers:
- command:
- /bin/sh
- "bash -c \\
"while true; do /usr/bin/nc -l -p 3306 < /srv/hello.txt; done"
env:
- name: PATH
value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin/bin
- name: TERM
value: xterm
- name: HOSTNAME
- name: container
value: oci
image: quay.io/fatherlinux/two-pizza:latest
name: two-pizza
resources: {}
securityContext:
allowPrivilegeEscalation: true
capabilities: {}
privileged: false
readOnlyRootFilesystem: false
tty: true
workingDir: /
status: {}
---
apiVersion: v1
kind: Service
metadata:
creationTimestamp: "2019-06-07T08:08:12Z"
labels:
app: two-pizza
name: two-pizza
spec:
selector:
app: two-pizza
type: NodePort
status: {}
```
You now have some working Kubernetes YAML, which you can use as a starting point for mucking around and learning, tweaking, etc. The `-s` flag created a service for
you. Brent Baude [9] is even working on new features like adding Volumes/Persistent Volume Claims [10]. For a deeper dive, check out Brent’s amazing work in his blog post “Podman can now ease the transition to Kubernetes and CRI-O.” [11]
3. oc new-app
The **oc new-app** command is extremely powerful. It’s OpenShift-specific, so it’s not available in default Kubernetes, but it’s really useful when you’re starting to learn Kubernetes. Let’s start with a quick command to create a fairly sophisticated application:
```
oc new-project -n example
```
With **oc new-app**, you can literally steal templates from the OpenShift developers and have a known, good starting point when developing primitives to describe your own applications. After you run the above command, your Kubernetes namespace (in OpenShift) will be populated by a bunch of new, defined resources.
```
oc get all
```
See the “occ new-app output”:
The beauty of this is that you can delete Pods, watch the replication controllers recreate them, scale Pods up, and scale them down. You can play with the template and change it for other applications (which is what I did when I first started).
4. Visual Studio Code
I saved one of my favorites for last. I use vi [12] for most of my work, but I have never found a good syntax highlighter and code completion plugin for Kubernetes (if you have one, let me know). Instead, I have found that Microsoft’s
<table>
<thead>
<tr>
<th>NAME</th>
<th>READY</th>
<th>STATUS</th>
<th>RESTARTS</th>
<th>AGE</th>
</tr>
</thead>
<tbody>
<tr>
<td>pod/cakephp-mysql-example-1-build</td>
<td>0/1</td>
<td>Completed</td>
<td>0</td>
<td>4m</td>
</tr>
<tr>
<td>pod/cakephp-mysql-example-1-gz65l</td>
<td>1/1</td>
<td>Running</td>
<td>0</td>
<td>1m</td>
</tr>
<tr>
<td>pod/mysql-1-nkhnq</td>
<td>1/1</td>
<td>Running</td>
<td>0</td>
<td>4m</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>NAME</th>
<th>DESIRED</th>
<th>CURRENT</th>
<th>READY</th>
<th>AGE</th>
</tr>
</thead>
<tbody>
<tr>
<td>replicationcontroller/cakephp-mysql-example-1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1m</td>
</tr>
<tr>
<td>replicationcontroller/mysql-1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>4m</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>NAME</th>
<th>TYPE</th>
<th>CLUSTER-IP</th>
<th>EXTERNAL-IP</th>
<th>PORT(S)</th>
<th>AGE</th>
</tr>
</thead>
<tbody>
<tr>
<td>service/cakephp-mysql-example</td>
<td>ClusterIP</td>
<td>172.30.234.135</td>
<td><none></td>
<td>8888/TCP</td>
<td>4m</td>
</tr>
<tr>
<td>service/mysql</td>
<td>ClusterIP</td>
<td>172.30.13.195</td>
<td><none></td>
<td>3306/TCP</td>
<td>4m</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>NAME</th>
<th>REVISION</th>
<th>DESIRED</th>
<th>CURRENT</th>
<th>TRIGGERED BY</th>
</tr>
</thead>
<tbody>
<tr>
<td>deploymentconfig.apps.openshift.io/cakephp-mysql-example</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>config,image(cakephp-mysql-example:latest)</td>
</tr>
<tr>
<td>deploymentconfig.apps.openshift.io/mysql</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>config,image(mysql:5.7)</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>NAME</th>
<th>TYPE</th>
<th>FROM</th>
<th>LATEST</th>
</tr>
</thead>
<tbody>
<tr>
<td>buildconfig.build.openshift.io/cakephp-mysql-example</td>
<td>Source</td>
<td>Git</td>
<td>1</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>NAME</th>
<th>TYPE</th>
<th>FROM</th>
<th>STATUS</th>
<th>STARTED</th>
<th>DURATION</th>
</tr>
</thead>
<tbody>
<tr>
<td>build.build.openshift.io/cakephp-mysql-example-1</td>
<td>Source</td>
<td>Git@47a951e</td>
<td>Complete</td>
<td>4 minutes ago</td>
<td>2m27s</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>NAME</th>
<th>DOCKER REPO</th>
<th>TAGS</th>
<th>UPDATED</th>
<th>PATH SERVICES</th>
<th>PORT</th>
<th>TERMINATION</th>
<th>WILDCARD</th>
</tr>
</thead>
<tbody>
<tr>
<td>imagesstream.image.openshift.io/cakephp-mysql-example</td>
<td>docker-registry.default.svc:5000/example/cakephp-mysql-example</td>
<td>latest</td>
<td>About a minute ago</td>
<td>cakephp-mysql-example</td>
<td><all></td>
<td>None</td>
<td></td>
</tr>
</tbody>
</table>
VS Code [13] has a killer set of plugins that complete the creation of Kubernetes resources and provide boilerplate.
First, install Kubernetes and YAML plugins shown in the “VS Code plugins UI” image.
Then, you can create a new YAML file from scratch and get auto-completion of Kubernetes resources. The example “Autocomplete in VS Code” shows a Service.
When you use autocomplete and select the Service resource, it fills in some boilerplate for the object. This is magnificent when you are first learning to drive Kubernetes. You can build Pods, Services, Replication Controllers, Deployments, etc. This is a really nice feature when you are building these files from scratch or even modifying the files you create with Podman generate kube.
Conclusion
These four tools (six if you count the two plugins) will help you learn to drive Kubernetes, instead of building or equipping it.
Links
Why containers and Kubernetes have the potential to run almost anything
Go beyond deployment of simple applications and tackle day two operations with Kubernetes Operators.
From the beginning, Kubernetes has been able to run web-based workloads (containerized) really well. Workloads like web servers, Java, and associated app servers (PHP, Python, etc) just work. The supporting services like DNS, load balancing, and SSH (replaced by kubectl exec) are handled by the platform. For the majority of my career, these are the workloads I ran in production, so I immediately recognized the power of running production workloads with Kubernetes, aside from DevOps, aside from agile. There is incremental efficiency gain even if we barely change our cultural practices. Commissioning and decommissioning become extremely easy, which were terribly difficult with traditional IT. So, since the early days, Kubernetes has given me all of the basic primitives I need to model a production workload, in a single configuration language (Kube YAML/Json).
But, what happened if you needed to run Multi-master MySQL with replication? What about redundant data using Galera? How do you do snapshotting and backups? What about sophisticated workloads like SAP? Day zero (deployment) with simple applications (web servers, etc) has been fairly easy with Kubernetes, but day two operations and workloads were not tackled. That’s not to say that day two operations with sophisticated workloads were harder than traditional IT to solve, but they weren’t made easier with Kubernetes. Every user was left to devise their own genius ideas for solving these problems, which is basically the status quo today. Over the last 5 years, the number one type of question I get is around day two operations of complex workloads.
Thankfully, that’s changing as we speak with the advent of Kubernetes Operators. With the advent of Operators, we now have a framework to codify day two operations knowledge into the platform. We can now apply the same defined state, actual state methodology that I described in Kubernetes basics: Learn how to drive first [1]—we can now define, automate, and maintain a wide range of systems administration tasks.
I often refer to Operators as “Robot Sysadmins” because they essentially codify a bunch of the day two operations knowledge that a subject matter expert (SME, like database administrator or, systems administrator) for that workload type (database, web server, etc) would normally keep in their notes somewhere in a wiki. The problem with these notes being in a wiki is, for the knowledge to be applied to solve a problem, we need to:
1. Generate an event, often a monitoring system finds a fault and we create a ticket
2. Human SME has to investigate the problem, even if it’s something we’ve seen a million times before
3. Human SME has to execute the knowledge (perform the backup/restore, configure the Galera or transaction replication, etc)
With Operators, all of this SME knowledge can be embedded in a separate container image which is deployed before the actual workload. We deploy the Operator container, and then the Operator deploys and manages one or more instances of the workload. We then manage the Operators using something like the Operator Lifecycle Manager (Katacoda tutorial).
So, as we move forward with Kubernetes, we not only simplify the deployment of applications, but also the management over the lifecycle. Operators also give us the tools to manage very complex, stateful applications with deep configuration requirements (clustering, replication, repair, backup/restore). And, the best part is, the people who built the container are probably the subject matter experts for day two operations, so now they can embed that knowledge into the operations environment.
The conclusion to this e-book
The future of Kubernetes is bright, and like virtualization before it, workload expansion is inevitable. Learning how to drive Kubernetes is probably the biggest investment that a developer or sysadmin can make in their own career growth. As the workloads expand, so will the career opportunities. So, here’s to driving an amazing dump truck that’s very elegant at moving dirt... [2]
Links
[1] https://opensource.com/article/19/6/kubernetes-basics
In 2010, Red Hat CEO Jim Whitehurst announced the launch of Opensource.com in a post titled *Welcome to the conversation on Opensource.com*. He explained, “This site is one of the ways in which Red Hat gives something back to the open source community. Our desire is to create a connection point for conversations about the broader impact that open source can have—and is having—even beyond the software world.” He wrote, adding, “All ideas are welcome, and all participants are welcome. This will not be a site for Red Hat, about Red Hat. Instead, this will be a site for open source, about the future.”
By 2013, Opensource.com was publishing an average of 46 articles per month, and in March 2016, Opensource.com surpassed 1-million page views for the first time. In 2019, Opensource.com averages more than 1.5 million page views and 90 articles per month.
More than 60% of our content is contributed by members of open source communities, and additional articles are written by the editorial team and other Red Hat contributors. A small, international team of staff editors and Community Moderators work closely with contributors to curate, polish, publish, and promote open source stories from around the world.
Would you like to write for us? Send pitches and inquiries to open@opensource.com.
To learn more, read 7 big reasons to contribute to Opensource.com.
|
{"Source-Url": "https://opensource.com/sites/default/files/gated-content/getting_started_with_kubernetes.pdf", "len_cl100k_base": 6387, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 37655, "total-output-tokens": 6931, "length": "2e12", "weborganizer": {"__label__adult": 0.0002338886260986328, "__label__art_design": 0.00030732154846191406, "__label__crime_law": 0.0001906156539916992, "__label__education_jobs": 0.0019083023071289065, "__label__entertainment": 9.489059448242188e-05, "__label__fashion_beauty": 0.00010496377944946288, "__label__finance_business": 0.0013513565063476562, "__label__food_dining": 0.0002474784851074219, "__label__games": 0.0004887580871582031, "__label__hardware": 0.0006685256958007812, "__label__health": 0.00018787384033203125, "__label__history": 0.0001882314682006836, "__label__home_hobbies": 0.00013124942779541016, "__label__industrial": 0.00028228759765625, "__label__literature": 0.0001894235610961914, "__label__politics": 0.00018513202667236328, "__label__religion": 0.00020694732666015625, "__label__science_tech": 0.0133056640625, "__label__social_life": 0.0001646280288696289, "__label__software": 0.0621337890625, "__label__software_dev": 0.9169921875, "__label__sports_fitness": 0.0001380443572998047, "__label__transportation": 0.0003161430358886719, "__label__travel": 0.00017213821411132812}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28080, 0.01576]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28080, 0.08776]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28080, 0.8882]], "google_gemma-3-12b-it_contains_pii": [[0, 128, false], [128, 518, null], [518, 1442, null], [1442, 2109, null], [2109, 5032, null], [5032, 5810, null], [5810, 9016, null], [9016, 11874, null], [11874, 12459, null], [12459, 14292, null], [14292, 16419, null], [16419, 20767, null], [20767, 22355, null], [22355, 26711, null], [26711, 28080, null]], "google_gemma-3-12b-it_is_public_document": [[0, 128, true], [128, 518, null], [518, 1442, null], [1442, 2109, null], [2109, 5032, null], [5032, 5810, null], [5810, 9016, null], [9016, 11874, null], [11874, 12459, null], [12459, 14292, null], [14292, 16419, null], [16419, 20767, null], [20767, 22355, null], [22355, 26711, null], [26711, 28080, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 28080, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28080, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28080, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28080, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28080, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28080, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28080, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28080, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28080, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28080, null]], "pdf_page_numbers": [[0, 128, 1], [128, 518, 2], [518, 1442, 3], [1442, 2109, 4], [2109, 5032, 5], [5032, 5810, 6], [5810, 9016, 7], [9016, 11874, 8], [11874, 12459, 9], [12459, 14292, 10], [14292, 16419, 11], [16419, 20767, 12], [20767, 22355, 13], [22355, 26711, 14], [26711, 28080, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28080, 0.14523]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
91e8bae864ab679a1731d19f0d2a45bd98315b8b
|
We are IntechOpen, the world’s leading publisher of Open Access books
Built by scientists, for scientists
4,400 Open access books available
117,000 International authors and editors
130M Downloads
154 Countries delivered to
TOP 1% Our authors are among the
most cited scientists
12.2% Contributors from top 500 universities
WEB OF SCIENCE™
Selection of our books indexed in the Book Citation Index
in Web of Science™ Core Collection (BKCI)
Interested in publishing with us?
Contact book.department@intechopen.com
Numbers displayed above are based on latest data collected.
For more information visit www.intechopen.com
1. Introduction
The constant evolution of technology is leading the education to new ways, which are more attractive to students, making possible to use new tools, leading to an evolution in the teaching and learning process. The Virtual Reality has an important place in this evolution.
There are many definitions about virtual reality, but in general, refers to an immersive and interactive 3D-based graphics generated in real time by computer, that is, a computer-generated a real world simulation or just imaginary.
Virtual Reality is present in many knowledge areas, allowing several benefits in its uses. Some examples:
- Entertainment: games and virtual tours.
- Health: virtual surgeries, treating patients in the ICU, rehabilitation.
- Business: virtual models, buildings, interiors.
- Training: flight simulators, motorcycles, vehicles quality test, etc.
- Education: educational software.
The virtual reality systems have three characteristics:
- Immersion: all sensorial devices are important for the immersion feeling. Regularly, they use objects such as viewing helmets and projections views rooms to help in the immersion.
- Interaction: this idea is related to the computer's ability to detect the user input and modify immediately the virtual world and the actions on it (reactive capacity).
- Involvement: is related to the motivation degree to a person engagement with a particular activity.
Education can be seen as a discovery, exploration and observation process, except the eternal knowledge construction. Thus, the Virtual Reality specific features can turn it into a
powerful instrument in the service of all who seek the evolution of education. Many things that until a short time were dreams nowadays, existing with technological advances, become a reality, a Virtual Reality.
With Virtual Reality working in education we can discover, explore and build knowledge about places and situations that we could never explore. The great potential of virtual reality is exactly these possibilities, not only through classes or physical objects, but also by manipulating virtual target to be explored, analyzed and studied.
It is understood by the Theory of Automata and Formal Languages the mathematical models study that enable the specification and recognition language (in the broad sense of the word), their classifications, structures, properties, characteristics and interrelationships [8].
The importance of this theory in computer science is twofold: it supports both other aspects of theoretical computer science, as also it underlies several computer applications such as language processing, pattern recognition and systems modeling.
The Educational Software is a technical resource teaching, with pre-established educational objectives for teaching and learning of their target. It is any software used with educational purpose integrated curricular activities with the possibility of a multidisciplinary tool available to students and teachers.
The educational software should be well structured, properly uses the technological resources, to have interaction in the curriculum and activities, has friendly interface, be easy to perform, and mostly have well-defined its target to achieve its goals.
The quality of an educational software depends on some criteria to be observed: clear and defined goals; vocabulary appropriate to the target; activities with writing correction (spelling), clarity and conciseness of the text; feedback; implementation easy and secure with the possibility of termination at any time, user-friendly interface, online help, the possibility for interactivity [10] [3].
The virtual reality has been available as a technology for learning, offering great potential for applications in many areas. RV is considered a new and advanced computer interface for 3D models, which presents a whole new world of possibilities for human-machine interaction. It provides an environment in which users are able to interact and view images from different viewing angles. Consequently, the Virtual Reality enables the user to develop a spatial relationship with the information he is interacting.
The virtual reality, when inserted into an educational context can provide many benefits to teaching and learning, promoting:
- motivation and multisensory stimulation to the learners;
- the student creativity;
- opportunities to communicate with students from other cultures;
- possibility of the learner performing an experiment at his own pace;
• active participation rather than passivity opening these opportunities for special
education and distance education [6].
Nowadays, the Internet provides the possibility not only to seek information, but also to
help the teacher in the distance education process, using new interaction methods with the
student, such as participation in chat rooms, discussion boards, and videoconferencing.
For education, the Internet can be considered the learning tool most complete,
comprehensive and complex which have been used so far. We can, through them, find
sources of information that virtually enable us to study different areas of knowledge [4].
For the scientific community or researcher, we can say that the Internet is an indispensable
tool. Through it, we have access to more advanced search features of the world. Thus, one
can discuss research with colleagues who work with the same concerns and seeking to
achieve equal results.
The educational software proposed aims to help students and teachers to have a more
complete and interesting of Automata and changes in its minimization. It also aims to make
the subject more interesting to students, making learning easier as well as making the
students to become more participatory, so they have a more interactive learning.
2. Tools for software development using virtual reality
The application of Virtual Reality is an animated simulation that lets you define and display
a 3D object, change its point of reference and field of view, manipulate and interact with
objects, and make these objects affect each other. The Virtual Reality software allows to
pervade objects with behaviors as well as programming them to activate some kind of visual
feedback, auditory or tactile when a specific event happens, and manage the entire sequence
of events.
The most systems of building virtual worlds share some basic concepts that characterize the
development of Virtual Reality and allow developers to create a very realistic simulation.
According to Jacobson (1994), these basic concepts could be: the universe and its objects,
presentation techniques and dynamic feedback. The Universe is the place where the
experience of virtual reality that is the place to be modeled. This universe contains objects
that are characterized by the geometry (shape of the object), appearance (size, color,
composition, lighting and shading applied to the geometry of the object) and behavior
(reactions to events ahead of the object). Any object is formed by a set of polygons and its
presentation techniques involve concepts of computer graphics. Some of these concepts are:
linear perspective (the object size decreases with increasing distance from the user), lighting
(intensity of light striking an object), shading (shading caused by the position of another
object between the light source and the object) and overlay (objects obscuring other objects
or parts of them). In addition to sharing the concepts mentioned above, the software for
creating Virtual Reality also usually offer resources for certain types of interaction devices,
allowing programming them to activate some kind of visual feedback, auditory or tactile. In
this virtual world you can use a 3D modeling program to create virtual objects and scenarios and import them into the software that creates virtual reality. The modeling usually is based on primitives called polygons, and an object of the virtual world is composed by multiple polygons combined. Then, the 3D modeling programs will combine modeling (creation of objects), visual representation (application properties to objects, such as texture and lighting) and animation (movement of objects in the scene), making the presentation of scenes and objects as close to reality as possible.
Currently, there are several software programs for the Virtual Reality. Some allow only the creation of Virtual Reality exploratory where the participant may not modify or interact with the environment and its components, while others allow you to create sophisticated scenes with interaction capabilities across devices compatible. In this chapter we present the software used to create the system to Formal Languages.
2.1. Blender
Blender or Blender3D is a program for modeling three-dimensional (3D) that is evolving very quickly. The program is open source, and it is developed by the Blender Foundation [1].
Originally, the program was developed as an in-house application by Dutch animation studio NeoGeo (not to be confused with NeoGeo game console) and Not a Number Technologies (NaN), the lead author, Ton Roosendaal, founded in June 1998 to NaN to develop and distribute the program. Blender was initially distributed as freeware until NaN went bankrupt in 2002 [1].
The debtors agreed to release Blender as open source under the GNU terms General Public License, with a single payment of €100,000. On July 18, 2002, a Blender funding campaign was started by Roosendaal in order to collect donations and September 7, 2002 it was announced that the fundraising was enough, and that the blender source code would be released.
The objective of the development team is able to reach the development of commercial software. There are many professionals who have already used this program as a primary or secondary in their work [1].
The Blender3D can be used in any area that is necessary for generation three-dimensional models. We can mention architecture, industrial design and engineering, among others [1]. Blender can be downloaded from the actual web page design: www.blender.org, and yet there are several pages about the program.
2.2. VRML
VRML (Virtual Reality Modeling Language) is a standard for virtual reality applications used on the Internet. Through this language, written in text mode, you can create three-
dimensional objects can set color, transparency, gloss, texture. The objects can be basic shapes such as spheres, cubes, ovoid, hexahedrons, cones, cylinders, or forms created by the programmer [12].
In addition to objects, it is possible to add interactivity to them by means of sensors, so you can move them in position, add light to produce a sound when the object is clicked or simply close it and open a file or Web page or yet another page in VRML, when the object is triggered.
It isn’t necessary a specific software for VRML files creation (although there are), since all objects can be created in text mode. Figure 26 shows an example of code in VRML 2.0 using Windows Notepad (txt extension) to be opened. VRML 2.0 is the version used to create the software to Formal Languages.
2.3. Plug-in Cortona
Plug-in Cortona is an interactive 3D display ideal for viewing virtual worlds on the web. It is compatible with many 3D technologies for VRML formats developing. Plug-ins are programs that allow the virtual worlds visualization developed in VRML [2].
In the web address: www.parallelgraphics.com/products/cortona/ is available to download and install free software. Plug-in makes the images with .wrl extension are automatically loaded into the browser.
There are different plug-ins for different operating systems, but the Cortona plug-in was chosen for the Formal Languages development software.
2.4. HTML
The acronym HTML derives from the English expression HyperText Markup Language. It is a markup language used to produce web pages. These codes can be interpreted by browsers to display pages on the World Wide Web [5].
Unlike other structured languages, HTML uses tags, markings that are known as tags, which consist of brief instructions with a start tag and the other end, by which to determine the text formatting, images and other elements that compose a HTML page.
2.4.1. Macromedia dreamweaver
Macromedia Dreamweaver is a development tool for web created by Macromedia (now Adobe Systems), which is currently in version 8. Early application versions served as simple WYSIWYG HTML editor ("What You See Is What You Get", or "What you see is what you get"), but newer versions have incorporated notable support for many other web technologies such as XHTML, CSS, JavaScript and several server scripts [9].
Since the late '90s, Dreamweaver has had increasing success and now dominates around 80% of the market for HTML editors. There are versions for both Mac OS and Windows, but
you can also run it on Unix platforms and through the use of emulation software like Wine. As a WYSIWYG editor, Dreamweaver can hide the HTML details user, making it possible for non-experts to easily create web pages and sites.
To develop the Formal Languages pages layout software was used Macromedia Dreamweaver MX.
2.5. PHP
PHP (a recursive acronym for "PHP: Hypertext Preprocessor") is a computer programming language interpreted, free and very used to generate dynamic content on the Web Despite being an easy language to learn and use for small scripts, simple dynamic PHP is a powerful object-oriented language [11].
The language appeared around 1994 as a Perl subset scripts created by Rasmus Lerdof. With Zeev Suraski and Andi Gutmans, two Israeli developers belonging to the Technion, the Israel Institute of Technology, who additions rewrote the parser, was launched in 1997 to PHP 3, the first stable version and like the current language. By rewriting the parser was created the Zend Engine, which is officially maintained by the company together with the Zend PHP community. In May 2000, came to public version 4, and in July 2004, version 5, where the main change was a new API for object orientation provided by the Zend Engine 2.
This is a highly modularized language, which makes it ideal for installation and use on web servers. Several modules are created in PECL repository extensions (PHP Extension Community Library) and some of these modules are introduced as standard on new language versions. It is very similar, data types, syntax and even functions, with C and C ++. Maybe, depending on server configuration, embedded in HTML. Moreover, there is the extreme ease with which PHP handles database servers such as MySQL, PostgreSQL, Microsoft SQL Server and Oracle.
There are PHP versions which are available for the following operating systems: Windows, Linux, Mac OS, OS / 2, AS/400, Novell Netware, RISC OS, IRIX and Solaris.
2.6. JavaScript
JavaScript is a programming language created by Netscape - in 1995, which at first was called LiveScript to meet mainly the following requirements:
- form validation on the client side (browser software);
- interaction with the page. Thus, it was done as a scripting language [7].
Javascript has syntax similar to Java, but is totally different in its concept and use:
- provides dynamic typing - variable types aren’t defined;
- is interpreted rather than compiled;
- has great tools for standard listings (such as scripting languages in general);
• provides good support for regular expressions (a feature also common scripting languages).
3. Modeling of virtual reality system for formal languages
In this chapter we will introduce how the Educational Software building was made for the Formal Languages subject.
The educational software developed, is based on Virtual Reality facing the Formal Languages subject, targeting the automata minimization study. For this software installation was used Blender 2.37a modeler for the automata images construction (Figure 1) that allows you to export your files to VRML 2.0.

**Figure 1.** Construction of Automata using Modeler Blender
It is also necessary that Cortona plug-in is installed on your computer where the software will be used (Figure 2). Plug-in opens the Browser with controls that allow the user to view images from different angles.
The Maker Blender used to create images of Automata doesn’t allow that letters and numbers are exported, then it is necessary that the letters and numbers (q1, q2, a, b, 0) are placed in the images through the VRML Language.
3.1. Use case diagram
The figure 3 shows a use case diagram that demonstrates the system use.
Initially the user will access the subject homepage. By entering the page, display the main menu that will give the student the possibility to choose the type of study he will perform. Through the menu, the user can:
- Access Plug-in Cortona;
- Access the Explanatory Material Formal Languages;
- Access Issues Objectives;
- Access the Menu Minimization;
- Access the Menu Regular Expression;
- Access Links Used.
If the user chooses to access the Plug-in Cortona, it must save and run, so he can view the Automata images.
If the user chooses to access the Explanatory Material on Formal Languages, he will have access to the reading material, with concepts and how to solve a minimization exercise.
If the user chooses to answer the objective questions, he will receive the answer if the options chosen were the right ones.
If he accesses the Minimization link, he goes in another menu that will give him the option to choose the exercise he wants to minimize doing or want before he visits the help page. If he chooses the exercise, the user will perform the exercise and should fill the spaces with equivalent states, so the user gets the correct answer or if the program will prompt re-run the exercise.
If the user accesses the regular expressions link, he can choose the exercise he wants to do. After choosing the exercise, he will answer what is the correct regular expression and gets the answer result.
The user can also access the links used in the workplace.
Figure 3. Use Case Diagram
### 3.2. Virtual reality system for formal languages with emphasis on regular expressions
The exercises will be available to students through the homepage (Figure 4). The pages layout was built using HTML through Dreamweaver MX software. From the home page users can access the page menu that shows the studying options it shows to the student the possibility to download the plug-in Cortona and also provides some links for reading (Figure 5).
The software will be available through pages built using the PHP programming language. The student can choose for answer questions about regular expressions before performing the Automata minimization. The figure 6 shows an exercise on regular expressions which is available through the Menu.
Figure 4. Home Screen
Figure 5. Menu
Figure 6. Exercises about Regular Expressions
The automata minimization is done on a screen where the user views the Automata drawings in 3D and must enter some state that is necessary and use the table and the lists to find the equivalent states that can be removed. When you find the equivalent states, he can view the 3D minimized automata. If the student doesn’t hit the equivalent states, the page warns him about the error and the student may retake the answers (Figure 7).
Figure 7. Home Exercise with Minimization
The page shows multiple choice exercises, where students will answer the questions and check whether the chosen answers were correct. (Figure 8) so students can test their theoretical knowledge. The page warns the student when the choices made in multiple-choice questions aren’t correct and the student will have the option to redo these wrong questions.
Figure 8. Exercises Multiple Choice
Figure 9. Materials for Reading
The page shows a Reading Material which is intended to answer doubts about Regular Expressions and Automata Minimization. This page can also be used by educators in their classroom or virtual class. The figure 9 shows the Theoretical Material page.
The page also has a help material, which explains how to use the pages with exercises Minimization. This help is available through the Menu Minimization that is shown in Figure 10.
Figure 12. Links
Figure 13. Answers to Questions Minimization
The figure 11 shows the help page, where teachers and students can ask questions about the use of the Minimization exercises pages.
If the reading material doesn’t take all the doubts, is available through pages some links that were used in the workplace. The figure 12 shows the page that contains the web address links for reference.
Also are available on the discipline page, the answers for the minimization questions, which can be accessed through the help page. This page aims to help teachers and students if problems occur in these exercises solution. The figure 13 shows the page with the minimization exercises solution.
The educational software was used to take the Formal Languages subject from the classrooms to the computer labs, making the study more interesting to students.
The research made about the tools used for this research development can help in future research about Virtual Reality and Educational Software.
3.3. Assessment tool for the formal languages department
Using the system above together a distribution package apache server that has PHP phpMyAdmin tool (Figure 14) was created a database to store the students’ login and
password to perform the evaluation. The student’s login must be the email that he wants to receive his assessment, and the teacher will receive an email that is already defined in the program. To facilitate the database use will be exported and must be imported by the teacher who wishes to use the system.
```php
<?php
include('conexao_mysql.php');
if (isset($_COOKIE['tb1']))
{$tb1 = $_COOKIE['tb1'];
$texto.=</br>M1: $tb1;
}else{$texto.=</br>Exercise has not been resolved!";}
```
After the scan is done if the answers are correct as the code below:
```php
<?php
include('conexao_mysql.php');
if (isset($_COOKIE['nota']))
{$nota = $_COOKIE['nota'];}
$q[0] = $_POST['quest1'];
$q[1] = $_POST['quest2'];
$q[2] = $_POST['quest3'];
$q[3] = $_POST['quest4'];
$q[4] = $_POST['quest5'];
$q[5] = $_POST['quest6'];
$q[6] = $_POST['quest7'];
$q[7] = $_POST['quest8'];
$q[8] = $_POST['quest9'];
$q[9] = $_POST['quest10'];
$certas_O[0] = 2;
$certas_O[1] = 1;
$certas_O[2] = 2;
$certas_O[3] = 3;
$certas_O[4] = 1;
$certas_O[5] = 2;
$certas_O[6] = 1;
$certas_O[7] = 2;
$certas_O[8] = 1;
$certas_O[9] = 3;
for($i=0;$i<10;$i++)
if($certas_O[$i] != $q[$i])
{$valor = 'incorreta';
}else
{$valor = 'correta'; $nota = $nota + 0.2;}
```
setcookie("objs[$i]", $valor, time()+3600);
$ver = true;
setcookie("objetivas", $ver, time()+3600);
setcookie("nota", $nota, time()+3600);
header("location:menu.php");
?>
After performing all the exercises the student will automatically send the results and note to
the email address registered at the beginning as login and for the teacher’s email, so the
evaluation made, according to the code below:
if (isset($_COOKIE['user']))
$prof = $_COOKIE['user'];
$
if (isset($_COOKIE['user']))
$user = $_COOKIE['user'];
}$prof = 'sanpiovesan@hotmail.com';
$assunto = 'Resultado Avaliação';
mail($prof,$assunto,$texto); // send email to the teacher, variable text containing all the
answers
mail($user,$assunto,$texto); // send e-mail to the student’s login, variable text containing all
the answers
4. Conclusion
In this work was shown an educational software for the Formal Languages subject, using
virtual reality, with the goal carrying the subject from classroom to the computer labs, also
making possible to use for distance education or as an extracurricular task.
The study was developed using the modeler Blender for the images creation, which were
converted to VRML, to be used on the available Internet pages. We also used the PHP
languages, to provide the proposed exercises, for the HTML layout pages and JavaScript for
the multiple-choice exercises.
Virtual Reality is a relatively new area, where the student sees the possibility of exploring
the environments through the objects manipulation scattered in the virtual environment,
related to the content to be learned, making learning more interesting and easier for the
students.
The ability to simulate real situations in a way that wouldn’t be possible, allow a
breakthrough in several military and business sectors. In education, the use of Virtual
Reality enables conducting experiments with the interactively knowledge, allowing the
environments exploration, processes or objects, through the manipulation, interaction and
virtual analysis from the own target in context.
Currently, with the increasing information spread through the Internet, the development of virtual environments that allow integration among students through the Internet can enable geographically dispersed students to learn without being present in the classroom.
Thus we can say that Virtual Reality is starting to change education. This is because, in spite of the technological barriers, the use of Virtual Reality can be associated with fantasy and imagination, revolutionizing the teaching and learning traditional concepts.
Author details
Adriana Soares Pereira
*Universidade Federal de Santa Maria, Colégio Agrícola de Frederico Westphalen, Brazil*
Sandra Dutra Piovesan
*Universidade Federal do Rio Grande do Sul, Programa de Pós graduação em Informática na Educação, Brazil*
5. References
|
{"Source-Url": "https://api.intechopen.com/chapter/pdf-preview/39196", "len_cl100k_base": 5476, "olmocr-version": "0.1.53", "pdf-total-pages": 19, "total-fallback-pages": 0, "total-input-tokens": 29245, "total-output-tokens": 6890, "length": "2e12", "weborganizer": {"__label__adult": 0.0006275177001953125, "__label__art_design": 0.002655029296875, "__label__crime_law": 0.0006947517395019531, "__label__education_jobs": 0.357666015625, "__label__entertainment": 0.0003867149353027344, "__label__fashion_beauty": 0.0003631114959716797, "__label__finance_business": 0.0012845993041992188, "__label__food_dining": 0.0008149147033691406, "__label__games": 0.00167083740234375, "__label__hardware": 0.002223968505859375, "__label__health": 0.0015153884887695312, "__label__history": 0.0012073516845703125, "__label__home_hobbies": 0.00038814544677734375, "__label__industrial": 0.0008816719055175781, "__label__literature": 0.0014171600341796875, "__label__politics": 0.00047516822814941406, "__label__religion": 0.0011043548583984375, "__label__science_tech": 0.1256103515625, "__label__social_life": 0.0005445480346679688, "__label__software": 0.0880126953125, "__label__software_dev": 0.408447265625, "__label__sports_fitness": 0.0005135536193847656, "__label__transportation": 0.0008068084716796875, "__label__travel": 0.0006375312805175781}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27537, 0.02582]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27537, 0.90247]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27537, 0.90851]], "google_gemma-3-12b-it_contains_pii": [[0, 624, false], [624, 2223, null], [2223, 5132, null], [5132, 8307, null], [8307, 10936, null], [10936, 13448, null], [13448, 15979, null], [15979, 17083, null], [17083, 18008, null], [18008, 19425, null], [19425, 19463, null], [19463, 19987, null], [19987, 20413, null], [20413, 20662, null], [20662, 21040, null], [21040, 22072, null], [22072, 23335, null], [23335, 25384, null], [25384, 27537, null]], "google_gemma-3-12b-it_is_public_document": [[0, 624, true], [624, 2223, null], [2223, 5132, null], [5132, 8307, null], [8307, 10936, null], [10936, 13448, null], [13448, 15979, null], [15979, 17083, null], [17083, 18008, null], [18008, 19425, null], [19425, 19463, null], [19463, 19987, null], [19987, 20413, null], [20413, 20662, null], [20662, 21040, null], [21040, 22072, null], [22072, 23335, null], [23335, 25384, null], [25384, 27537, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27537, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27537, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27537, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27537, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27537, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27537, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27537, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27537, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27537, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27537, null]], "pdf_page_numbers": [[0, 624, 1], [624, 2223, 2], [2223, 5132, 3], [5132, 8307, 4], [8307, 10936, 5], [10936, 13448, 6], [13448, 15979, 7], [15979, 17083, 8], [17083, 18008, 9], [18008, 19425, 10], [19425, 19463, 11], [19463, 19987, 12], [19987, 20413, 13], [20413, 20662, 14], [20662, 21040, 15], [21040, 22072, 16], [22072, 23335, 17], [23335, 25384, 18], [25384, 27537, 19]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27537, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
1e803e00bad79dac9b6433dde34755e6bd68433d
|
Why add Solace PubSub+ event broker technology to the integration mix?
Integration Platform as a Service (iPaaS) offerings such as Dell Boomi, MuleSoft and Jitterbit are getting a lot of traction in the integration space, driven by the increasing popularity of cloud-native deployments and desire for citizen integration. iPaaS platforms are being used as an evolution from ESBs to orchestrate integrations between various application platforms, and are even including legacy applications.
This paper explains how the full potential of iPaaS can only be achieved through the implementation of an event-driven architecture, and why Solace PubSub+ is the best advanced event broker for doing so.
# TABLE OF CONTENTS
Executive Summary ................................................................. 1
About Solace ................................................................. 2
Conceptual Overview of iPaaS .................................................. 2
A Predominantly REST-oriented iPaaS ........................................ 3
Challenges with Point-to-Point Integration ..................................... 4
Event Enabling an iPaaS ............................................................ 5
Loose Coupling ............................................................... 5
Open Standards and Event Routing ............................................. 6
Event Cataloging and Governance ............................................ 7
Guaranteed Delivery and Burst-Handling ...................................... 8
Event Sourcing, Message Replay, and Streaming ............................ 9
Enabling AI and Machine Learning .......................................... 9
Hybrid Cloud ................................................................. 10
Enabling Event-Driven IoT .................................................... 11
Adoption Strategy ................................................................. 11
Integrating Solace with Legacy Assets and iPaaS .......................... 12
Connecting Legacy Systems with PubSub+ On-Prem ...................... 12
Connecting Legacy Systems with PubSub+ in the Cloud .................. 12
Conclusion ................................................................. 13
EXECUTIVE SUMMARY
iPaaS platforms are a cloud-native managed service replacement for ESBs; a new way of integrating applications, information sources and connected devices across public cloud, private cloud and on-premises environments.
The shift from service-oriented architecture (SOA) to event-driven architecture (EDA), as well as the microservices approach to application development, represent the two other major developments in the application infrastructure space.
As these architecture patterns evolve, and distributed systems consist of more cloud-native applications and ecosystems, integration needs to be reconceived.
INTEGRATION COVERS FOUR AREAS OF FUNCTIONALITY:
1. Connecting disparate systems to each other or an intermediary so they can send and receive information;
2. Orchestrating interactions between systems;
3. Transforming messages so systems can send and receive them in a way they can understand; and,
4. Distributing/routing information between systems.
When it comes to the distribution of events and information, some ESB/iPaaS implementations rely on point-to-point synchronous communications. While this can work at a small scale with very few applications and low performance requirements within a datacenter, such an approach does not offer the scalability and flexibility required for serious enterprise IT projects.
An event-driven approach—where the heavy lifting of event routing is delegated to an event broker—allows for a publish/subscribe backbone for iPaaS. This lets you use REST as a protocol for publish/subscribe, guaranteed delivery and smart routing. An event-driven architecture provides an agile and robust backbone for an iPaaS.
ABOUT SOLACE
Solace is a Canadian company based in Kanata, Ontario, near Ottawa. We make an advanced event broker called PubSub+ that offers unparalleled performance, reliability and robustness. Each day we solve the toughest data movement challenges in multiple industries and use cases. Our customers include most of the world’s top investment banks, telcos, the world’s largest manufacturer of commercial vehicles, and government agencies such as the FAA, NOAA, and Singapore’s Land Transport Authority.
CONCEPTUAL OVERVIEW OF IPAAS
An integration platform provides adapters for connectivity, performance payload transformation as needed, orchestrates sequences of interactions, and manages the distribution of data between systems. Solace addresses the data distribution part of the integration problem. Furthermore, with an event-driven integration platform, which supports sophisticated event routing, the need for orchestration is minimized and a self-orchestrated microservices-oriented approach to integration can be adopted. This tends to be leaner, more agile and more responsive. In other words, an event-driven approach to integration leads to more robustness, faster time to market, lower costs and deployment flexibility.
A PREDOMINANTLY REST-ORIENTED IPAAS
Many enterprises adopt a very simplistic approach to integration. They deploy an ESB, iPaaS or API Gateway which has adapters to connect or proxy services from legacy and modern systems. These adapters could be file or database or Oracle or SAP ERP. They could be cloud or SaaS adapters, such as Salesforce or AWS S3. With connectivity established, sometimes payload transformations are required.
REST is a common and simple way to expose integration flow as APIs. This works at small scale, with a few systems and at a small throughput, usually within a datacenter. Such an approach has challenges when more systems are added or the volume of information being shared increases.
As more upstream and downstream systems get added, a point-to-point integration mechanism becomes exponentially more complex. This is especially true if the same messages/APIs must be sent to multiple systems.
# Challenges with Point-to-Point Integration
## Lack of Agility
For every integration point, the producer or the consumer applications need to be connected one more time. There is tight coupling between various systems, so if there is any bug, change, or outage, the iPaaS, the producers and other consumers are impacted.
## Lossy with Retries
When fully-guaranteed message delivery is required, a simple RESTful iPaaS approach puts the burden of message redelivery on the producer application, which must make sure all downstream consumers receive the information or store it until delivery is made. This compounds the coupling problem and often leads to data loss.
## Tight Coupling
Every time a new integration point is added, the iPaaS flows must be rewired to include it. All performance characteristics of the new integration point are inherited by the existing flow, often making it slower, less robust and more complex. This high impact integration slows time to market, reduces agility and increases fragility.
## Burst-Handling
Burst-handling is an equally big challenge because if a downstream application is slow, the iPaaS will have a load build up that results in a slow down or crash. This introduces the need for rate limiting and load balancing.
## Distributed Deployment and Coupling
Most companies migrate systems to the cloud gradually, versus moving everything at once. For gradual migration, a REST/API-based approach is problematic because it burdens producers with the responsibility of handling message delivery—and asking them to do so with WAN/Internet links in the mix is too much to ask.
## Loss of AI/Streaming Readiness
A point-to-point approach makes it difficult to include AI and machine learning services into business processes. A streaming approach lets you “wire tap” a feed to facilitate the efficient integration of AI, ML and other insights systems.
Simply put, a point-to-point REST or API-based approach to integration does not meet the needs of enterprises with sophisticated, high-volume or highly-distributed use cases.
EVENT-ENABLING AN IPAAS
An event-driven architecture is much better as a foundational layer for an iPaaS and, fortunately, most iPaaS platforms support integration with advanced event brokers like Solace PubSub+.
At the heart of an event-driven architecture is an event broker, ideally an advanced event broker that supports:
- Exchange patterns including publish/subscribe, request/reply, queuing, streaming, fan-out, fan-in;
- Guaranteed and best-effort delivery;
- Open standards such as AMQP, MQTT, REST, JMS and WebSocket;
- Asynchronous API and communication support;
- Sophisticated event routing including wildcards for messaging topics and REST URLs;
- Isolation and graceful recovery of slow and temporarily disconnected consumers; and,
- Hybrid and multi-cloud deployment with guaranteed, WAN-optimized delivery between clouds.
LOOSE COUPLING
An event broker is a core tool in an event-driven architecture. It sits in the heart of an iPaaS and decouples consumers. ESB/iPaaS platforms are only needed when systems don’t follow open standards or a canonical data model, or where transformation is required. For systems that can speak open standards (such as REST, AMQP, JMS, and MQTT), the event broker has the ability to natively talk to them.
With queuing capabilities, PubSub+ acts as a shock absorber and decouples the producers from the consumers such that
the performance of the producer is not impacted by that of the consumers. It even allows consumers who have lost data to replay it back.
With publish/subscribe and streaming capabilities, PubSub+ decouples producers and consumers from each other and the iPaaS itself to enable the easy addition of multiple consumers in the future.
New consumers can simply “subscribe” to the published topics or queues without requiring any change to the producer or the iPaaS flow.
**OPEN STANDARDS AND EVENT ROUTING**
Support for open APIs and protocols like AMQP, JMS, MQTT and REST means producers and consumers are decoupled not only from each other but also from the event broker and its specific APIs. PubSub+ does wireline translation between these protocols, so you could publish an MQTT message from a device and consume it as an AMQP or JMS message.
The same works for a request/reply pattern. Because PubSub+ does protocol translation at a wireline level, no bridges or intermediaries are required. This results in a simpler, better performing system. Topics are translated to URLs (and vice versa) dynamically. Wildcard routing is also allowed on URLs, similar to topics.
Topics and URLs don’t have to be predefined and administratively configured in the routers. Subscribers can simply connect and start subscribing to any topic.
string, such as a/b/c or a/b/ (anything that has a and b as the first 2 segments), or */b/c (will match a/b/c, b/b/c, c/b/c, etc.). Subscriptions are dynamically ingested into the Solace messaging routers. For MQTT, the wildcards will automatically translate to # and + as per the standard.
Similarly, publishers can publish on any topic or any URL, such as a/b/x, a/b/c or http://host:port/a/b/c/d. This dynamic nature of topic routing allows for great operational simplicity.
**EVENT CATALOGING AND GOVERNANCE**
Governance is critical for integration at scale. PubSub+ has been built for performance, especially fan-out. This allows visibility via event cataloging. Custom dashboards can “eavesdrop” on events and create both statistical and data flow views of how messages are flowing (and how those flows are related). This visualization leads to better governance and more effective analysis.
For design-time governance, each microservice has topics and URLs that it publishes and subscribes to, and the schema of the payload. The event catalog can be created and compared with the generated event catalog as explained above.
Runtime governance is exercised by ensuring that the right events are published by and subscribed to by only authorized microservices or integration flows. You can even throttle and tune the delivery of events on a per queue/stream level.
You can also restrict a system’s ability to send or receive information through the use of sophisticated access control lists (ACLs) that support wildcards, whitelists and blacklists. For example, a device could publish on a topic a/b/c if it is allowed to publish on a/> or a/*/c.
Schema validation is also plug-and-play, and not limited to any payload protocol, such as Avro, Swagger or Google Protobufs. This is done via schema validation microservices, which can consume raw high-level topics like a/b/c/raw and, if the schema is valid, forward the message to a validated topic, such as a/b/c/val.
That means governance is handled both at design-time and runtime. Topic hierarchy conventions and ACLs should be agreed upon at design-time, covering things such as version number and metadata. This becomes the event-driven microservices catalog of endpoint and conventions, which applications use to publish and subscribe to events of interest. Runtime governance is carried out by throttling, security enforcement and monitoring, all of which PubSub+ provides out of the box.
GUARANTEED DELIVERY AND BURST-HANDLING
An iPaaS without a message bus/event broker tightly couples producers with consumers. Consider, for example, a publisher that needs to send a message to multiple back-end systems, such as an order management app, data warehouse, and inventory management system. If one or more of these systems are down, should the order be accepted? Can the order still be processed if only the order management app and inventory management system received the message—since the data warehouse can be updated a few minutes later?
There are two ways data can flow as part of such interactions. The first is serial, or synchronous, where a requestor waits for a reply. The other is parallel, or asynchronous, referring to the delivery of an update without expectation of a response.
There is immense benefit in having PubSub+ as an event broker providing guaranteed delivery, decoupling producers from consumers. PubSub+ takes the messages from the producer and stores them, acknowledging the publisher. PubSub+ then delivers the events to all consuming applications in a “store and forward” manner. Once all the consumers acknowledge that they have received the event, PubSub+ deletes the event from its spool, decoupling producers from consumers.
If the producer suddenly publishes a large number of events (more than a consumer can receive and process), PubSub+ acts as a shock absorber, buffering the burst by queuing all messages so they can be delivered at whatever rate each subscribing application can accept.
**EVENT SOURCING, MESSAGE REPLAY, AND STREAMING**
PubSub+ supports message replay so you can play back messages days, weeks or even months after they were initially sent and received. This lets you easily recover from misconfiguration issues, bugs and corrupt databases. This also lets you more smoothly add new applications to your system by testing them with real-world data in non-production environments.
Message replay can be initiated either by the subscribing application using Solace client libraries or by the administrator. It can be performed for any consumer, no matter what protocol or API they are using (including JMS1.1 and 2.0, AMQP, MQTT, REST/WebHook), and the messages are replayed in their original order, across all topics, with support for wildcard subscriptions on queues and topic endpoints. Messages can be replayed from a specific time, or from the beginning of the replay log.
**ENABLING AI AND MACHINE LEARNING**
Without an event-driven architecture, integrating data lakes, machine learning algorithms and AI systems means you need to add another integration point either for the data producers or for the databases (systems of record) via polling. PubSub+ can add such systems as recipients of information without impacting data producers or systems of record.
Many modern insights systems support streaming ingestion via technologies like Spark, Flink, Storm and Beam. PubSub+ works with all of these technologies via open standards and guarantees data delivery even if they have outages, and it can do so without the rest of the ecosystem even taking notice.
The last mile of an event-driven architecture is cloud-native integration. PubSub+ can run natively in all major cloud environments or as a fully managed service. Solace provides AMIs for AWS, and PubSub+ is easily deployed on Azure and Google within a Docker container or with Kubernetes. PubSub+ also natively gets deployed in PaaS platforms such as Pivotal Cloud Foundry and OpenShift.
WAN-optimized, encrypted and lossless bridges enable intelligent and dynamic routing among different instances of PubSub+, creating an “event mesh” so data can move between on-premises and cloud deployments. Producers and consumers do not need to worry about where the rest of the application is deployed; PubSub+ delivers data to all appropriate applications.
An iPaaS can provide adapters and transformation as an overlay to PubSub+, which works as the core, lossless data movement backbone. Any network blips or any downstream system issue (whether on-prem or in the cloud) will not impact producers, consumers or even the iPaaS if PubSub+ is doing the heavy lifting of data movement.
ENABLING EVENT-DRIVEN IOT
A Solace-based event-driven architecture can incorporate IoT as well as applications, allowing them to leverage the same backbone rather than needing to bring in new tools, new complexities, and new training.
PubSub+ natively supports MQTT at very high scale, and translates between MQTT and back-end messaging protocols such as AMQP, JMS and REST at the wireline level.
ADOPTION STRATEGY
PubSub+ works with all standards-based iPaaS and ESB platforms because it supports standard APIs and protocols like AMQP, JMS, MQTT, REST and WebSocket. So as you go down the road of integrating new applications using iPaaS and an event-driven architecture you can implement PubSub+ as an event-distribution layer underneath your legacy app servers, EAI software and ESBs. Once this is done, PubSub+ underpins iPaaS stacks both on-premises and in the cloud so new applications are easily integrated with legacy systems. This lets new applications interoperate seamlessly with legacy systems so you can migrate workloads in a step-by-step, flow-by-flow manner instead of trying to execute an impractical “lift and shift.”
As data moves through the system, AI, ML, and big data systems become passive listeners and simply consume events. PubSub+ also has native REST capabilities, so it can act as a gateway for API/microservice access.
Lastly, PubSub+ powers IoT connectivity at scale with support for millions of concurrently connected, streaming devices. Adoption of Solace, therefore, is on the back of a current in-flight project, where existing integration requirements can leverage event brokering. Further to that, applications move on project-by-project, opportunistically, so that testing efforts can be optimized. Over time, Solace grows into the core event broker, integrating microservices on-prem and in the cloud, while filling AI and ML lakes on the side.
INTEGRATING SOLACE WITH LEGACY ASSETS
PubSub+ works with leading iPaaS platforms through partnerships with Dell Boomi, MuleSoft and Adaptris, and it offers plug-and-play interoperability with many other iPaaS, API and ESB offerings.
CONNECTING LEGACY SYSTEMS WITH PUBSUB+ ON-PREM
You may want to deploy Solace PubSub+ appliances or software within your datacenter, and use them to meet the messaging needs of select applications while leaving others untouched. Some data entering the system via PubSub+ may be needed by applications using different messaging or data movement technologies. For example, certain records might need to be stored in a database. In such scenarios, you could set up your preferred iPaaS to consume messages from the PubSub+ message broker, then use the iPaaS JDBC or SQL component to insert the messages into a database via SQL query.
CONNECTING LEGACY SYSTEMS WITH PUBSUB+ IN THE CLOUD
If you’re deploying PubSub+ message brokers in the cloud or setting up instances of PubSub+ Cloud to meet the messaging needs of a new cloud-based service, you’ll frequently still need to exchange information with legacy applications running on-premises. In this scenario, you can configure the iPaaS to consume messages from the legacy system and publish them to your Solace PubSub+ Cloud message broker, which would then publish messages to all intended recipients via the new queue/topic.
CONCLUSION
There are many advantages to iPaaS, but limiting yourself to point-to-point REST and API-based connectivity limits the potential value to your organization in terms of agility, performance and robustness. Pairing your iPaaS with an advanced event broker to implement an event-driven architecture eliminates these limitations and unlocks high-value digital transformation by linking applications, IoT devices and microservices across hybrid and multi-cloud environments. Solace PubSub+ is the best event broker for achieving that goal, and it works with leading iPaaS vendors to create a best-of-breed, scalable, robust, agile and secure architecture. We have the know-how and experience to guarantee success, and we look forward to working with your team.
ABOUT SOLACE
We are the creators of PubSub+, an advanced event broker that can be used to create an event mesh. As the only unified event broker that supports publish/subscribe, queuing, request-reply and streaming using open protocols and APIs across hybrid cloud and IoT environments, PubSub+ rapidly and reliably routes information between applications, devices and people across clouds. Established enterprises such as SAP, Barclays, and the Royal Bank of Canada as well as high-growth companies such as VoiceBase and Jio use our smart data movement technologies to modernize legacy applications and successfully pursue analytics, hybrid cloud and IoT strategies. Learn more at solace.com.
A FEW OF OUR CUSTOMERS
   
 
OUR FEATURED PARTNERS
    
|
{"Source-Url": "https://3yecy51kdipx3blyi37oute1-wpengine.netdna-ssl.com/wp-content/uploads/2019/01/enabling-event-driven-ipaas-solution-brief.pdf", "len_cl100k_base": 4522, "olmocr-version": "0.1.50", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 29515, "total-output-tokens": 5178, "length": "2e12", "weborganizer": {"__label__adult": 0.0004820823669433594, "__label__art_design": 0.0007147789001464844, "__label__crime_law": 0.0006146430969238281, "__label__education_jobs": 0.0004563331604003906, "__label__entertainment": 0.00025272369384765625, "__label__fashion_beauty": 0.00024771690368652344, "__label__finance_business": 0.0148773193359375, "__label__food_dining": 0.00048065185546875, "__label__games": 0.000896453857421875, "__label__hardware": 0.00666046142578125, "__label__health": 0.0005135536193847656, "__label__history": 0.0003995895385742187, "__label__home_hobbies": 0.0002130270004272461, "__label__industrial": 0.002338409423828125, "__label__literature": 0.0003402233123779297, "__label__politics": 0.000518798828125, "__label__religion": 0.0004224777221679687, "__label__science_tech": 0.1485595703125, "__label__social_life": 0.0001583099365234375, "__label__software": 0.243896484375, "__label__software_dev": 0.57373046875, "__label__sports_fitness": 0.0004224777221679687, "__label__transportation": 0.002307891845703125, "__label__travel": 0.0003659725189208984}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22692, 0.00489]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22692, 0.07632]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22692, 0.91537]], "google_gemma-3-12b-it_contains_pii": [[0, 696, false], [696, 2314, null], [2314, 4004, null], [4004, 5242, null], [5242, 6171, null], [6171, 8244, null], [8244, 9622, null], [9622, 10956, null], [10956, 12331, null], [12331, 14957, null], [14957, 16554, null], [16554, 17633, null], [17633, 18773, null], [18773, 20936, null], [20936, 21704, null], [21704, 22692, null]], "google_gemma-3-12b-it_is_public_document": [[0, 696, true], [696, 2314, null], [2314, 4004, null], [4004, 5242, null], [5242, 6171, null], [6171, 8244, null], [8244, 9622, null], [9622, 10956, null], [10956, 12331, null], [12331, 14957, null], [14957, 16554, null], [16554, 17633, null], [17633, 18773, null], [18773, 20936, null], [20936, 21704, null], [21704, 22692, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 22692, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22692, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22692, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22692, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 22692, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22692, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22692, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22692, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22692, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22692, null]], "pdf_page_numbers": [[0, 696, 1], [696, 2314, 2], [2314, 4004, 3], [4004, 5242, 4], [5242, 6171, 5], [6171, 8244, 6], [8244, 9622, 7], [9622, 10956, 8], [10956, 12331, 9], [12331, 14957, 10], [14957, 16554, 11], [16554, 17633, 12], [17633, 18773, 13], [18773, 20936, 14], [20936, 21704, 15], [21704, 22692, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22692, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-03
|
2024-12-03
|
efb519d0cefb4c72d4f148d2fac7edd1fae6753b
|
In this and a few coming lectures, we look at the divide-and-conquer paradigm for algorithm design. This is applicable when any instance of a problem can be broken into smaller instances, such that the solutions of the smaller instances can be combined to get solution to the original instance. One usually has a “naive” but “slow” method to solve the problem at hand, and the D&C methodology (usually) “wins” if the combining can be done faster than the naive running time.
1 Merge Sort
**Sorting an Array**
**Input:** An array $A[1:n]$ of integers.
**Size:** The number $n$ of entries in $A$.
**Remark:** It is fair to ask why the size of the problem above doesn’t include the number of bits required to encode $A[j]$’s and $x$. The short answer is that it is a modeling choice. If the numbers $A[j]$’s are “small”, that is, they are at most some polynomial in $n$ and thus fit in $O(\log n)$ sized registers, then we assume that simple operations such as adding, multiplying, dividing, comparing, reading, writing take $\Theta(1)$ time. The reason being that for numbers that fit in word/registers indeed these operations are fast compared to the other operations of the algorithm.
Before we go into the divide-and-conquer algorithm for sorting, let us discuss the naive algorithm. Here is one: scan the whole array to find the minimum element, set it to $B[1]$ and remove it from $A$. Repeat the above process $n - 1$ times more. The $j$th scan takes $(n - j)$ time, and thus the total time taken is $\Theta(n^2)$. Quadratic time is not bad; it is definitely better than going over all the $n!$ permutations and choosing the sorted one. But, we can do better using divide-and-conquer.
This algorithm is *merge-sort*. You have perhaps seen this algorithm before (in CS 10 or CS 1), and the idea nicely captures the Divide-and-Conquer strategy.
First we notice if $n = 1$, then we return the same array; this is the base case.
Next, given an input $A[1:n]$ which needs to be sorted, we wish to divide into two smaller subproblems. We start with a natural way: we divide $A[1:n]$ into two halves $A[1:n/2]$ and $A[n/2+1:n]$. Next, we recursively apply the same algorithm to these halves to obtain sorted versions $B_1$ and $B_2$. Note that the final answer that we need is a sorted version of $B_1 \cup B_2$. So in the combine/conquer step we do exactly this.
At this point we need to figure out a “win”: why is sorting $B_1 \cup B_2$ any easier than sorting $A[1:n]$ to begin with. The fact we exploit is that these $B_1$ and $B_2$ individually are sorted. That is why we can in fact sort $B_1 \cup B_2$ way faster than the $\Theta(n^2)$ naive algorithm for $A[1:n]$. This is the non-trivial part of the algorithm, and once we get a “win” here over the naive algorithm, we will see that we get a win over all.
1
**Combine Step.** Let us then recall the Combine procedure of **MERGE**\textsc{Sort}.
\begin{tabular}{|l|}
\hline
\textbf{COMBINE} \\
\textbf{Input:} Two sorted arrays \(P[1:p]\) and \(Q[1:q]\). \\
\textbf{Output:} Sorted array \(R[1:r]\) of \(P \cup Q\), with \(r = p + q\). \\
\textbf{Size:} \(p + q\). \\
\hline
\end{tabular}
This is an iterative algorithm which keeps three pointers \(i, j, k\) all set to 1. At each step we compare \(P[i]\) and \(Q[j]\), and \(R[k]\) is set to whichever is smaller. That particular pointer and \(k\) are incremented. The process stops when either \(i\) reaches \(p + 1\) or \(j\) reaches \(q + 1\) in which case the rest of the other array is appended to \(R\). It takes \(\Theta(p + q)\) time as each step takes \(\Theta(1)\) time, in each step either \(i\) or \(j\) increments, and so the algorithm is over in \((p + q)\) steps. A formal pseudocode is given below both of the above combine step and the merge sort.
\begin{verbatim}
1: procedure COMBINE(P[1:p], Q[1:q]):
2: ▷ P and Q are sorted; outputs R a sorted array of elements in P and Q.
3: i = j = k ← 1.
4: while i < p + 1 and j < q + 1 do:
5: if (P[i] ≤ Q[j]) then:
6: R[k] ← P[i]
7: i ← i + 1
8: else:
9: R[k] ← Q[j]
10: j ← j + 1
11: k ← k + 1
12: if i > p then:
13: Append rest Q[j:q] to R
14: else:
15: Append rest of P[i:p] to R
16: return R.
\end{verbatim}
**Theorem 1.** If \(P\) and \(Q\) are sorted, then \(\text{COMBINE}(P, Q)\) returns a sorted array of the elements in \(P\) and \(Q\).
**Proof.** We first show that \(R\) is sorted. The reason is that \(P\) and \(Q\) are sorted and thus elements added to \(R\) are increasing. Formally, in an iteration \(k\) of the while loop, an element is added to \(R\) as \(R[k]\). This element is either an element \(P[i]\) or an element \(Q[j]\), for some \(i\) and \(j\), whichever is smaller. Let us assume it was \(P[i]\); the other case can be analogously argued. The previous element added to \(R\) (in the previous loop), that is, \(R[k-1]\) was either \(P[i-1]\) (in which case \(i-1\) was incremented to \(i\)) or it was \(Q[j-1]\). If the former, then \(R[k-1] \leq R[k]\) because \(P[i-1] \leq P[i]\) since \(P\) is sorted. If the latter, and this is crucial, then \(Q[j-1]\) must have been compared with \(P[i]\) since \(i\) didn’t increment in the \((k-1)\)th loop. And thus, \(Q[j-1] \leq P[i] = R[k]\). That is, even in this case \(R[k-1] \leq R[k]\). Thus in each step, what is added to \(R\) is increasing implying \(R\) is sorted. Secondly, all elements of \(P\) and \(Q\) are visited in this order. And thus, \(R\) is a sorted order of all elements in \(P\) and \(Q\).
\(\square\)
**Theorem 2.** \( \text{COMBINE}(P, Q) \) takes \( O(p + q) \) time.
**Proof.** Here is a general principle: when analyzing the running-time of an algorithm with a while loop, one needs to figure out a measure/quantity/potential which (a) either monotonically strictly increases or strictly decreases in each iteration of the while loop, (b) starts of at a known value, and (c) one can argue termination of the while loop if the value ever reaches a different quantity. Almost all while loop running times are measured that way.
For the \text{COMBINE}, what is this quantity? Well, we see that in the while loop, either \( i \) increments or \( j \) increments. Therefore, the quantity of interest is \( i + j \). This quantity starts off at 2. It always increases by 1. And finally note that if it ever reaches \( p + q + 2 \), then either \( i \geq p + 1 \) or \( j \geq q + 1 \) (for otherwise \( i < p + 1, j < q + 1 \) implying \( i + j < p + q + 2 \).) That is, the while loop terminates. This shows the while loop cannot have more than \( p + q \) iterations. Since each iteration takes \( O(1) \) time, we get the desired running time for \text{COMBINE}.
Armed with the above, the complete divide-and-conquer algorithm for sorting is given as:
```plaintext
1: procedure \text{MERGE}(A[1:n]):
2: ▷ Returns sorted order of \( A[1:n] \)
3: if \( n = 1 \) then:
4: return \( A[1:n] \), ▷ Singleton Array
5: \( m \leftarrow \lfloor n/2 \rfloor \)
6: \( B_1 \leftarrow \text{MERGE}(A[1:m]) \)
7: \( B_2 \leftarrow \text{MERGE}(A[m+1:n]) \)
8: return \text{COMBINE}(B_1, B_2)
```
**Theorem 3.** \text{MERGE} takes \( O(n \log n) \) time.
**Proof.** Let \( T(n) \) be the worst case running time of \text{MERGE} on arrays of size \( n \). Since \text{MERGE} is a recursive algorithm, just as we did in Lecture 1 with \text{MULT} and \text{DIVIDE}, we try figuring out line by line the times taken. Except now, we are armed with the power of Big-Oh, and we can start putting stuff under that rug. Let’s begin.
First, we see that when \( n = 1 \), only Lines 3 and 4 run. The time taken is some constant (independent of \( n \)) and we will call this unspecified constant \( O(1) \). Unlike as we did in \text{MULT} and \text{DIVIDE}, note that we did not specify what time means (like \text{BIT-ADDS} or something). Whatever you choose, these lines take constant time. Thus, we get
\[
T(1) = O(1)
\]
(1)
For larger \( n \), the code proceeds to Lines 6, 7, and 8. Line 6 is a recursive call. Since it is on an array of size \( m \), by definition of \( T() \), this takes at most \( T(m) \) time. Similarly, Line 7 takes at most \( T(n-m) \) time. And, Theorem 2 tells us that Line 8 takes \( O(n) \) time. Finally, we note that since \( m = \lfloor n/2 \rfloor \), we get that \( n - m = \lfloor n/2 \rfloor \). Therefore, putting all together, we get the recurrence.
\[
T(n) \leq T(\lfloor n/2 \rfloor) + T(\lfloor n/2 \rfloor) + O(n), \quad \forall n > 1
\]
(2)
To get to the big picture, we get rid of the floors and ceilings. In the supplement, you can see why this is kosher\(^1\). Furthermore, we also replace the $O(n)$ term by $\leq a \cdot n$ for some constant $a$, to get
$$T(n) \leq 2T(n/2) + a \cdot n, \quad \forall n > 1$$ \hspace{1cm} (3)
We will apply the “kitty method”
or “opening up the brackets” method to solve the recurrence inequality given by (1) and (3).
$$T(n) \leq 2T(n/2) + an$$
$$\leq 2(2T(n/4) + an/2) + an$$
$$= 4T(n/4) + 2an$$
$$\leq 4(2T(n/8) + an/4) + 2an$$
$$= 8T(n/8) + 3an$$
$$\vdots$$
$$\leq 2^kT(n/2^k) + kan$$
Setting $k$ such that $n/2^k \leq 1$ gives us $T(n) = O(n \log n)$.
\[\square\]
1.1 The Master Theorem
**Theorem 4.** Consider the following recurrence:
$$T(n) \leq a \cdot T([n/b]) + O(n^d)$$
\[\text{if you are a little worried about this, then (a) good, and (b) note that for large } x, \lfloor x \rfloor, \lceil x \rceil \text{ are really } x \pm \text{ some “lower order” term, and so since we are talking using the Big-Oh notation, it shouldn't matter.}\]
We now look at a closely related problem. Given an array
2 Counting Inversions
We now apply the divide-and-conquer paradigm to do better.
The proof is quite similar to the proof that the recurrence (2) solves to \( T(n) \leq O(n \log n) \). Instead of splitting into two, each “ball” splits into a different balls each of size \( n/b \) (ignoring floors & ceilings), but it puts \( \Theta(n^d) \) in the kitty. If you write the expression as above (it’s a little more complicated than the one we say before), then you will get a geometric series whose base is exactly \( a/b^d \).
Thus if \( a < b^d \) (that is, the base < 1), then the geometric sum is small, and the total cost is bounded by the first deposit in the kitty. If \( a = b^d \) (that is, if the base = 1) then we make around the same amount of deposits in the kitty, and we do it \( \Theta(\log n) \) times. Finally, if \( a > b^d \), then the geometric series is bounded by the other end, and the “number of small balls” (which is this bizarrish term \( n^{\log_b a} \)) is what dominates.
All this is perhaps too high-level to be useful – see the supplement for the proof.
Exercise:
- Solve the recurrence \( T(n) \leq 2T(n/2) + \Theta(1) \).
- Solve the recurrence \( T(n) \leq T(n/3) + T(2n/3) + \Theta(n) \).
- Solve the recurrence \( T(n) \leq \sqrt{n} \cdot T(\sqrt{n}) + \Theta(n) \).
2 Counting Inversions
We now look at a closely related problem. Given an array \( A[1 : n] \), the pair \((i, j)\) for \(1 \leq i < j \leq n\) is called an inversion if \( A[i] > A[j] \). For example, in the array \([10, 20, 30, 50, 40]\), the pair \((4, 5)\) is an inversion.
**COUNTING INVERSION**
**Input**: An array \( A[1 : n] \)
**Output**: The number of inversions in \( A \).
**Size**: \( n \), the size of the array.
There is a naive \( O(n^2) \) time algorithm: go over all pairs and check if they form an inversion or not. We now apply the divide-and-conquer paradigm to do better.
If \( n = 1 \), then the number of inversions is 0. Otherwise, suppose we divide the array into two: \( A[1 : n/2] \) and \( A[n/2 + 1 : n] \). Recursively, suppose we have computed the number of inversions in \( A[1 : n/2] \) and \( A[n/2 + 1 : n] \). Let these be \( I_1 \) and \( I_2 \), respectively. Note that any inversion \((i, j)\) in \( A[1 : n] \) satisfies
(a) either \( i < j \leq n/2 \), which implies \((i, j)\) is an inversion in \( A[1 : n/2] \), or
(b) \( n/2 + 1 \leq i < j \), which implies \((i, j)\) is an inversion in \( A[n/2 + 1 : n] \), or
(c) \( i \leq n/2 < j \), and these are the extra inversions over \( I_1 + I_2 \) that we need to count.
Let’s call any \((i, j)\) of type (c) above a cross inversion, and let \( C \) denote this number. Then by what we said above, we need to return \( I_1 + I_2 + C \). Is it any easier to calculate \( C \)?
After you think about it for a while, there may not seem to be any easy way to calculate \( C \) faster than \( O(n^2) \). There are two crucial observations that help here.
• The number of cross-inversions between \(A[1 : n/2]\) and \(A[n/2 + 1 : n]\) is the same as between \(\text{sort}(A[1 : n/2])\) and \(\text{sort}(A[n/2 + 1 : n])\), where \(\text{sort}(P)\) is the sorted order of an array \(P\).
• If \(A[1 : n/2]\) and \(A[n/2+1 : n]\) were sorted, then the cross-inversions can be calculated in \(O(n)\) time.
This may not be immediate, but if you understand the \textsc{Combine} subroutine above, then it should ring a bell. We elaborate on it later.
\textbf{Cross-Inversions between Sorted Arrays.} Given two sorted arrays \(P[1 : p]\) and \(Q[1 : q]\), we can count the number of cross-inversion pairs \((i, j)\) such that \(P[i] > Q[j]\) in \(O(n)\) time as follows. As in \textsc{Combine} we start off with two pointers \(i, j\) initialized to 0. We check if \(P[i] > Q[j]\) or not. If it isn’t, that is if \(P[i] \leq Q[j]\), then \((i, j)\) is not a cross-inversion and we simply increment \(i = i + 1\). Otherwise, if \(P[i] > Q[j]\), then we increment \(\text{num} = \text{num} + (p - i + 1)\) and \(j = j + 1\).
Why so much? Well, not only is \((i, j)\) a cross-inversion, so are \((i+1, j)\), \((i+2, j)\), and so on till \((p, j)\). The claim below explains it more formally. We stop when either \(i = p + 1\) or \(j = q + 1\).
\textbf{Claim 1.} At any stage, suppose the algorithm encounters \(P[i] > Q[j]\). Then \(\{(i', j') : i' \geq i\}\) are the only cross-inversions which involve \(j\).
\textbf{Proof.} Since \(P\) is sorted, \(P[i'] > Q[j]\) for all \(i' \geq i\) and so all such \((i', j)\) are inversions. Now consider any \(i'' < i\). Since in the algorithm the pointer is at \(i > i''\), at some previous stage the algorithm compared \(P[i'']\) and \(Q[j'']\) with \(j'' \leq j\), and found \(P[i''] \leq Q[j'']\). But since \(Q\) is sorted, this would imply \(P[i''] \leq Q[j]\). This implies for all \(i'' < i\), \((i'', j)\) is not an inversion.
\begin{verbatim}
1: procedure COUNTCROSSINV(P[1 : p], Q[1 : q]):
2: \triangleright P and Q are sorted; outputs the number of \((i, j)\) with \(P[i] > Q[j]\).
3: \hspace{1em} i ← 1; j ← 1; num ← 0.
4: \hspace{1em} while \(i < p + 1\) and \(j < q + 1\) do:
5: \hspace{2em} if \((P[i] > Q[j])\) then:
6: \hspace{3em} num ← num + \((p - i + 1)\)
7: \hspace{3em} j ← j + 1
8: \hspace{2em} else:
9: \hspace{3em} i ← i + 1
\end{verbatim}
\textbf{Theorem 5.} \textsc{CountCrossInv} counts the number of cross inversions between \(P\) and \(Q\) in time \(O(p + q)\).
Now we are armed to describe the divide-and-conquer algorithm for counting inversions.
Let’s analyze the time complexity. As always, let $T(n)$ be the worst case running time of COUNTINV1 on an array of length $n$. Let $A[1 : n]$ be the array attaining this time, and let’s see the run of the algorithm on this array. The time taken by Lines 6 and 7 are $T([n/2])$ and $T([n/2])$ respectively. The time taken by Line 10 takes $O(n)$ time by what we described above. Furthermore, the Lines 8 and 9 takes $O(n \log n)$ time by Theorem 3. Together, we get the following recurrence
$$T(n) \leq T([n/2]) + T([n/2]) + O(n \log n)$$
The above ‘almost’ looks like (2), and indeed the recurrence solves to $T(n) = O(n \log^2 n)$.
But there is something wasteful about the above algorithm. In particular, if you run it on a small example by hand you will see that you are sorting a lot. And often the same sub-arrays. Is there some way we can exploit this and get a faster algorithm?
Indeed we can. This introduces a new idea in the divide-and-conquer paradigm: we can get more by asking for more. This “asking for more” technique is something you may have seen while proving statements by induction where you can prove something you want by actually asking to prove something stronger by induction. In this problem, we ask our algorithm to do more: given an array $A[1 : n]$ it has to count the inversions and also has to sort the array too. Now note that in this case Lines 8 and 9 are not needed any more; this is returned by the new stronger algorithm. We however need to also return the sorted array: but this is what COMBINE precisely does. So the final algorithm for counting inversions is below.
```
1: procedure COUNTINV1(A[1 : n]):
2: ▷ Counts the number of inversions in A[1 : n]
3: if n = 1 then:
4: return 0. ▷ Singleton Array
5: m ← [n/2]
6: I₁ ← COUNTINV1(A[1 : m])
7: I₂ ← COUNTINV1(A[m + 1 : n])
8: B₁ ← MERGESORT(A[1 : m])
9: B₂ ← MERGESORT(A[m + 1 : n])
10: C ← COUNTCROSSINV(B₁, B₂)
11: return I₁ + I₂ + C.
```
Now we see that the recurrence for the running time of SORT-AND-COUNT is precisely
$$T(n) \leq T([n/2]) + T([n/2]) + O(n)$$
**Theorem 6.** SORT-AND-COUNT returns the number of inversions of an array $A[1 : n]$ in $O(n \log n)$ time.
As an application, you are now ready to solve Problem 1 of PSet 0. Go ahead and try it!
|
{"Source-Url": "https://www.cs.dartmouth.edu/~deepc/Courses/S20/lecs/lec3.pdf", "len_cl100k_base": 5618, "olmocr-version": "0.1.53", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 36227, "total-output-tokens": 6330, "length": "2e12", "weborganizer": {"__label__adult": 0.0003056526184082031, "__label__art_design": 0.00030684471130371094, "__label__crime_law": 0.00035381317138671875, "__label__education_jobs": 0.0007033348083496094, "__label__entertainment": 6.878376007080078e-05, "__label__fashion_beauty": 0.00013625621795654297, "__label__finance_business": 0.00013148784637451172, "__label__food_dining": 0.0004954338073730469, "__label__games": 0.000918865203857422, "__label__hardware": 0.0012969970703125, "__label__health": 0.0005445480346679688, "__label__history": 0.0002472400665283203, "__label__home_hobbies": 0.00014483928680419922, "__label__industrial": 0.0005030632019042969, "__label__literature": 0.0001823902130126953, "__label__politics": 0.00023555755615234375, "__label__religion": 0.0005216598510742188, "__label__science_tech": 0.0301361083984375, "__label__social_life": 7.62939453125e-05, "__label__software": 0.005619049072265625, "__label__software_dev": 0.9560546875, "__label__sports_fitness": 0.0003795623779296875, "__label__transportation": 0.0005297660827636719, "__label__travel": 0.0002397298812866211}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 17515, 0.05266]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 17515, 0.38437]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 17515, 0.85545]], "google_gemma-3-12b-it_contains_pii": [[0, 2898, false], [2898, 5601, null], [5601, 8598, null], [8598, 9656, null], [9656, 12676, null], [12676, 15244, null], [15244, 17318, null], [17318, 17515, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2898, true], [2898, 5601, null], [5601, 8598, null], [8598, 9656, null], [9656, 12676, null], [12676, 15244, null], [15244, 17318, null], [17318, 17515, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 17515, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 17515, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 17515, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 17515, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 17515, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 17515, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 17515, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 17515, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 17515, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 17515, null]], "pdf_page_numbers": [[0, 2898, 1], [2898, 5601, 2], [5601, 8598, 3], [8598, 9656, 4], [9656, 12676, 5], [12676, 15244, 6], [15244, 17318, 7], [17318, 17515, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 17515, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
2bddc999fb87062f0cf87b0bebc5b941e83ea3ce
|
Chapter 6: MAKE A COMPUTER PROTOTYPE
What Is a Computer Prototype?
A computer prototype is the translation of your paper prototype into marked up HTML files that can be viewed with Web browsers. It should encompass the breadth of your site and several strands representing the depth of the site. At this point you will still not be developing the entire site.
The computer prototype does not appear on the Web. You'll store the files off-line on one or more computers that will be used for testing, or on a non-Web server where they can be accessed as local files by several computers.
Why Should I Make a Computer Prototype?
You tested your design on paper to find any problems with the information structure as early in the process as possible. You feel reasonably confident that you have useful content and appropriate relationships between parts of that content.
Now it's time to mock up the design complete with interaction, HTML limitations (and possibilities), and graphics and other media. The next rounds of testing will uncover problems with the message design, technical design and interface design of your site.
Getting Started
Start from your paper prototype. Your computer prototype will include all the content from the last version of your paper prototype; the breadth of your site as represented in all the main "access" pages and the depth of your site as represented by several "strands" that lead all the way to specific information. Don't worry about adding more pages while you're creating the computer prototype -- work rapidly so that you'll have the time and energy to make changes after conducting some more tests.
Choose Standard Elements for Your Pages
Before you begin to translate the pages of your paper prototype directly to marked up HTML files that Web browsers can read, make some preliminary decisions about the standard elements that are going to appear on every page of your site.
Headers
The top of your page is an important place to put information to orient users to their location on the Web and their location within your site. If you decide that your standard page headers are going to be graphical, remember to use the <alt> parameter to insert text that will be seen instead of the graphic by the people who use non-graphical browsers or deliberately turn the graphics off in their browsers. At the
very least the header for your pages should identify your organization
and the name of the site.
Navigation
"Navigation" refers to the ways in which users move around within
hypertext documents like Web pages. Links from one page to another
are the basic form of navigation on the Web. Most Web browsers also
include navigation features for common operations users need,
including at least some form of the following:
- "Back" – return to the previous page in the sequence a user
has followed most recently
- "Forward" – move to the next page in the sequence a user
has followed most recently
- "Home" – move to the user's designated default page (often
the user's own, or the main page of an organization)
- "Go to ..." and "Open ..." – jump to a page by typing in the
URL (address) or by opening a local HTML file
- "Go" – jump directly to one of the pages in the sequence
most recently followed by selecting from a list of page titles
- "Bookmark" – jump directly to a page in a list of URLs
(Universal Resource Locators, or addresses) previously saved
by the user
These basic operations will not cover all your users' needs, so you
have to create links directly on your pages for the specific navigation
that will make your site usable. As you select standard elements for
your computer prototype consider how users will get to your main page
conveniently from anywhere in your site, how they will return to major
access points within the site, and how they will get around inside long
documents (like phone lists). Users come to rely on navigation
features, so design them as standard components of your pages.
Getting to Your Main Page
Provide a link on every page that allows users to return to the main
page of your site. In addition to the convenience this link affords users
who arrived at your site via the main page, it ensures that visitors who
arrive via some specific page deep within your site will be able to get
access to pages other than the first one they see.
Returning to Important Access Points
Most sites include several major access points besides the main
page. Often these access points are pages with lists of links to other
pages in the site, but a long academic paper with embedded links to
graphics and secondary texts and related papers can also be thought of,
in its entirety, as an important access point. Every page linked from a
primary access point should include a link back to that access point, as
should any additional pages linked to those. When you offer links back
to important access points, users do not have to hunt through the titles
of recently visited pages or back up through page after page in order to
return to a page.
Getting Around Inside Long Pages
Even though you should take care to limit the length of pages, both
for the sake of making them load faster and in acknowledgment that
users do not like to scroll through long pages of information, sometimes
it only makes sense to create relatively long pages. Phone lists and
annotated menus are examples of information that should not be broken
into separate pages unless they are extremely long because each
separate page will have to download to the user's computer separately
and users will find it frustrating to load page after page looking for
what they want.
Anything users will want to print conveniently may also be best
presented as single pages. You can offset some of the disadvantages of
long pages by providing internal links on the page so that users can
"jump around" to its major sections. Don't forget to provide links for
getting back to the top of such pages.
Footers
The bottom of each page is a good place to put several items of information that users may need periodically, but may not want to want to look at all the time. Among the elements to consider for footers are:
- date of the last update to the page
- credit for maintenance of the page
- email link to send comments to the person maintaining the site
- URL of this document (so that it will always appear on printed documents)
- copyright statement
- sponsorship notices if the site receives outside support.
Mock up a Visual Identity for Your Site
The "visual identity" of your site consists of all the visual components (text, images, colors, placement of elements) on your pages. Some components, like logo graphics or distinctive colors, contribute more forcefully to your visual identity than do "standard" Web components like bulleted lists and horizontal rules, but everything on the page affects the overall visual identity that users perceive. You can't tell how things will look together until you try them, and you can't always tell how they will affect your users until they see the whole "look," so pay attention to visual elements while you're building your computer prototype, and be prepared to change them!
Make Your Visual Identity Communicate to Your Audience That They Have Come to the Right Place
Consider the periodicals rack in any large bookstore. The range of visual styles on the covers of the magazines is usually tremendous. The video game magazines tend to be brightly colored and packed with images while the decorator's journals display muted colors and only a few carefully-chosen pictures. Some literary magazines have only text on the covers, and some of the magazines read by technical hobbyists have lots of text on the covers. You can usually tell a lot about what
the contents of the magazine will be, and whether or not it interests you, just by looking at the cover. The users of your site will do the same thing with your pages.
Most often the visual identity that appeals to your audience also communicates an image that reflects your organization. If you work for a large insurance company, you are liable to want to project a stable, trustworthy image. If you work for a start-up multimedia development company, you may give your site a very current, even off-beat "look." Ask yourself what the people in your target audience are looking for from you, and make the "cover" of your site communicate that they have found the right place.
Use Your Visual Identity to Help Users Orient Themselves
When all the pages in your site have a similar look based on your visual identity, users can tell that they are still looking at your information no matter how many links they follow from page to page. This is reassuring for the users, and it doesn't hurt your organization to have the message, “This information brought to you by ...” reinforced as people use your site.
Create Landmarks
People navigate hypertext environments like the Web in ways similar to those they use for getting around their physical environment.
One of the key strategies people use is to identify landmarks, or distinctive features in the environment. They remember these landmarks and use them to "anchor" other information about the environment (e.g., "My house is 2 blocks past the big green water tower as you're heading for the lake.") When people are lost they look for and return to familiar landmarks as a starting point for finding their way.
In a hypertext environment you can encourage users to remember landmark locations by giving those pages a distinctive look. You can also give users the ability to "jump" directly back to landmark locations by using links. An effective solution used by many designers is to miniaturize a distinctive graphical element from the landmark location and use this miniature graphic as a link back to that location on other pages. Remember to include consistent, distinctive ALT text (text specified within a graphical link as the alternative to display when the graphic cannot be shown) with these graphics that will make the landmarks and their links usable in non-graphical browsers.
**Design Your Identity to Work for Pages at Different Levels and Pages from Different Parts of the Organization**
**Different Levels**
The main page, or the one that users see when they follow the primary URL for your site, is a page that many of your users will see first, most of your users will end up on eventually, and some users will visit repeatedly (you hope). This page will establish your visual identity, so it may have a larger graphical image on it than you are willing to put on the other pages of your site. Plan this image so that a
smaller version of it, or a portion of it, can be used to carry the visual identity to other pages in the site.
**Different Parts of the Organization**
Many organizations are made up of semi-autonomous units that want their own identities to appear on their pages, even though they recognize that the entire site should be recognizable as belonging to the organization. Your visual identity should allow different units to incorporate their own elements smoothly without losing the recognizable "look" of your site.
Consider Visibility, Legibility, and Readability of Text on the Screen
Until now you have worried about whether or not the words you're using make sense to your users and appear in the right places. As you build your computer prototype you have to consider three ergonomic properties of text that contribute strongly to its usability for the reader: visibility, legibility, and readability.
Visibility
Visibility is the degree to which the text may actually be seen. Of course you wouldn't intentionally put invisible text on your Web pages, but a surprising number of designers do so unintentionally. The visibility of text relies primarily on high contrast between the letters and the ground against which they are to be seen. Text can disappear on Web pages when the background color a designer chooses does not have good contrast with the color of the text and the contrast between colors can change from one platform to another so designers may not know that their text isn't visible to some users. Keep the contrast between text and background high; black on white or light gray is the best contrast for computer screens.
Legibility
Legibility is the degree to which individual letter forms may be distinguished from others and from the ground on which they appear. Even though the letters may be visible, they will not necessarily be legible. Most computer displays are subject to legibility problems because their resolution is relatively low compared to paper (computer displays are generally 72 dots per inch while common laser printing is 300 dots per inch and commercial book printing is >1000 dots per inch).
Background images cause the biggest legibility problems on Web pages that we've seen. Every pixel in a background image has the potential to interfere with the users' perception of letter forms displayed over that image, and the problem is exacerbated when the contrast between the background and the text is low. One in every twelve men and one in every 165 women have a color vision disability. Don't add to the problems some of your users already face reading the computer screen.
screen by forcing them to pick out letters from a busy background, as shown below. If you use background images at all, they should be very low contrast, with high contrast between the image and your text.
Very small text tends to "break up" on screen because there are only a limited number of pixels available to display each letter. Some browsers accept tags which set the point size of text at a fixed percentage smaller than the default size that a user has selected. Such tags can be useful for subordinating information (copyright notices, links for nonessential navigation) that you don't want competing with your primary content. Use them cautiously though, since you don't know whether a user's default setting will cause your smaller text to appear at 9 points or less, where most fonts become illegible on the screen.
Readability
Readability is the degree to which the text may be scanned effectively during normal reading. Line length and the distance between lines of text (or leading) are two primary factors affecting readability. Relatively short lines of text (approximately 40 - 60 characters) are recommended for best readability and more distance between lines is recommended for situations in which line lengths must be longer than 60 characters. You will not be able to control some aspects of readability on the Web because line length and leading both depend on the Web browser and the window size a reader has selected. You can create readable text by breaking up large blocks of text into smaller visual units, and allowing users some flexibility in the appearance of the text.
Break the Text up Visually
Use blank lines between paragraphs and horizontal rules between sections of documents or lists to break up large blocks of text. Use embedded lists when possible, and include "Back to the top" links periodically in long pages of text. You won't be able to stop people from resizing a window on a large screen until it displays 70 - 80 characters across, but by breaking text up in various ways you can avoid having them read several hundred lines of text at 70 - 80 characters per line.
Restrict the Use of "Graphical Text"
Don't put lots of text into image files in order to control how it appears on the user's screen. This recommendation may seem paradoxical; if line length and leading may be used to improve readability, then why not use a lot of graphical text so that you can be sure it appears correctly? The main reason to restrict graphical text is that images take longer to download than does plain text; in trying to improve readability you don't want to lose your audience because they get tired of waiting for the page to appear. Another reason to use text with HTML tags is that your users will then have the choice to adjust the display for their own comfort. Some browsers now support very complex specifications for fonts and font sizes, but use these with caution since they restrict the users' ability to view your pages according to their own preferences.
Control the Content of Your Pages, Not the Exact Appearance
HTML (Hypertext Markup Language) specifies the structure of documents. The tags you insert into a text file mark headings, lists, insertion points for graphics, and other elements of structure. The Web browser, a computer program that retrieves and displays Web files, interprets HTML tags according to its own set of parameters. White space between paragraphs, indenting of bulleted lists, and other specifics of how a file's structure will be translated to the computer screen vary from one browser to the next. Users can also set preferences for fonts, colors, window size, and other aspects of the way their browsers will display your pages. The Web was designed this way so that many people using different computers could look at the same file and see a reasonable display of its contents. The design of the Web itself guarantees that you will not be able to control the appearance of your pages for everyone who sees them.
What you can control in Web design are the words, images, and other elements your pages will contain, and the order in which they will appear. Spend most of your design time on these elements. Use the simplest page design that will work. Much of the effort you pour into adjusting and controlling the appearance of your pages is wasted unless you are certain, or you intend to demand, that your audience use only one browser on only one platform.
The rule of thumb to keep in mind for most audiences is this: if a choice doesn't appear in a "standard" size window when the page is first displayed, the choice may as well not be there. Users do not like to scroll and they don't choose links that they don't see. This is especially true for novice or infrequent computer users and for people who aren't
Remember, "Out of Sight, out of Mind"
The same Web page from the Oxford English Dictionary. Top browser window is 640x480 pixel resolution. Bottom browser is 1024x768 pixels, and the user prefers to view this page in a different font.
sure they’re on the right track to find what they’re looking for, but many Web users exhibit a marked reluctance to scroll past the first screen of a Web page. Once users find content that answers their questions or grabs their attention, they will often scroll through a page or wait for a graphic to display, but in general they behave as though pages did not extend beyond the standard window.
Do your best to fit the information on all your access pages (typically the top levels of your site) into a standard browser window on a 14-inch display using the default preferences that come with several browsers.
Create a Robust Design
A robust design is one that will work reasonably well for everyone who visits it. You may have seen pages with notifications reading, "This page optimized for XYZ browser. Download the software now!" Your analysis of the needs of your audience has probably already alerted you to the fact that people do not want to spend their time downloading software that they may not even be able to run. Your audience wants your information, and they want it as rapidly and conveniently as they can get it. Don't place obstacles in their path by using features that require your users to spend all their time configuring helper applications or installing new versions of their browser.
Create and Test Template Files to Use for the Prototype
Once you have decided on standard page elements and visual identity, make a template page from which you will construct the rest of the prototype pages. You may have a "top level" template, a "second level" template, and so on. Templates save time and ensure that all the information will be identical on all the pages of the prototype. Be sure to test the template on several browsers and computer platforms before you build your prototype – few activities are less fun (and more prone to error) than correcting typographical errors in multiple files.
In the future, cascading style sheets will be the preferable way to achieve this "template" goal. HTML will be superceded by XML (Extensible Markup Language). XML will allow designers to separate the data of documents and the styles or appearance of the information. XSL (Extensible Style Language) will make it possible for the same data to be rendered differently according to different styles. For example, a style could be created for PDA's with very small screens; another for TV displays; another for screen readers for visually impaired users; etc. This is very good news for designers, and will make maintenance of Web sites much easier and will help achieve greater consistency among pages which use the same styles.
Begin a Style Guide for Your Site
In the last chapter you began recording design decisions during the creation of your paper prototype. Now you should begin a style guide for your site using those records as a starting point. A style guide is a collection of all the design and technical conventions you will follow for making your Web files. By this time your style guide should already contain guidelines for:
- standard page headers
- standard page footers
- visual identity elements
- optimum page length for major access pages
- consistent wording for parts of the organization and parts of the Web site.
The style guide you create now will evolve. Parts of it will inevitably change as you test the prototype. You start assembling it now so that everyone working on the prototype follows the same guidelines, and so that the effort of creating it later on in the project is not overwhelming. The IUB Web design team published their provisional style guide to the Web early in the project and modified it throughout testing of the computer prototype. Eventually they revised it into its present form, but it will continue to evolve along with the site. A style guide pays for itself by saving design teams hours of discussion as they revisit design issues that turn out to have been resolved earlier, and as they streamline the creation of new pages after the site is published.
Create the Pages of the Prototype
Working from the tested template files, create an HTML file for each page of your final paper prototype. If you follow the tentative style guide as you work you can have multiple members of the team creating files at one time and be sure that they are consistent when they're done. Don't publish this prototype to the Web yet. Using search facilities of many kinds people can discover your prototype pages very easily and browse them, or get misinformation from them, or form poor opinions of them, long before you are ready to show them to the world. You will also save time and energy revising your files when you do not have to publish and republish them after every change.
Check the Prototype Yourself
Check the prototype page by page looking for typographical errors and elements that don't follow your guidelines. When there are multiple people on the team it's a good idea to have them check each other's pages so they don't miss their own mistakes through familiarity. If you have one person on the team who can sit down and check all the pages just before user test sessions begin, it can be very helpful since one person can spot inconsistencies between pages better than multiple checkers can.
|
{"Source-Url": "http://www.indiana.edu/%7Epedagogy/preview/pwd/chapter6etp.pdf", "len_cl100k_base": 4698, "olmocr-version": "0.1.50", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 27060, "total-output-tokens": 5362, "length": "2e12", "weborganizer": {"__label__adult": 0.0007891654968261719, "__label__art_design": 0.137451171875, "__label__crime_law": 0.0004754066467285156, "__label__education_jobs": 0.02325439453125, "__label__entertainment": 0.0004854202270507813, "__label__fashion_beauty": 0.0006732940673828125, "__label__finance_business": 0.0018281936645507812, "__label__food_dining": 0.000621795654296875, "__label__games": 0.0013437271118164062, "__label__hardware": 0.00464630126953125, "__label__health": 0.0004854202270507813, "__label__history": 0.0011053085327148438, "__label__home_hobbies": 0.0011129379272460938, "__label__industrial": 0.0010595321655273438, "__label__literature": 0.0016937255859375, "__label__politics": 0.00022745132446289065, "__label__religion": 0.0012025833129882812, "__label__science_tech": 0.0246429443359375, "__label__social_life": 0.0002727508544921875, "__label__software": 0.088623046875, "__label__software_dev": 0.70654296875, "__label__sports_fitness": 0.0002899169921875, "__label__transportation": 0.0007185935974121094, "__label__travel": 0.0005249977111816406}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 23913, 0.00122]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 23913, 0.21968]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 23913, 0.93973]], "google_gemma-3-12b-it_contains_pii": [[0, 2357, false], [2357, 4532, null], [4532, 5970, null], [5970, 6486, null], [6486, 7782, null], [7782, 9044, null], [9044, 10683, null], [10683, 11201, null], [11201, 13313, null], [13313, 15437, null], [15437, 17321, null], [17321, 18361, null], [18361, 21284, null], [21284, 22671, null], [22671, 23913, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2357, true], [2357, 4532, null], [4532, 5970, null], [5970, 6486, null], [6486, 7782, null], [7782, 9044, null], [9044, 10683, null], [10683, 11201, null], [11201, 13313, null], [13313, 15437, null], [15437, 17321, null], [17321, 18361, null], [18361, 21284, null], [21284, 22671, null], [22671, 23913, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 23913, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 23913, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 23913, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 23913, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 23913, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 23913, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 23913, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 23913, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 23913, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 23913, null]], "pdf_page_numbers": [[0, 2357, 1], [2357, 4532, 2], [4532, 5970, 3], [5970, 6486, 4], [6486, 7782, 5], [7782, 9044, 6], [9044, 10683, 7], [10683, 11201, 8], [11201, 13313, 9], [13313, 15437, 10], [15437, 17321, 11], [17321, 18361, 12], [18361, 21284, 13], [21284, 22671, 14], [22671, 23913, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 23913, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-29
|
2024-11-29
|
e500ddee72cabd960e364af541e203d5026554bc
|
3cixty@Expo Milano 2015: Enabling Visitors to Explore a Smart City
Giuseppe Rizzo, Raphäel Troncy, Oscar Corcho, Anthony Jameson, Julien Plu, Juan Carlos Ballesteros Hermida, Ahmad Assaf, Catalin Barbu, Adrian Spirescu, Kai-Dominik Kuhn, et al.
To cite this version:
Giuseppe Rizzo, Raphäel Troncy, Oscar Corcho, Anthony Jameson, Julien Plu, et al.. 3cixty@Expo Milano 2015: Enabling Visitors to Explore a Smart City. 2015. <hal-01277195>
3cixty@Expo Milano 2015
Enabling Visitors to Explore a Smart City
Giuseppe Rizzo,1 Raphaël Troncy,1 Oscar Corcho,2 Anthony Jameson,3 Julien Plu,1 Juan Carlos Ballesteros Hermida,2 Ahmad Assaf,1 Catalin Barbu,3 Adrian Spirescu,3 Kai-Dominik Kuhn,3 Irene Celino,4 Rachit Agarwal,5 Cong Kinh Nguyen,5 Animesh Pathak,5 Christian Scannu,6 Massimo Valla,6 Timber Haaker,7 Emiliano Sergio Verga,4 Matteo Rossi,8 José Luis Redondo García1
1 EURECOM, France
2 Universidad Politécnica de Madrid, Spain
3 DFKI, Germany
4 CEFRIEL, Italy
5 Inria, France
6 Telecom Italia, Italy
7 InnoValor, The Netherlands
8 Politecnico di Milano, Italy
Abstract. Planning a visit to Expo Milano 2015 or simply touring in Milan are activities that require a certain amount of a priori knowledge of the city. In this paper, we present the process of building such a comprehensive knowledge base, the 3cixty KB, that contains descriptions of events, places, transportation facilities and social activities, collected from numerous static, near- and real-time local and global data providers, including Expo Milano 2015 official services and several social media platforms. Entities in the 3cixty KB are deduplicated, interlinked and enriched using semantic technologies. The 3cixty KB is empowering the ExplorMI 360 multi-device application, which has been officially endorsed by the E015 Technical Management Board and has gained the patronage of Expo Milano 2015, thus offering a unique testing scenario for the 20 million expected visitors along the 6 months of the exhibit. As of September 7th, 2015 the 3cixty KB contains unique descriptions of 18,665 events, 758 artists, 225,552 places, 9,342 transportation facilities, 95,570 illustrating photos and 94,789 reviews contributed by 81,944 users. The 3cixty KB is accessible at http://3cixty.eurecom.fr/sparql while ExplorMI 360 at https://www.3cixty.com.
1 Pitch
Can we present the city of Milan in such a way that visitors can digitally plan in advance a visit, and explore what is happening once being in the city with the support of a digital guide? In the context of Expo Milano 2015, we have answered this question by collecting a vast amount of cultural and touristic data about the city of Milan from the E015 digital ecosystem9 and social media
9 http://www.e015.expo2015.org
platforms (such as Facebook, and Google). The resulting knowledge base, so-called the 3cixty KB, acts as a curated data marketplace which is then used to feed the ExplorMI 360 multi-device application composed of a web application and mobile companion guides available for Android and iOS devices. The 3cixty KB contains descriptions of cultural events, places and their reviews and transportation means offered in a city. It also includes 285,773 links to external resources on the Web providing attribution and enrichment. As optimization, we have decomposed the geographical extent into cells and materialized travel time distances among the different geographic points. This offers new opportunities for Expo Milano 2015 visitors to learn what will happen during the 6 months exhibit, how to get there, and more generally, how to take advantage of the city including visiting its sights or discovering some hidden places in a completely personalized experience through the ExplorMI multi-device application. The web application enables city visitors to explore the diverse entities of the 3cixty KB in several directions in parallel, that can be saved in a personalized wishlist. The mobile application, instead, offers a companion digital guide that is mostly used by visitors once they are in the city, and want to be reminded about their favorite places and events added in their wishlist. In addition, the 3cixty KB is also intended to be used by developers to build their own apps and to extend the city digital data ecosystem. The modular design of our workflow makes the 3cixty KB extensible to any other city in the world and we have started to extend the 3cixty KB to cover the cities of London (with a focus on the Queen Elizabeth Olympic Park) and Nice. Data is the new oil we repeatedly hear and are convinced of. But the typical city digital ecosystem is scattered across different data sources and with different accessing mechanisms [6]. The 3cixty KB aims to collect and harmonize descriptions of entities in one place, and to provide additional services such as reconciliation and deduplication for offering comprehensive and accurate descriptions, data analytics, data visualization and mobility optimization such as providing the time it takes to reach any place or event using public transportation from any point in the city. The 3cixty KB can empower a variety of applications and business models, as it is evident from the commercial interest from numerous companies.
2 Technical Description
The proposal of building a knowledge base for a city by combining open and private data, including data verification, reconciliation and validation, is not new. The KM4City (Knowledge Model for City) project has conducted an expert study over smart city datasets that has resulted in a new comprehensive ontology that aims to become a standard for smart cities [1]. The CitySDK project[10] offers a suite of uniform APIs to turn cities’ data ready to be consumed by web developers. The project focuses on three dimensions: citizen participation, mobility and tourism. The STAR-CITY project focuses on traffic analytics for the city of Dublin, integrating numerous sensor data using semantic web technologies for accurately predicting road traffic conditions [5]. Distinguishing features
of the 3cixty KB are: data-centric view of the platform, built on top of well-known ontologies, and exposed as a curated data marketplace to developers via semantic web technologies. We summarize the technical challenges we address for building the 3cixty KB and how it is used to offer services to end-users.
### 2.1 Knowledge Base Population
The population of the 3cixty KB follows the workflow: data source selection, data modeling, geographic grid data sampling, and data reconciliation [6].
**Data Source Selection.** A strict procedure has been followed for selecting the data sources to be included in the 3cixty KB, with the goal of maximizing the spatial and temporal coverage of data, its complementary in terms of semantics, its real-time nature and, more importantly, its usefulness for city visitors. An agile process has been established for continuously monitoring and updating the list of potentially relevant sources. Three types of data sources are used: E015 data services, social media platforms, and additional data about the Expo itself that has been generated by an editorial team (Table 1). The E015 digital ecosystem aims at sharing data relevant for Expo Milano 2015 visitors through services offered mostly by local providers. We combined such a wealth of data with content publicly available on social media platforms, the rationale being to increase the coverage of the points of interest and to complement the description of existing events with user-generated activities. Finally, our last data source is the list of events advertised by the various pavilions in the exhibit and the list of places where those events are taking place. An editorial team composed of five people have mapped on-site the geographical area and are continuously scraping the numerous agenda of events per pavilion.
<table>
<thead>
<tr>
<th>Entity-Type</th>
<th>E015</th>
<th>Social Media Platform</th>
<th>Expo</th>
</tr>
</thead>
<tbody>
<tr>
<td>Event</td>
<td>Expo in Città (19.91%), Teatri per Milano (0.32%), Fiera Milano (0.25%), Fondazione Arnaldo Pomodoro (0.02%), Leonardo Ambrosiana (0.01%)</td>
<td>Events (68.02%), Eventful (5.64%), Lastfm (1.78%); Evensi (4.24%)</td>
<td></td>
</tr>
<tr>
<td>Place</td>
<td>Dati Comune Milano* (2.18%), BikeMI (0.01%), Vaxita (0.29%), Expo in Città (0.24%), Fondazione Arnaldo Pomodoro (0.01%), Isnart (0.03%), Teatri per Milano (0.01%)</td>
<td>Yelp (32.17%), Google Places (30.69%), Facebook (19.58%), Foursquare (14.24%), Expedia (0.13%), Evensi (0.06%), Eventful (0.01%); 3cixty (0.16%)</td>
<td></td>
</tr>
<tr>
<td>Transport</td>
<td>Dati Comune Milano* (32.48%), Vaxita (7.05%), BikeMI (0.29%), Isnart (0.29%)</td>
<td>Foursquare (11.42%), Facebook (15.01%), Yelp (3.11%), Expedia (3.02%), Google Places (0.65%)</td>
<td></td>
</tr>
<tr>
<td>Media</td>
<td>Expo in Città (3.4%), Vaxita (0.68%), Teatri per Milano (0.06%), Fondazione Arnaldo Pomodoro (0.01%), Leonardo Ambrosiana (0.01%)</td>
<td>Facebook (39.73%), Foursquare (24.09%), Evensi (13.51%), Google Places (12.77%), Yelp (11.42%), Lastfm (1.2%); Expedia (0.53%), Flickr (0.33%), Eventful (0.25%); 3cixty (1.09%)</td>
<td></td>
</tr>
<tr>
<td>Review</td>
<td>Foursquare (64.19%), Google Places (29.32%)</td>
<td>Yelp (10.93%)</td>
<td></td>
</tr>
</tbody>
</table>
Table 1: Breakdown figures per entity and data source type. The percentage indicates the contribution of the data source with respect to the total amount of unique entities (after entity reconciliation and resolution) per type in the 3cixty KB as of September 7th, 2015 (* is part of the public data offered by the Milan municipality)
Data Modeling. Our ontology design principle has focused on optimizing the coverage of the terminology in the context of city exploration. For each entity to model, we looked for existing ontologies by keyword searching in the LOV, Swoogle, Watson, and Smart City catalogues. We selected terms based on popularity measured through linked data usage and favoring schema.org when suitable. Two domain experts analyzed the ontologies that resulted from the search, and once consensus was reached, ontologies were taken and added to the 3cixty data model, which, therefore, consists of a network of existing ontologies. We have finally modeled a few additional properties published at http://3cixty.eurecom.fr/ontology. The documentation of the 3cixty data model with examples is available at http://3cixty.eurecom.fr/documentation.
Geographic Grid Data Sampling. The data fetching process uses, depending on the data source, a real-time and/or a batch procedure. The starting point is a grid covering a geographical area. In the case of the city of Milan, we re-used the Milan grid proposed in the 2014 BigData Challenge and composed of 10,000 squared cells of 235x235 meters with a focal point in the center of the city. All objects in the 3cixty KB are either described by WGS84 points (e.g. places) or are related to other objects described as points (e.g. events that happen in places). In addition, every object belongs to a cell of the grid which enables us to optimize both the reconciliation process and the query evaluation time when computing travel distance queries such as listing all restaurants that are within 10 minutes walk from a particular hotel. E015 data is fetched through a proxy server that provides a uniform mechanism to access sources implemented using heterogeneous technologies. Dedicated collectors have been developed for each social media platform using their respective APIs. OpenRefine is used for transforming data manually entered in tabular format. For any data source, descriptions of the real world objects instantiate the 3cixty model while keeping an attribution using the dc:publisher property. We generate timestamped dumps for each data source that are serialized in the Turtle syntax and updated weekly. To minimize the cost of the collection process, we only harvest the delta composed of the new instances available from each source. For handling real-time data (e.g. live positioning of the bus and metro, rooms availability in hotels), we will rely on publish-subscribe mechanism implemented in the general purpose complex event processing engine T-Rex. We use a set of SPARQL construct queries to materialize frequent computations such as planned time-travel distances among places and events. Each dump is then loaded in a dedicated named graph for easing data management. Our triple store is the Virtuoso open source version.
Data Reconciliation. The different data sources overlap in terms of instances (e.g. the same hotel exists in multiple data sources). This concerns at least 0.67% of Events and 26.24% of Places. On two uniform randomly sampled datasets of 100 places and 100 events, the algorithm has an accuracy of 90.24% for places and 99.6% for events. We perform pairwise reconciliation of the data sources,
11 https://dandelion.eu/datamine/open-big-data
12 http://openrefine.org
3cixty@Expo Milano 2015
included self-reconciliation which is frequent within social media source using SILK. For the entity resolution, we adopt a conservative approach where we add only one element when multiple sameAs links were identified by the reconciliation procedure. Such sets are thus obtained as the distinct union of the outputs of the reconciliation process with all instances that do not hold any sameAs link. They are loaded in separate graphs, namely events and places graphs of reconciled entities, which are used by ExplorMI 360.
Both places and events are categorized according to the schema used by the data source providers\textsuperscript{13} and the mapping established with two pivots schemes used to enable the parallel exploration of the data: the Foursquare taxonomy\textsuperscript{14} that organizes places into a three-level hierarchy, and another taxonomy for events described in \cite{4}. The category alignment has been supervised by two domain experts, using both the category label and description as well as the set of instances that belong to those categories. The result is represented using skos:closeMatch and skos:broadMatch axioms.
2.2 Knowledge Base Exploration and Usage
The 3cixty KB can be visualized through the ExplorMI 360 multi-device application or accessed via SPARQL and a dedicated API.
ExplorMI 360. ExplorMI 360 is intended to offer a 360° view of the city in different stages of the visit: a web application for preparing a visit to Milan and a mobile one as a digital companion guide for visitors. The web application implements a Parallel Exploration paradigm which extends Parallel Faceted Browsing\textsuperscript{2} by enabling the display of multiple interrelated queries and their results on the screen at the same time. It also allows users to filter places or events in some novel ways such as (a) specifying a word or phrase that must appear somewhere in the texts associated with the item; (b) manually selecting items from a result list; or (c) specifying that a place or event must be within a certain distance of a specified location. It also allows pivoting using relationships among entities, such as discovering all hotels that are located within a certain distance of at least one park. These advanced features help to exploit fully the power of the 3cixty KB by enabling users to deal with multiple types of entities and multiple result lists at the same time. But this power is associated with a richness and complexity of the user interface that can be daunting initially to new users. For this reason, we have developed features that make it easier for new users to become accustomed gradually to the power of Parallel Exploration:
(a) Zoom View: the unconventional inverted tree presentation of result lists on the screen is replaced with a more familiar set of result lists arranged in parallel columns; (b) Quick Start Apps enable users to create trees of interrelated queries simply by clicking on natural language questions within a menu. For example, if the user clicks on the question “What sorts of concerts are taking place during
\textsuperscript{13}For example, Google Places use the set of categories described at \url{https://developers.google.com/places/supported_types}
\textsuperscript{14}https://developer.foursquare.com/categorytree
the coming week and on the weekend? The same tree of results is created and shown as if the user had constructed it step by step himself. The tree is typically accompanied by several tooltips that explain to the user how he can explore the tree of results and also how he can change the details of the queries to obtain results that are more relevant to him (e.g., replacing “500 meters” by “200 meters”). Quick Start Apps are technically simple since they just associate a set of questions with a set of bookmarks that correspond to their answers. Hence it is possible even for non-technical users to create Quick Start Apps using a point-and-click interface. Finally, the web application includes a developer mode within which a developer can view the SPARQL queries generated by the user interface, so as to be able to reuse these queries (or variants of them) in other contexts.
The mobile application is available for Android and iOS. It guides users visiting and exploring the city by showing relevant and nearby information about events, points of interest, and transportation. Users can synchronize and modify their wishlist created beforehand in the web application, visualizing details about events and places and directions for reaching them. They can also receive notification alerts while walking around the city and getting closed to favorite items. The mobility profile feature allows users to authorize the application to track their movements and to generate a heatmap of their movements, suggesting them to discover new areas they have not yet visited. They can explore and discover new events and places, and add them into their wishlist. Visitors can also benefit from the Thematic Tours feature that helps plan visits at Expo Milano 2015 and optimises time. For example, by selecting a list of tags (art and craft, music and show, family) and the time available (e.g. night, day) users can get a list of suggested pavilions to visit or events to attend, taking into account the walking time between places and the average visit duration. The first user tests at the Expo indicate that the digital guide powered by the 3cixty KB offers a valuable and unique way to plan a visit and explore a city.
**SPARQL and API: a Developers’ Data Marketplace.** 3cixty offers new opportunities to developers to build apps that can either access a SPARQL endpoint of use a dedicated API. The main differences are: cache support (API), personal data (API) versus freedom and expressivity in querying (SPARQL). The API offers automatic integration of public and personal data for an enhanced and personalized user experience. Some of these experiences are related to the social aspects, namely: augmentation/re-ranking of results based on items selected in the wishlist of friends, and augmentation/re-ranking of results based on items reviewed by users who are friends. Since the API provides user-personalized results, it is secured and can only be accessed via API key and/or user access token.
**Acknowledgments** This work was supported primarily by the innovation activity 3cixty (14523) of EIT Digital [https://www.eitdigital.eu](https://www.eitdigital.eu).
References
A Evaluation Requirements
<table>
<thead>
<tr>
<th>The application has to be an end-user application:</th>
</tr>
</thead>
<tbody>
<tr>
<td>The 3cixty platform enables to develop end-user applications on top of a high quality data marketplace. ExplorMI360 is a multi-device application composed of a web site that enables city visitors to plan a trip by exploring and bookmarking what a city will offer at particular time and a mobile companion that guides the visitors showing what is nearby and alerting about all the items previously saved in a wishlist.</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>The information sources used:</th>
</tr>
</thead>
<tbody>
<tr>
<td>The 3cixty KB is built using three types of data sources: the data services of the local providers participating to the E015 digital ecosystem, web content shared on social media platforms, and data about the Expo 2015 exhibit itself contributed by an editorial team which further improves the precision and coverage of places and events that are taking place. Data comes under diverse ownership and formal agreements have been signed with the providers of E015 digital ecosystem to access and reuse their information. Data is very heterogeneous, with different structure and semantics, but the usage of common ontologies and graph-based RDF descriptions has largely eased the data integration process as well as the deduplication of the entities that are common across sources. Data describes real world objects sampled from real world volume in the domain of culture and tourism: places including sights and businesses, events and performers, transportation and user-generated content such as illustrative media and reviews.</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Attractive and functional Web interface:</th>
</tr>
</thead>
<tbody>
<tr>
<td>The web-based and mobile components of ExplorMI 360 provide two paradigms of interactions: Parallel Exploration enables to search and browse in a tree-style navigation in desktops and tablets devices; A mobile digital guide enables a geolocalized user to discover nearby places and events or to get notified about wishlisted items.</td>
</tr>
</tbody>
</table>
The meaning of data has to play a central role:
The overall design of the 3cixty KB has followed a data-centric approach: entities are described with common properties and are related to each other with relationships. This allows the user to generate complex queries mixing time, distance and social dimensions such as “What are the 4 stars hotels, well-reviewed by my friends, located within a few minutes by metro from this concert given at La Scala?”.
The TBox makes use of well-known ontologies. The ABox contains descriptions of numerous entities that are relevant in the domain of culture and tourism. All together, data analytics processes can be used to derive new insights about the city, such as generating urban summaries based on the concentration of businesses in various areas and the social activity, or better classifying businesses into fine-grained categories based on aggregated user-generated review content. The use of semantic technologies greatly simplifies all data integration steps, including the curation and the ingestion of new instances, and the discovery of duplicates which is fundamental given that we are integrating 20 data sources. It also enables the development of flexible visualization widgets, offering a standard mechanism for user interfaces to pull the data. We also offer personalization services using user profile data. User profile data is composed of basic user information, friend list and a mobility profile tracking the user movements. User-generated reviews aggregated over multiple sources for the places combined with one’s friend list enables to rank higher the places favored by one’s friends, thus offering a social ranking in which the user presumably trusts better. Friends wishlists can finally be used to alert a user when he is nearing a particular place in the city.
Scalable application:
As of September 7th, 2015, the 3cixty KB contains around 10 million triples solely for the city of Milan. We are extending the 3cixty KB coverage to bigger geographic areas such as London and Nice. To offer a smooth user experience (a) some metadata, which are heavy to be computed on-the-fly such as travel distances, are materialized; (b) the API offers a caching mechanism and optimized queries.
Rigorous evaluations:
(a) Rigorous approach to data modeling: a team of two experts defined a list of inclusion/exclusion criteria and designed the TBox. (b) The data reconciliation, inspired by an already well-performing and published work [4], has been extended and the results have been statistically evaluated. (c) The user interfaces, which include some highly innovative elements, have been subjected to numerous phases of iterative evaluation.
Novelty:
Variety: events, places, transportation and user generated content are integrated using semantic technologies. Veracity: using local data sources, we optimized precision. Volume: 20 data sources totaling 10M triples. Exploration: The Parallel Exploration user interface represents a novel and powerful way of exploring semantic data, for both end-users and developers.
Functionality:
The 3cixty KB enables: (a) efficient semantic search, via facets, for data visualization and multilingual full text search on all labels. (b) geographic search, using a grid-based approach for indexing instances, thus optimizing the evaluation times when computing travel distance queries.
Contextual Information:
(a) The data reconciliation exploits contextual information about the type of content offered from the previously listed data sources. (b) The instances have a top:importance property that indicates, with a range from 0 to 5 (Likert scale), their quality/importance. (c) The user interfaces exploit this to perform dynamic ranking in the visualization layer.
Multimedia documents are used in some way:
Images (and videos) are described and used to illustrate the two main entity types: event and place.
Use of dynamic data:
We crawl and reconcile near- and real-time data such as availability of hotel rooms.
Accurate results:
From the experimental settings, the results are encouraging both in terms of figures (quantitative analysis) and in terms of user experience (qualitative analysis) as indicated in the technical description.
Support for multiple languages and accessibility on a range of devices:
Textual metadata are offered in two languages (English and Italian) in the 3cixty KB. In addition, the web-based component is specifically designed to work well with Google Translate, in that texts that are part of the user interface (e.g. items listed in menus) are formulated in a relatively verbose way (e.g. “events that have the category Musical Concert”) that tends to yield good automatic translations (as well as increased clarity for new users).
|
{"Source-Url": "https://hal.archives-ouvertes.fr/hal-01277195/file/SWC2015_submission_3.pdf", "len_cl100k_base": 5811, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 22758, "total-output-tokens": 6637, "length": "2e12", "weborganizer": {"__label__adult": 0.00228118896484375, "__label__art_design": 0.00763702392578125, "__label__crime_law": 0.001678466796875, "__label__education_jobs": 0.0029125213623046875, "__label__entertainment": 0.0019426345825195312, "__label__fashion_beauty": 0.0009140968322753906, "__label__finance_business": 0.004726409912109375, "__label__food_dining": 0.0033473968505859375, "__label__games": 0.00543975830078125, "__label__hardware": 0.004207611083984375, "__label__health": 0.00140380859375, "__label__history": 0.01195526123046875, "__label__home_hobbies": 0.0004968643188476562, "__label__industrial": 0.0015354156494140625, "__label__literature": 0.00201416015625, "__label__politics": 0.0020542144775390625, "__label__religion": 0.0012788772583007812, "__label__science_tech": 0.15283203125, "__label__social_life": 0.0011320114135742188, "__label__software": 0.24951171875, "__label__software_dev": 0.395751953125, "__label__sports_fitness": 0.0013265609741210938, "__label__transportation": 0.035186767578125, "__label__travel": 0.1083984375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27516, 0.03694]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27516, 0.09367]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27516, 0.89951]], "google_gemma-3-12b-it_contains_pii": [[0, 440, false], [440, 2754, null], [2754, 6062, null], [6062, 9496, null], [9496, 12840, null], [12840, 16178, null], [16178, 19351, null], [19351, 22726, null], [22726, 27516, null]], "google_gemma-3-12b-it_is_public_document": [[0, 440, true], [440, 2754, null], [2754, 6062, null], [6062, 9496, null], [9496, 12840, null], [12840, 16178, null], [16178, 19351, null], [19351, 22726, null], [22726, 27516, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27516, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27516, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27516, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27516, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27516, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27516, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27516, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27516, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27516, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27516, null]], "pdf_page_numbers": [[0, 440, 1], [440, 2754, 2], [2754, 6062, 3], [6062, 9496, 4], [9496, 12840, 5], [12840, 16178, 6], [16178, 19351, 7], [19351, 22726, 8], [22726, 27516, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27516, 0.17778]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
6e8daac57c2c30dc9ce68cfbd19ed4f44778e2fc
|
The design recipe
Readings:
- HtDP, sections 1-5
(ordering of topics is different in lectures, different examples will be used)
- Survival and Style Guides
Programs as communication
Every program is an act of communication:
- Between you and the computer
- Between you and yourself in the future
- Between you and others
Human-only comments in Racket programs: from a semicolon (;) to the end of the line.
Some goals for software design
Programs should be:
compatible, composable, correct, durable, efficient, extensible, flexible, maintainable, portable, readable, reliable, reusable, scalable, usable, and useful.
The design recipe
• Use it for every function you write in CS 135.
• A development process that leaves behind written explanation of the development
• Results in a trusted (tested) function which future readers (you or others) can understand
The five design recipe components
**Purpose:** Describes what the function is to compute.
**Contract:** Describes what type of arguments the function consumes and what type of value it produces.
**Examples:** Illustrating the typical use of the function.
**Definition:** The Racket definition (header and body) of the function.
**Tests:** A representative set of function arguments and expected function values.
Order of Execution
The order in which you carry out the steps of the design recipe is very important. Use the following order:
- Write a draft of the Purpose
- Write Examples (by hand, then code)
- Write Definition Header & Contract
- Finalize the purpose with parameter names
- Write Definition Body
- Write Tests
Using the design recipe
We’ll write a function which squares two numbers and sums the results.
Purpose:
;; (sum-of-squares p1 p2) produces the sum of
;; the squares of p1 and p2
Contract:
;; sum-of-squares: Num Num → Num
Mathematically: sum-of-squares: $\mathbb{R} \times \mathbb{R} \rightarrow \mathbb{R}$
;; Examples:
(check-expect (sum-of-squares 3 4) 25)
(check-expect (sum-of-squares 0 2.5) 6.25)
Header & Body:
(define (sum-of-squares p1 p2)
(+ (* p1 p1) (* p2 p2)))
;; Tests:
(check-expect (sum-of-squares 0 0) 0)
(check-expect (sum-of-squares −2 7) 53)
Contracts
- We will be more careful than HtDP and use abbreviations.
- **Num**: any Racket numeric value
- **Int**: restriction to integers
- **Nat**: restriction to natural numbers (including 0)
- **Any**: any Racket value
- We will see more types soon.
Tests
- Tests should be written later than the code body.
- Tests can then handle complexities encountered while writing the body.
- Tests don’t need to be “big”.
In fact, they should be small and directed.
- The number of tests and examples needed is a matter of judgement.
- **Do not** figure out the expected answers to your tests by running your program! Always work them out **by hand**.
The teaching languages offer a convenient testing method.
(check-expect (sum-of-squares 3 4) 25)
(check-within (sqrt 2) 1.414 .001)
(check-error (/ 1 0) "/: division by zero")
Tests written using these functions are saved and evaluated at the very end of your program.
This means that examples can be written as code.
(sum-of-squares p1 p2) produces the sum of
the squares of p1 and p2
(sum-of-squares: Num Num → Num
Examples:
(check-expect (sum-of-squares 3 4) 25)
(check-expect (sum-of-squares 0 2.5) 6.25)
(define (sum-of-squares p1 p2)
(+ (* p1 p1) (* p2 p2)))
Tests:
(check-expect (sum-of-squares 0 0) 0)
(check-expect (sum-of-squares -2 7) 53)
Additional contract requirements
If there are important constraints on the parameters that are not fully described in the contract, add an additional `requires` section to “extend” the contract.
```plaintext
;; (my-function a b c) ...
;; my-function: Num Num Num → Num
;; requires: 0 < a < b
;; c must be non-zero
```
Design recipe style guide
Note that in these slides, sections of the design recipe are often omitted or condensed because of space considerations.
Consult the course style guide before completing your assignments.
Boolean-valued functions
A function which tests whether two numbers $x$ and $y$ are equal has two possible Boolean values: true and false.
Racket provides many built-in Boolean functions (for example, to do comparisons).
An example application: $(= x y)$.
This is equivalent to determining whether the mathematical proposition “$x = y$” is true or false.
Standard Racket uses #t and #f; these will sometimes show up in basic tests and correctness tests.
Other types of comparisons
In order to determine whether the proposition “$x < y$” is true or false, we can evaluate ($<$ $x$ $y$).
There are also functions for $>$, $\leq$ (written $\leq$) and $\geq$ (written $\geq$).
Comparisons are functions which consume two numbers and produce a Boolean value. A sample contract:
```
;; = : Num Num → Bool
```
Note that Boolean is abbreviated in contracts.
Complex relationships
You may have learned in Math 135 how propositions can be combined using the connectives AND, OR, NOT.
Racket provides the corresponding and, or, not.
These are used to test complex relationships.
Example: the proposition “$3 \leq x < 7$”, which is the same as “$x \in [3, 7)$”, can be computationally tested by evaluating
(\text{and} (\leq 3 \ x) (\ < \ x \ 7)).
Some computational differences
The mathematical AND, OR connect two propositions.
The Racket and, or may have more than two arguments.
The special form and has value true exactly when all of its arguments have value true.
The special form or has value true exactly when at least one of its arguments has value true.
The function not has value true exactly when its one argument has value false.
DrRacket only evaluates as many arguments of `and` and `or` as is necessary to determine the value.
Examples:
\[
\text{(and (not (\(= x 0\))) (\(\leq (\div y x) c\)))}
\]
\[
\text{(or (\(= x 0\)) (\(> (\div y x) c\)))}
\]
These will never divide by zero.
Predicates
A *predicate* is a function that produces a Boolean result.
Racket provides a number of built-in predicates, such as `even?`, `negative?`, and `zero?`.
We can write our own:
```
(define (between? low high numb)
(and (< low numb) (< numb high)))
```
```
(define (can-drink? age)
(>= age 19))
```
Symbolic data
Racket allows one to define and use symbols with meaning to us (not to Racket).
A symbol is defined using an apostrophe or ‘quote’: ‘blue
The symbol ‘blue is a value just like 6, but it is more limited computationally.
It allows a programmer to avoid using numbers to represent names of colours, or of planets, or of types of music.
Symbols can be compared using the function `symbol=?`.
```
(define my-symbol 'blue)
(symbol=? my-symbol 'red) ⇒ false
```
`symbol=?` is the only function we’ll use in CS135 that is applied only to symbols.
Other types of data
Racket also supports strings, such as "blue".
What are the differences between strings and symbols?
- Strings are really compound data
(a string is a sequence of characters).
- Symbols can’t have certain characters in them
(such as spaces).
- More efficient to compare two symbols than two strings
- More built-in functions for strings
Here are a few functions which operate on strings.
\[
\text{(string-append "alpha" "bet") } \Rightarrow \text{ "alphabet"}
\]
\[
\text{(string-length "perpetual") } \Rightarrow 9
\]
\[
\text{(string<? "alpha" "bet") } \Rightarrow \text{ true}
\]
The textbook does not use strings; it uses symbols.
We will be using both strings and symbols, as appropriate.
Consider the use of symbols when a small, fixed number of labels are needed (e.g. colours) and comparing labels for equality is all that is needed.
Use strings when the set of values is more indeterminate, or when more computation is needed (e.g. comparison in alphabetical order).
When these types appear in contracts, they should be capitalized and abbreviated: Sym and Str.
General equality testing
Every type seen so far has an equality predicate (e.g, \( = \) for numbers, \texttt{symbol=}? for symbols).
The predicate \texttt{equal?} can be used to test the equality of two values which may or may not be of the same type.
\texttt{equal?} works for all types of data we have encountered so far (except inexact numbers), and most types we will encounter in the future.
Do not overuse \texttt{equal?}, however.
If you know that your code will be comparing two numbers, use $=$ instead of `equal?`.
Similarly, use `symbol=?` if you know you will be comparing two symbols.
This gives additional information to the reader, and helps catch errors (if, for example, something you thought was a symbol turns out not to be one).
Conditional expressions
Sometimes, expressions should take one value under some conditions, and other values under other conditions.
Example: taking the absolute value of $x$.
$$|x| = \begin{cases}
-x & \text{when } x < 0 \\
x & \text{when } x \geq 0
\end{cases}$$
- Conditional expressions use the special form `cond`.
- Each argument is a question/answer pair.
- The question is a Boolean expression.
- The answer is a possible value of the conditional expression.
In Racket, we can compute $|x|$ with the expression
```
(cond
[(< x 0) (− x)]
[(>= x 0) x])
```
- square brackets used by convention, for readability
- square brackets and parentheses are equivalent in the teaching languages (must be nested properly)
- `abs` is a built-in function in Racket
The general form of a conditional expression is
\[
(\text{cond}
\begin{array}{ll}
\text{question1} & \text{answer1} \\
\text{question2} & \text{answer2} \\
\vdots \\
\text{questionk} & \text{answerk}
\end{array}
)
\]
where questionk could be else.
The questions are evaluated in order; as soon as one evaluates to true, the corresponding answer is evaluated and becomes the value of the whole expression.
• The questions are evaluated in top-to-bottom order
• As soon as one question is found that evaluates to true, no further questions are evaluated.
• Only one answer is ever evaluated.
(the one associated with the first question that evaluates to true, or associated with the else if that is present and reached)
\[ f(x) = \begin{cases} 0 & \text{when } x = 0 \\ x \sin(1/x) & \text{when } x \neq 0 \end{cases} \]
\begin{verbatim}
(define (f x)
(cond [(= x 0) 0]
[else (* x (sin (/ 1 x)))]))
\end{verbatim}
Simplifying conditional functions
Sometimes a question can be simplified by knowing that if it is asked, all previous questions have evaluated to false.
Suppose our analysis identifies three intervals:
- students who fail CS 135 must take CS 115 (this isn’t true).
- students who pass but get less than 60% go into CS 116.
- students who pass and get at least 60% go into CS 136.
We might write the tests for the three intervals this way:
```scheme
(define (course-after-cs135 grade)
(cond [(< grade 50) 'cs115]
[(and (>= grade 50) (< grade 60)) 'cs116]
[(>= grade 60) 'cs136]))
```
We can simplify the second and third tests.
(define (course-after-cs135 grade)
(cond [(< grade 50) ’cs115]
[(< grade 60) ’cs116]
[else ’cs136]))
These simplifications become second nature with practice.
Tests for conditional expressions
- Write at least one test for each possible answer in the expression.
- That test should be simple and direct, aimed at testing that answer.
- Often tests are appropriate at boundary points as well.
- DrRacket highlights unused code.
For the example above:
```
(cond [(< grade 50) ’cs115]
[(< grade 60) ’cs116]
[else ’cs136]])
```
there are three intervals and two boundary points, so five tests are required (for instance, 40, 50, 55, 60, 70).
Testing **and** and **or** expressions is similar.
For \((\text{and } (\text{not } (\text{zero? } x)) \ (\leq (\text{/ } y \ x) \ c))\), we need:
- one test case where \(x\) is zero
(first argument to **and** is **false**)
- one test case where \(x\) is nonzero and \(y/x > c\),
(first argument is **true** but second argument is **false**)
- one test case where \(x\) is nonzero and \(y/x \leq c\).
(both arguments are **true**)
```
Some of your tests, including your examples, will have been defined before the body of the function was written.
These are known as **black-box tests**, because they are not based on details of the code.
Other tests may depend on the code, for example, to check specific answers in conditional expressions.
These are known as **white-box tests**. Both types of tests are important.
Writing Boolean tests
The textbook writes tests in this fashion:
\[(\equiv \,(\text{sum-of-squares} \ 3 \ 4) \ 25)\]
which works outside the teaching languages.
\textbf{check-expect} was added to the teaching languages after the textbook was written. You should use it for all tests.
Example: computing taxes
Canada has a **progressive** tax system: the rate of tax increases with income. For 2014, the rates are:
- no tax payable on negative income
- 15% on the amount from $0 to $43,953
- 22% on the amount from $43,953 to $87,907
- 26% on the amount from $87,907 to $136,270
- 29% on the amount from $136,270 and up
The “piecewise linear” nature of the graph complicates the computation of tax payable.
One way to do it uses the **breakpoints** ($x$-value or salary when the rate changes) and **base amounts** ($y$-value or tax payable at breakpoints).
This is what the paper Canadian tax form does.
;; breakpoints
(define bp1 43953)
(define bp2 87907)
(define bp3 136270)
;; rates
(define rate1 0.15)
(define rate2 0.22)
(define rate3 0.26)
(define rate4 0.29)
Instead of putting the base amounts into the program as numbers (as the tax form does), we can compute them from the breakpoints and rates.
;; basei is the base amount for interval [bpi,bp(i+1)]
;; that is, tax payable at income bpi
(define base1 (* bp1 rate1))
(define base2 (+ base1 (* (- bp2 bp1) rate2)))
(define base3 (+ base2 (* (- bp3 bp2) rate3)))
(define (tax-payable-income)
(cond [(< income 0) 0]
[(< income bp1) (* income rate1)]
[(< income bp2) (+ base1 (* (- income bp1) rate2))]
[(< income bp3) (+ base2 (* (- income bp2) rate3))]
[else (+ base3 (* (- income bp3) rate4))])))
Helper functions
There are many similar calculations in the tax program, leading to the definition of the following helper function:
(define (tax-calc base low high rate)
(+ base (* (− high low) rate)))
This can be used both in the definition of constants and in the main function.
(define base1 (tax-calc 0 0 bp1 rate1))
(define base2 (tax-calc base1 bp1 bp2 rate2))
(define base3 (tax-calc base2 bp2 bp3 rate3))
(define (tax-payable income)
(cond [(< income 0) 0]
[(< income bp1) (tax-calc 0 0 income rate1)]
[(< income bp2) (tax-calc base1 bp1 income rate2)]
[(< income bp3) (tax-calc base2 bp2 income rate3)]
[else (tax-calc base3 bp3 income rate4)]))
Good example: movie theatre (section 3.1 of HtDP).
Helper functions generalize similar expressions.
They avoid long, unreadable function definitions.
Use judgement: don’t go overboard, but sometimes very short definitions improve readability.
Helper functions must also follow the design recipe
Give all functions (including helpers) meaningful names, not “helper”
Goals of this module
You should understand the reasons for each of the components of the design recipe and the particular way that they are expressed.
You should start to use the design recipe and appropriate coding style for all Racket programs you write.
You should understand Boolean data, and be able to perform and combine comparisons to test complex conditions on numbers.
You should understand the syntax and use of a conditional expression.
You should understand how to write `check-expect` examples and tests, and use them in your assignment submissions.
You should be aware of other types of data (symbols and strings), which will be used in future lectures.
You should look for opportunities to use helper functions to structure your programs, and gradually learn when and where they are appropriate.
|
{"Source-Url": "https://www.student.cs.uwaterloo.ca/~cs135/handouts/02-design-post.pdf", "len_cl100k_base": 4188, "olmocr-version": "0.1.49", "pdf-total-pages": 52, "total-fallback-pages": 0, "total-input-tokens": 70769, "total-output-tokens": 6330, "length": "2e12", "weborganizer": {"__label__adult": 0.0004870891571044922, "__label__art_design": 0.0009360313415527344, "__label__crime_law": 0.00040030479431152344, "__label__education_jobs": 0.0291290283203125, "__label__entertainment": 0.00012433528900146484, "__label__fashion_beauty": 0.0002512931823730469, "__label__finance_business": 0.0005307197570800781, "__label__food_dining": 0.0006594657897949219, "__label__games": 0.00118255615234375, "__label__hardware": 0.0008664131164550781, "__label__health": 0.0004296302795410156, "__label__history": 0.00033736228942871094, "__label__home_hobbies": 0.00019752979278564453, "__label__industrial": 0.0005707740783691406, "__label__literature": 0.0005016326904296875, "__label__politics": 0.0003325939178466797, "__label__religion": 0.0007033348083496094, "__label__science_tech": 0.01020050048828125, "__label__social_life": 0.000217437744140625, "__label__software": 0.0083465576171875, "__label__software_dev": 0.9423828125, "__label__sports_fitness": 0.0005097389221191406, "__label__transportation": 0.0006837844848632812, "__label__travel": 0.0002586841583251953}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 16132, 0.0283]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 16132, 0.87446]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 16132, 0.85973]], "google_gemma-3-12b-it_contains_pii": [[0, 161, false], [161, 414, null], [414, 626, null], [626, 871, null], [871, 1288, null], [1288, 1605, null], [1605, 1918, null], [1918, 2177, null], [2177, 2433, null], [2433, 2829, null], [2829, 3150, null], [3150, 3489, null], [3489, 3812, null], [3812, 4028, null], [4028, 4487, null], [4487, 4888, null], [4888, 5278, null], [5278, 5678, null], [5678, 5936, null], [5936, 6251, null], [6251, 6602, null], [6602, 6813, null], [6813, 7176, null], [7176, 7536, null], [7536, 7915, null], [7915, 8357, null], [8357, 8670, null], [8670, 9143, null], [9143, 9445, null], [9445, 9873, null], [9873, 10190, null], [10190, 10395, null], [10395, 10778, null], [10778, 11000, null], [11000, 11223, null], [11223, 11495, null], [11495, 11718, null], [11718, 12163, null], [12163, 12548, null], [12548, 12836, null], [12836, 13173, null], [13173, 13173, null], [13173, 13459, null], [13459, 13459, null], [13459, 13622, null], [13622, 13980, null], [13980, 14249, null], [14249, 14536, null], [14536, 14945, null], [14945, 15315, null], [15315, 15768, null], [15768, 16132, null]], "google_gemma-3-12b-it_is_public_document": [[0, 161, true], [161, 414, null], [414, 626, null], [626, 871, null], [871, 1288, null], [1288, 1605, null], [1605, 1918, null], [1918, 2177, null], [2177, 2433, null], [2433, 2829, null], [2829, 3150, null], [3150, 3489, null], [3489, 3812, null], [3812, 4028, null], [4028, 4487, null], [4487, 4888, null], [4888, 5278, null], [5278, 5678, null], [5678, 5936, null], [5936, 6251, null], [6251, 6602, null], [6602, 6813, null], [6813, 7176, null], [7176, 7536, null], [7536, 7915, null], [7915, 8357, null], [8357, 8670, null], [8670, 9143, null], [9143, 9445, null], [9445, 9873, null], [9873, 10190, null], [10190, 10395, null], [10395, 10778, null], [10778, 11000, null], [11000, 11223, null], [11223, 11495, null], [11495, 11718, null], [11718, 12163, null], [12163, 12548, null], [12548, 12836, null], [12836, 13173, null], [13173, 13173, null], [13173, 13459, null], [13459, 13459, null], [13459, 13622, null], [13622, 13980, null], [13980, 14249, null], [14249, 14536, null], [14536, 14945, null], [14945, 15315, null], [15315, 15768, null], [15768, 16132, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 16132, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 16132, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 16132, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 16132, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 16132, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 16132, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 16132, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 16132, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 16132, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 16132, null]], "pdf_page_numbers": [[0, 161, 1], [161, 414, 2], [414, 626, 3], [626, 871, 4], [871, 1288, 5], [1288, 1605, 6], [1605, 1918, 7], [1918, 2177, 8], [2177, 2433, 9], [2433, 2829, 10], [2829, 3150, 11], [3150, 3489, 12], [3489, 3812, 13], [3812, 4028, 14], [4028, 4487, 15], [4487, 4888, 16], [4888, 5278, 17], [5278, 5678, 18], [5678, 5936, 19], [5936, 6251, 20], [6251, 6602, 21], [6602, 6813, 22], [6813, 7176, 23], [7176, 7536, 24], [7536, 7915, 25], [7915, 8357, 26], [8357, 8670, 27], [8670, 9143, 28], [9143, 9445, 29], [9445, 9873, 30], [9873, 10190, 31], [10190, 10395, 32], [10395, 10778, 33], [10778, 11000, 34], [11000, 11223, 35], [11223, 11495, 36], [11495, 11718, 37], [11718, 12163, 38], [12163, 12548, 39], [12548, 12836, 40], [12836, 13173, 41], [13173, 13173, 42], [13173, 13459, 43], [13459, 13459, 44], [13459, 13622, 45], [13622, 13980, 46], [13980, 14249, 47], [14249, 14536, 48], [14536, 14945, 49], [14945, 15315, 50], [15315, 15768, 51], [15768, 16132, 52]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 16132, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-27
|
2024-11-27
|
ac37bcd1eefbe5c6030f23c07da2434744bc3260
|
Software Economies
David F. Bacon\textsuperscript{1}, Eric Bokelberg\textsuperscript{1}, Yiling Chen\textsuperscript{1}, Ian A. Kash\textsuperscript{3}
David C. Parkes\textsuperscript{1}, Malvika Rao\textsuperscript{1}, Manu Sridharan\textsuperscript{1}
\textsuperscript{1}IBM T.J. Watson Research Center, Yorktown Heights, NY
\textsuperscript{2}IBM Global Business Services, Essex Junction, VT
\textsuperscript{3}School of Engineering and Applied Sciences, Harvard University, Cambridge, MA
\{dfb,ebokelb,msridhar\}@us.ibm.com
{yiling,kash,parkes,malvika}@eecs.harvard.edu
ABSTRACT
Software construction has typically drawn on engineering metaphors like building bridges or cathedrals, which emphasize architecture, specification, central planning, and determinism. Approaches to correctness have drawn on metaphors from mathematics, like formal proofs. However, these approaches have failed to scale to modern software systems, and the problem keeps getting worse.
We believe that the time has come to completely re-imagine the creation of complex software, drawing on systems in which behavior is decentralized, self-regulating, non-deterministic, and emergent—like economies.
In this paper we describe our vision for, and preliminary work on, the creation of software economies for both open systems and internal corporate development, and our plans to deploy these ideas within one of the largest developer communities at IBM.
Categories and Subject Descriptors
D.2.4 [Software/Program Verification]: Reliability; D.2.10 [Design]: Methodologies; J.4 [Social and Behavioral Sciences]: Economics; K.4.4 [Electronic Commerce]: Distributed commercial transactions; K.6.3 [Software Management]: Software development
General Terms
Design, Economics, Reliability, Verification
1. INTRODUCTION
Software construction has often been described using metaphors like building bridges or cathedrals, which emphasize architecture, specification, central planning, and determinism. These engineering-based metaphors have gone hand-in-hand with a notion that a specification has a “correct” implementation. This absolute notion of correctness provides the underpinnings of both pragmatic and theoretical approaches to reaching this ideal: via testing disciplines or code review for the former, and manual or automated proof techniques for the latter.
Despite significant progress in both engineering- and mathematics-based approaches to correctness, these techniques have failed to scale to large systems. This was already true in 1968 with the identification of the “software crisis” \cite{2}, and 40 years of exponential growth in computing has greatly exacerbated the problem. Furthermore, as systems have moved from a Turing machine “input tape to output tape” model of computation to one of continuous interaction with other large systems and with the physical world, the creation of a complete specification of potential behaviors is often impossible. Coming ultra-large-scale systems \cite{5} will likely present further correctness challenges.
In addition to quality issues, a major problem that bedevils the software industry is the creation of systems on time and on budget—going back to Brooks’ “mythical man-month” \cite{4}. In a traditional software organization with staffed resources, the labor market and the customer requirements are fairly fixed (developers are salaried, and requirements are often agreed upon in detail before development commences).
One extremely important aspect of making efficient use of developers and keeping costs low is to provide accurate budgeting. Note that inaccurate time and cost estimates are problematic whether they are too low or too high: if too low, the result is lost revenue and missed deadlines; if too high, the result is idle employees and contracts lost due to excessive pricing. For example, if work is overestimated by 10\% on average, an organization with 100,000 software professionals would have the equivalent of 10,000 people idle—more than the size of Adobe and Facebook combined.
Another critical component of cost control is to promote continual and accurate sharing of information about the skills of workers, the needs of different projects, and progress being made or difficulties encountered. By sharing such information, appropriate prioritization can be made in assigning the right workers to the right tasks.
1.1 Software Economies
We argue that the time has come to completely re-imagine the creation of complex software, drawing on metaphors like biology, economics, and others in which behavior is decentralized, self-regulating, non-deterministic, and emergent.
In this paper we describe our vision for, and preliminary work on, a software development process based around the creation of economies in which supply and demand for fine- or coarse-grained work products drive the allocation of work and the evolution of the system. The methods of game theory and mechanism design are used to create a self-regulating system that drives the development process towards a dynamic equilibrium that maximizes overall utility. Also, by eliciting dollar values for software properties like quality, time to market, and performance, a market system can en-
able quantitative evaluation of classic tradeoffs (e.g., quality vs. time to market) and provide a useful basis for comparing different software metrics.
In our conceptualization of a public software economy, coalitions of users bid for features and fixes. Developers, testers, bug reporters, and analysts share in the rewards for responding to those bids. The traditional (unachievable) notion of absolute correctness is replaced by quantifiable notions of correctness demand (the sum of bids for bugs) and correctness potential (the sum of the available profit for fixing those bugs). The research problem then becomes one of game theory and mechanism design: creating a market in which the rewards constantly drive the system towards a correctness equilibrium in which all bugs or features for which there is enough value and low enough development cost are fixed or implemented [1].
In a private software economy, managers estimate the resources required for development tasks and partition those tasks among an essentially fixed set of developers. For these cases, we can also apply ideas from prediction markets, to drive project managers to more accurately estimate project costs and schedules. Participants in a prediction market can trade in contracts that payout contingent on observable outcomes (e.g., “$1 if the release date is before April 10, $0 otherwise.”) The trading price on such a contract can provide a useful estimate of the probability with which this event will occur [3, 13].
An internal market ecosystem can be created in which employees earn rewards based on the speed and quality of their work and the re-use and generation of reusable components, while project managers are rewarded for accurate prediction of work required for tasks. In addition, programmers can earn extra rewards when they collaborate or compete to perform excess work from other projects, thereby reducing idle time between assigned tasks.
IBM has implemented an outcomes-based model for quantifying the delivery performance of developers working within the CIO-led organization where IBM’s internal IT initiatives are supported. This model provides game-based incentives for meeting and exceeding delivery targets. We are working to extend and improve this system based around market economy principles. Our initial goal is to design a system with an equilibrium in which the market incentivizes developers to work efficiently and managers to give accurate predictions of development time.
2. NASCENT SOFTWARE ECONOMIES
There are already several partial software markets in place. These systems serve both as illustrations of how market principles can be applied to software systems and as early indicators that market-based systems are already arising organically. Here we briefly review a few such systems.
Vulnerability Markets. One of the earliest software markets to emerge was for the potentially most expensive bugs: security vulnerabilities. Several market-based vulnerability reporting systems have been introduced with the goal of incentivizing users to report bugs and vulnerabilities. The Mozilla Foundation offers a cash award of $500 to anyone who reports a valid, critical security bug [8]. Schechter [11] proposes to use a vulnerability market in which the reward for reporting a security bug grows over time—the current reward places a valuation on the assurance that the software is free of vulnerabilities. Ozment [9] has demonstrated that vulnerability markets are essentially auctions for bug reports (in particular, an open first-price ascending auction).
Freelance Marketplaces. Online freelance marketplaces are platforms that connect individuals, small-business owners, and even Fortune 500 companies with freelance technology specialists to satisfy their technological needs. The sites provide vivid details about workers’ histories and qualifications, and some even feature tools that let the businesses monitor the work they are paying for [6]. TopCoder uses programming competitions to build professional-grade software outsourced by clients [12]. The rewards for a competition can vary based on the difficulty of the task, and only the top two contestants receive awards. On Rent-a-Coder [10], coders place bids on projects posted by buyers, and buyers choose a suitable coder based on the bids and detailed coder profiles. Once the work is completed the buyers and sellers may rate each other, in contrast to TopCoder, where most of the reputation information is aggregated from directly measurable performance metrics.
App Stores. App stores also provide an interesting example of software economies. For example, one can view the iPhone as a “system” and the apps as system components. When viewed in this manner, the iTunes App Store [7] allows different developers to compete to produce a winning module for the system. The existence of an effective micropayment system (most apps are 99 cents) is a substantial enabler—some applications have aggregated a significant profit via micropayments from a large user base. The store has a rating and review system—popular apps may have hundreds of reviews, including comments from users about outstanding bugs and desired features. The system serves as an important form of disintermediation which connects users directly with the developers of their portions of the overall system.
3. PUBLIC SOFTWARE ECONOMIES
In this section we discuss the application of market mechanisms to increasing software correctness and functionality in “public software economies” (as described in detail in our previous work [1]). Public economies involve projects with a direct connection to a large user base and would typically be organized around a single large-scale piece of software. Our proposed system unifies many of the partial market-based mechanisms described in Section 2, incorporating bug reporters (as in vulnerability markets), feedback providers (as in the App Store) and developers and validators (as in freelance marketplaces). The system also aggregates user demand for fine-grained tasks such as fixing a particular bug. We believe these properties can provide the necessary scale to bring about a fundamental change in software development.
3.1 Market Function
The key distinguishing aspect of the market that we envision is that users can bid for a bug fix or feature. Both open-source systems like Mozilla Firefox and closed-source, single-supplier systems like Adobe Photoshop would be candidates, albeit with some differences in mechanism.
Bug bids may be solicited for program crashes, as an additional alternative to the already common “Report to [Vendor]” dialog.
ers (which may overlap with the user set), and a set of Kinds which are used to categorize jobs (e.g., correctness, feature, security, mac, etc.). A user may offer a reward for a particular job at some time. A worker able to perform a job has an associated cost, namely their time and materials and including the opportunity cost.
The function of this market incorporates both the aggregation of user bids (like bug voting systems) and multiple competing workers (like TopCoder). This exchange structure, with information and preferences (e.g., costs for different kinds of work, values for different kinds of fixes) on both sides, is designed to provide for a more efficient market place. Of course, there are challenges in enabling such a market to function; e.g., demand for jobs must be accurately aggregated, successful completion of a task must be identified, and so on.
However, we can already consider how the system’s performance can be characterized in some interesting quantitative ways. For a particular job, the demand is the sum of the individual user rewards bid for that job. For the complete software system, the market demand is the sum of the demand for all of the jobs.
The Kinds can be used to evaluate the nature of the demand. For instance, the sum of all bids for jobs of kind correctness is the correctness demand for the system. Note that a correctness demand of 0 does not imply that there are no bugs in the software – just that there are no bugs to which any users attach value for fixing. This could mean that the software is flawless, or it could mean that nobody cares about using it. Analogously, we can quantify the demand for security, new features, support for a particular platform, and so on.
Intuitively, the jobs that are “worth doing” for workers are those where the cost of performing the work is less than the expected reward. We define the potential value of a job as the net reward that can be obtained by the worker who can perform it for the lowest cost (or 0 if the reward is less than their cost). Ideally, whenever the potential value of a job is greater than 0, the market should drive the work to happen.
The market potential is the sum of the potential values of all jobs, and the correctness potential is the sum of the potential values of all rewards whose kind is correctness. In correctness equilibrium, the correctness potential of a system is zero and all bugs that are “worth fixing” have been fixed. There may still be plenty of latent bugs, or even significant correctness demand, but there are no longer any bugs that a worker can fix without losing money.
3.2 Market Principles
The open question of course is how to design a market that operates in the manner we have just described. There are four fundamental principles that we have identified for the market design:
- **Autonomy.** All of the actions necessary to bring jobs to completion should be driven by market forces; the process is never gated by an entity outside of the market.
- **Inclusiveness.** Everyone who provides information or performs work that leads to improvements should share in the rewards.
- **Transparency.** The system should be transparent with respect to both the flow of money in the market and the tasks performed by workers in the market.
- **Reliability.** The system should be immune to manipulation, robust against attack (e.g., via insertion of untrusted code), and prevent “shallow” work which would have to be re-done later.
For there to be a market, there has to be a source of funding. Most obviously, as we have described, users can directly bid with their own funds. However, other funding models are possible: for example, a portion of the sale price paid by the user could be placed in escrow, with the user able to allocate the funds as she sees fit.
In all of these cases, the proposed market is funded with real money, which can be earned by those contributing to the software. The only differences are the degree to which the money in the market is fungible to the bidders. In particular, the sale price escrow model is applicable to completely closed source systems – and allows users to “tunnel through” the organizational barriers that separate them from developers.
4. PRIVATE SOFTWARE ECONOMIES
Here we describe the potential benefits of market mechanisms in “private software economies,” in which the size and user base of the software is potentially smaller than in a public economy, but the number of software systems under development is much larger. In a private economy, market incentives have the potential to reduce costs, increase predictability, and provide insights on which processes and tools yield the greatest benefits in the development process.
Our main discussion is in regard to scoring systems, designed to incentivize desired behaviors at a fine-grained level (e.g., for each development task). But we also note that competition platforms can find a role in private economies, where otherwise idle developers can compete for some subset of tasks and additional compensation. A side benefit of this system is the information it yields on which developers are the top performers. A preliminary competition system named Liquid is already being piloted within IBM GBS.
4.1 Scoring Systems
A scoring system could directly reward faster task completion, greater use and development of reusable components, higher quality code, or more accurate predictions of the required resources for tasks, yielding better overall outcomes than the more coarse-grained evaluations typically employed today. Additionally, game theory can be used to identify potentially undesirable outcomes of a scoring system before it is put into use. Here, we describe some initial work on such a scoring system and show the benefits of bringing game theory to bear on the problem.
**Outcomes Model.** Our goal is to tune the outcomes-based incentive system currently applied to IBM’s internal IT initiatives. Within the project delivery environment, software professionals (developers) exercise tasks assigned by their project managers (leaders) to produce project deliverables. In the outcomes model, each completed assignment has an associated “Blue Sheet” that records the original cycle time and effort planned for the task (as established by the leader), the actual completion time and effort that it required, a self-assessment of the deliverable quality against specified standards, and the extent that reuse of pre-existing assets was leveraged to complete the deliverable. The Blue Sheet parameters are used as inputs to compute scores for both practitioners and leaders, and top scorers are recognized for their achievement.
**A Simplified Problem.** In trying to create a scoring rule for the outcomes model with provable properties, we will start by making some simplifications. Initially, the only inputs to our system are estimated and actual effort – the amount of work time that the
---
3We use the term “developer” for brevity: incentivized scoring applies equally well to software designers, testers, etc.
developer spends on the task. Cycle time, quality, and reuse are temporarily ignored. We note that studying a system with this simplification complements the more typical approach of focusing only on software quality. As an additional simplification, we focus on devising a scoring system that need only satisfy the following:
- Developers should be incentivized to finish tasks as quickly as possible.
- Leaders should be incentivized to predict the time required for tasks as accurately as possible.
We can initially formalize the problem as a two-player sequential game between the leader and the developer. The leader “plays” first by estimating the effort \( \hat{e} \) that some development task will take. The developer “plays” second by completing the task, which results in an actual amount of effort applied \( e \). We denote the scoring function for leaders as \( L(e, \hat{e}) \) and the scoring function for developers as \( D(e, \hat{e}) \) (a higher score is better).
The following scoring functions satisfy the desired properties for the case of a single task:
\[
D(e, \hat{e}) = 2\hat{e} - e \\
L(e, \hat{e}) = e - (\hat{e} - e)^2
\]
Independent of the leader’s strategy, it is always optimal for the developer to work as quickly as possible since this minimizes effort \( e \) and maximizes \( D(e, \hat{e}) \). Let \( e^* \) denote this optimal effort. The exact value of \( e^* \) is private to the developer, but the leader has information on how \( e^* \) is distributed. Given the optimal strategy of the developer, it is optimal for the leader to predict \( \hat{e} = \mathbb{E}[e^*] \) (where \( \mathbb{E}[\cdot] \) is expectation) based on her information, as this estimate minimizes \( \mathbb{E}(\hat{e} - e^*)^2 \) and thus maximizes the leader’s expected score. These strategies form a Nash equilibrium. Fixing the developer’s strategy, the leader cannot benefit by deviating from her own strategy. Furthermore, because the developer’s strategy strictly dominates all other strategies and the leader has a unique best-response, this is a unique Nash equilibrium.
Note the above analysis does not immediately hold when the game is repeated (where the developer and leader participate across multiple tasks). While the above strategies remain an equilibrium for the repeated game, care is needed to show that other undesirable equilibria don’t arise.
Open Challenges. Our simplified game captures a vastly simpler problem than real-world development. We hope to extend the game to capture the following properties:
- Optimizing assignment size. As formulated, both the leaders and developers may be tempted to split reasonably-sized assignments into many smaller assignments: it may be easier to predict the time required for the small tasks, thereby increasing the leader scores but reducing the overall effectiveness of the development plan. The scoring rules should be enhanced to discourage this behavior.
- Rewarding challenging assignments. In our current game, a developer who completes a complex task in time \( t \) gets no additional reward over someone else who only completes an easy task in time \( t \) (assuming accurate estimated times). We’d like to add a “complexity” measure for tasks to suitably reward stronger developers.
- Component reuse. The overall cost of development may be reduced significantly if, rather than just being incentivized to complete tasks as quickly as possible, developers are rewarded for creating reusable components (to accelerate the work of others) and learning to reuse existing components (to accelerate their own future work).
- Quality. We’d also like to integrate a notion of quality in the game to promote an optimal time-quality tradeoff; for example, it would be desirable to reduce the overall reward to a developer who completes a task very quickly but introduces bugs that are only discovered later.
Additional issues include those of eliciting information from developers, who may have information that can help the leader to generate a more accurate estimate. We are concerned also about preventing collusion between developers and leaders, whereby coordinated deviations lead to higher total scores across repeated interactions but without improving development efficiency. We also seek to ensure that there are no new biases introduced where some tasks are \( \text{ex ante} \) more likely to lead to higher scores over a given time frame than other tasks.
Analyzing the above in a rigorous game-theoretic setting should provide new insights into fundamental tradeoffs and ways to improve the development process.
4.2 Assets and Meta-Assets
Another application of markets is to assign quantitative scores to various assets in a development organization, such as reusable components. Given detailed data on tasks and scoring systems tying the data to desirable global outcomes, one could devise statistical analyses to measure the historical value of assets, e.g., how the reuse of a component contributed to a good outcome and a good score.
Similarly, market mechanisms could enable quantitative comparisons of tools aimed at predicting the future value of assets; we deem such tools meta-assets. Meta-assets could include code-level metrics like cyclomatic complexity along with the various other metrics tested for correlation with post-release defect density by the empirical software engineering community (test coverage, developer turnover, etc.). As the market’s scoring system comes closer to capturing the actual monetary value of an asset, meta-assets that can accurately predict impact on scores become more valuable. Also note that given historical data, one can easily test new meta-assets and compare their predictive power to others.
5. CONCLUSIONS
We have proposed a re-imagining of the software development process in terms of decentralized, self-regulating economies. Such economies would drive market participants to game-theoretic equilibria that maximize the overall utility of the system, encompassing software quality, time to market, and other desirable features. The economies would also provide a quantitative basis for evaluating tradeoffs in the development process and the utility of various meta-assets like software metrics. We have sketched preliminary instantiations of these principles for public and private software economies and described some challenges that need to be addressed in order to make such economies a reality.
6. REFERENCES
|
{"Source-Url": "http://econcs.seas.harvard.edu/files/econcs/files/bacon-foser10.pdf", "len_cl100k_base": 5014, "olmocr-version": "0.1.49", "pdf-total-pages": 5, "total-fallback-pages": 0, "total-input-tokens": 15603, "total-output-tokens": 5795, "length": "2e12", "weborganizer": {"__label__adult": 0.0004503726959228515, "__label__art_design": 0.00030231475830078125, "__label__crime_law": 0.0003972053527832031, "__label__education_jobs": 0.001129150390625, "__label__entertainment": 6.699562072753906e-05, "__label__fashion_beauty": 0.00015628337860107422, "__label__finance_business": 0.0013141632080078125, "__label__food_dining": 0.00041031837463378906, "__label__games": 0.0006995201110839844, "__label__hardware": 0.0004658699035644531, "__label__health": 0.0005030632019042969, "__label__history": 0.0001881122589111328, "__label__home_hobbies": 7.063150405883789e-05, "__label__industrial": 0.00030422210693359375, "__label__literature": 0.00029087066650390625, "__label__politics": 0.00033855438232421875, "__label__religion": 0.00032329559326171875, "__label__science_tech": 0.005733489990234375, "__label__social_life": 8.827447891235352e-05, "__label__software": 0.0044403076171875, "__label__software_dev": 0.9814453125, "__label__sports_fitness": 0.00029969215393066406, "__label__transportation": 0.0004651546478271485, "__label__travel": 0.0002160072326660156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27089, 0.01765]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27089, 0.15641]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27089, 0.93276]], "google_gemma-3-12b-it_contains_pii": [[0, 5233, false], [5233, 11903, null], [11903, 19007, null], [19007, 25477, null], [25477, 27089, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5233, true], [5233, 11903, null], [11903, 19007, null], [19007, 25477, null], [25477, 27089, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27089, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27089, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27089, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27089, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27089, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27089, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27089, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27089, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27089, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27089, null]], "pdf_page_numbers": [[0, 5233, 1], [5233, 11903, 2], [11903, 19007, 3], [19007, 25477, 4], [25477, 27089, 5]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27089, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
80c30e849f5eceba217038989cffff39affa71b3
|
Recap: Greedy Algorithms
Minimize Lateness
- **Greedy Choice:** Sort by earliest deadline
- **Proof of Optimality:** can always optimal solution into one with fewer inversions (Greedy Choice has 0 inversions)
- **Running Time:** $O(n \log n)$
Optimal Offline Caching
- **Goal:** Minimize number of cache misses
- **Greedy Choice:** Evict item used furthest in future [Belady'60]
- **Proof of Optimality:** Invariant: $S_T$ is optimal through first $j+1$ requests.
- **Limitation:** Need to know sequence in advance.
Optimal Online Caching
- **Goal:** Minimize number of cache misses
- **Greedy Choice:** Evict item in cache with the highest page fault rate
- **Proof of Optimality:** Invariant: $S_T$ is optimal through first $j+1$ requests.
- **Limitation:** Need to know sequence in advance.
Minimum Spanning Tree
**Definition:** Given a connected graph $G = (V, E)$ with real-valued edge weights $c_e$, an MST is a subset of the edges $T \subseteq E$ such that $T$ is a spanning tree whose sum of edge weights is minimized.
**Cayley's Theorem:** There are $n^{n-2}$ spanning trees of $K_n$.
Applications
**MST is fundamental problem with diverse applications.**
- Network design.
- Telephone, electrical, hydraulic, TV cable, computer, road
- Approximation algorithms for NP-hard problems.
- Traveling salesperson problem, Steiner tree
- Indirect applications.
- Max bottleneck paths
- LP with min-sum objective
- Image registration with Renyi entropy
- Learning salient features for real-time face verification
- Reducing data storage in sequencing amino acids in a protein
- Model locality of particle interactions in turbulent fluid flows
- Autoconfig protocol for Ethernet bridging to avoid cycles in a network
- Cluster analysis.
Greedy Algorithms
**Kruskal’s algorithm.** Start with $T = \emptyset$. Consider edges in ascending order of cost. Insert edge $e$ in $T$ unless doing so would create a cycle.
**Reverse-Delete algorithm.** Start with $T = E$. Consider edges in descending order of cost. Delete edge $e$ from $T$ unless doing so would disconnect $T$.
**Prim’s algorithm.** Start with some root node $s$ and greedily grow a tree $T$ from $s$ outward. At each step, add the cheapest edge $e$ to $T$ that has exactly one endpoint in $T$.
**Remark.** All three algorithms produce an MST.
Greedy Algorithms
Simplifying assumption. All edge costs $c_e$ are distinct.
Cut property. Let $S$ be any subset of nodes, and let $e$ be the min cost edge with exactly one endpoint in $S$. Then the MST contains $e$.
Cycle property. Let $C$ be any cycle, and let $f$ be the max cost edge belonging to $C$. Then the MST does not contain $f$.
Cycle-Cut Intersection
Claim. A cycle and a cutset intersect in an even number of edges.
Proof. (by picture)
Greedy Algorithms
Simplifying assumption. All edge costs $c_e$ are distinct.
Cycle property. Let $C$ be any cycle in $G$, and let $f$ be the max cost edge corresponding to $S$. Then the MST $T^*$ does not contain $f$.
Proof (exchange argument)
- Suppose $f$ belongs to $T^*$, and let’s see what happens.
- Deleting $f$ from $T^*$ creates a cut $S$ in $T^*$.
- Edge $f$ is both in the cycle $C$ and in the cutset $D$ corresponding to $S$.
- There exists another edge, say $e$, that is in both $C$ and $D$.
- $T' = T^* - \{e\} - \{f\}$ is also a spanning tree.
- Since $c_e < c_f$, $\text{cost}(T') < \text{cost}(T^*)$.
- This is a contradiction.
Prim’s Algorithm: Proof of Correctness
Prim’s algorithm. (Jarník 1930, Dijkstra 1959, Prim 1957)
- Initialize $S = \{\}$.
- Apply cut property to $S$.
- Add min cost edge in cutset corresponding to $S$ to tree $T$, and add one new explored node $u$ to $S$.
Implementation. Use a priority queue ala Dijkstra.
- Maintain set of explored nodes \( S \).
- For each unexplored node \( v \), maintain attachment cost \( a[v] = \text{cost of cheapest edge } v \rightarrow \text{a node in } S \).
- \( O(n^2) \) with an array; \( O(m \log n) \) with a binary heap.
- \( O(m + n \log n) \) with Fibonacci Heap
Prim(G, c) {
\( \text{foreach } (v \in V) a[v] \leftarrow \infty \)
Initialize an empty priority queue \( Q \)
\( \text{foreach } (v \in V) \text{ insert } v \text{ onto } Q \)
Initialize set of explored nodes \( S \leftarrow \emptyset \)
\( \text{while } (Q \text{ is not empty}) \{ \)
\( u \leftarrow \text{delete min element from } Q \)
\( S \leftarrow S \cup \{u\} \)
\( \text{foreach } (\text{edge } e = (u, v) \text{ incident to } u) \)
\( \text{if } (v \not\in S) \text{ and } (c_e < a[v]) \)
\( \text{decrease priority } a[v] \text{ to } c_e \)
\}
}
Kruskal's Algorithm: Proof of Correctness
Kruskal's algorithm. \([\text{Kruskal, 1956}]\)
- Consider edges in ascending order of weight.
- Case 1: If adding \( e \) to \( T \) creates a cycle, discard \( e \) according to cycle property.
- Case 2: Otherwise, insert \( e = (u, v) \) into \( T \) according to cut property where \( S \) is set of nodes in \( u \)'s connected component.
Kruskal(G, c) {
Sort edges weights so that \( c_1 \leq c_2 \leq \ldots \leq c_m \).
\( T \leftarrow \emptyset \)
\( \text{foreach } (u \in V) \text{ make a set containing singleton } u \)
\( \text{for } i = 1 \text{ to } m \)
\( (u, v) = e_i \)
\( \text{if } (u \text{ and } v \text{ are in different sets}) \{ \)
\( T \leftarrow T \cup \{e_i\} \)
\( \text{merge the sets containing } u \text{ and } v \)
\}
return \( T \)
}
Lexicographic Tiebreaking
To remove the assumption that all edge costs are distinct: perturb all edge costs by tiny amounts to break any ties.
Impact. Kruskal and Prim only interact with costs via pairwise comparisons. If perturbations are sufficiently small, MST with perturbed costs is MST with original costs.
boolean less(i, j) {
if \( (\text{cost}(e_i) < \text{cost}(e_j)) \) return true
else if \( (\text{cost}(e_i) > \text{cost}(e_j)) \) return false
else if \( (i < j) \) return true
else return false
}
MST Algorithms: Theory
Deterministic comparison based algorithms.
- \( O(m \log n) \). \([\text{Jarník, Prim, Dijkstra, Kruskal, Beruška}]\)
- \( O(m \log \log n) \). \([\text{Cheriton–Tarjan 1976}, \text{Yao 1975}]\)
- \( O(m \log(n, m)) \). \([\text{Fredman-Tarjan 1987}]\)
- \( O(m \log \log(n, m)) \). \([\text{Gabow-Gall-J-Scaper–Tarjan 1986}]\)
- \( O(m = \log(n, m)) \). \([\text{Chazelle 2000}]\)
Holy grail. \( O(m) \).
Notable.
- \( O(m) \) randomized. \([\text{Karger–Klein–Tarjan 1995}]\)
- \( O(m) \) verification. \([\text{Dixon-Rauch-Tarjan 1992}]\)
Euclidean.
- 2-d: \( O(n \log n) \). compute MST of edges in Delaunay
- \( k \)-d: \( O(kn^2) \). dense Prim
4.7 Clustering
Clustering
Clustering. Given a set $U$ of $n$ objects labeled $p_1, \ldots, p_n$, classify into coherent groups.
Distance function. Numeric value specifying "closeness" of two objects.
photos, documents, micro-organisms
Clustering of Maximum Spacing
$k$-clustering. Divide objects into $k$ non-empty groups.
Distance function. Assume it satisfies several natural properties.
- $d(p, p) = 0$ (identity of indiscernibles)
- $d(p, p) \geq 0$ (nonnegativity)
- $d(p, p) = d(p, p)$ (symmetry)
Spacing. Min distance between any pair of points in different clusters.
Clustering of maximum spacing. Given an integer $k$, find a $k$-clustering of maximum spacing.
Greedy Clustering Algorithm
Single-link $k$-clustering algorithm.
1. Form a graph on the vertex set $U$, corresponding to $n$ clusters.
2. Find the closest pair of objects such that each object is in a different cluster, and add an edge between them.
3. Repeat $n-k$ times until there are exactly $k$ clusters.
Key observation. This procedure is precisely Kruskal’s algorithm (except we stop when there are $k$ connected components).
Remark. Equivalent to finding an MST and deleting the $k-1$ most expensive edges.
Greedy Clustering Algorithm: Analysis
Theorem. Let $C^*$ denote the clustering $C^*_1, \ldots, C^*_k$ formed by deleting the $k-1$ most expensive edges of a MST. $C^*$ is a $k$-clustering of max spacing.
Proof. Let $C$ denote some other clustering $C_1, \ldots, C_k$.
1. The spacing of $C^*$ is the length $d^*$ of the $(k-1)^{th}$ most expensive edge (in MST).
2. Let $p, q$ be in the same cluster in $C^*$, say $C^*_r$, but different clusters in $C$, say $C_s$ and $C_t$.
3. Some edge $(p, q)$ on the path spanning two different clusters in $C$.
4. All edges on the path have length $\leq d^*$ since Kruskal chose them.
5. Spacing of $C$ is $\geq d^*$ since $p$ and $q$ are in different clusters.
Union-Find Data-Structure
Three Operations
- `MakeUnionFind(S)`
- Initialize a Union-Find data structure where all elements in $S$ are in separate sets
- `Find(u)`
- Input: $u \in S$
- Output: Name of the set $A$ containing $u$
- Require: If $u, v$ in the same set $A$ then $\text{Find}(u) = \text{Find}(v)$
- `Union(A,B)`
- Input: Names of sets $A$ and $B$ in the Union-Find data structure
- No Output: Merge the sets $A$ and $B$ into a single set $A \cup B$
- Require: If we had $u \in A$ and $v \in B$ then we require that $\text{Find}(u) = \text{Find}(v)$ after this operation is completed
Union-Find Applications
- Efficient Implementation of Kruskal's Algorithm
- Initially all nodes are in different sets (no edges added to T)
- Find(u) = u for each node u
- Indicates that each node is its own connected component (initially)
- Add edge (u,v) to T
- Merges two connected components containing u and v respectively
- Union(A,B) where A = Find(u) and B=Find(v)
- Check if adding edge (u,v) induces a cycle in T
- Observation: (u,v) induces a cycle if and only if u and v are already in the same connected component.
- Test: Find(u) = Find(v)?
- Yes → u,v are in same component (u,v) would induce cycle
- No → u,v are not in same component (u,v) won't induce cycle
Union-Find Implementation
MakeUnionFind(S)
Initialization: S={1,...,n}
Node 1 Node 2 Node n
1 | null | 1 | null | ...... | n | null
Pointers to parent in rooted tree
Size of set
node Find(v) {
if (v.parent == null)
return v
else
vRoot =Find(v.parent)
return vRoot
}
Example: Find(v) = x
Union(Node u, Node v){
uRoot = Find(u), vRoot=Find(v)
if (uRoot==vRoot) return
else if (uRoot.size > vRoot.size)
vRoot.Parent = uRoot; uRoot.size+= vRoot.size;
else
uRoot.Parent = vRoot; vRoot.size+= uRoot.size;
}
Example: Union(u,v)
- uRoot is new root of Merged set
- vRoot is new root of Merged set
Path Compression
Example: Find(y)
```
node Find(v) {
if (v.parent == null)
return v
else
vRoot = Find(v.parent);
v.parent = vRoot;
return vRoot;
}
```
Path Compression
Example: Find(y) - every node on path from y to root x now points directly to x
Union Find: Running Time
(Path Compression + Union by Size)
- Amortized Running Time: $O(\alpha(n))$ per operation
- $\alpha(n)$ - Inverse Ackermann Function (Grows Incredibly Slowly)
- $\alpha(n) \leq 5$ for any value of n you will ever use on a computer!
- Could achieve same result with union by rank (height of tree)
MST Algorithms: Theory
Deterministic comparison based algorithms.
- $O(m \log n)$ [Jarník, Prim, Dijkstra, Kruskal, Boruvka]
- $O(m \log \log n)$ [Cheriton-Tarjan 1976, Yao 1975]
- $O(m (\log \log n)^2)$ [Fredman-Tarjan 1987]
- $O(m \alpha(m, n))$ [Gabow-Galil-Spencer-Tarjan 1986]
- $O(m \alpha(m, n))$ [Chazelle 2000]
Holy grail. $O(m)$.
Notable.
- $O(m)$ randomized [Karger-Klein-Tarjan 1995]
- $O(m)$ verification [Dixon-Rauch-Tarjan 1992]
Euclidean.
- 2-d: $O(n \log n)$ compute MST of edges in Delaunay
- k-d: $O(k n^2)$ dense Prim
Divide and Conquer
Divide-and-Conquer
- Break up problem into several parts.
- Solve each part recursively.
- Combine solutions to sub-problems into overall solution.
Most common usage.
- Break up problem of size n into two equal parts of size $\frac{n}{2}$.
- Solve two parts recursively.
- Combine two solutions into overall solution in linear time.
Consequence.
- Brute force: $n^2$
- Divide-and-conquer: $n \log n$.
Divide et impera.
Veni, vidi, vici.
-Julius Caesar
5.1 Mergesort
Mergesort
- Divide array into two halves.
- Recursively sort each half.
- Merge two halves to make sorted whole.
A Useful Recurrence Relation
Def. \( T(n) \) = number of comparisons to mergesort an input of size \( n \).
Mergesort recurrence.
\[
T(n) \leq \begin{cases}
0 & \text{if } n = 1 \\
\frac{T(n/2^k)}{2} + \frac{T(n/2^k)}{2} + \frac{n}{2} & \text{otherwise}
\end{cases}
\]
Solution. \( T(n) \leq O(n \log_2 n) \).
Assorted proofs. We describe several ways to prove this recurrence. Initially we assume \( n \) is a power of 2 and replace \( \leq \) with \( = \).
Amer Hani
Copyright 2000, Kevin Wayne
Claim. If \( T(n) \) satisfies the following recurrence, then \( T(n) = n \log_2 n \).
\[
T(n) = \begin{cases}
0 & \text{if } n = 1 \\
T(2) + a & \text{otherwise}
\end{cases}
\]
Pf. (by induction on \( n \))
- Base case: \( n = 1 \).
- Inductive hypothesis: \( T(n) = n \log_2 n \).
- Goal: show that \( T(2n) = 2n \log_2 (2n) \).
\[
T(2n) = 2T(n) + 2a
\]
\[
= 2n \log_2 (2n)
\]
More General Analysis
\[
T(n/b^k) = \frac{T(n)}{b^k} + \frac{a}{b^k}
\]
\[
T(n) \leq \frac{1}{\log n} \sum_{i=0}^{k-1} \left( \frac{\log n}{2} \right)^{i} \left( \frac{\log n}{2} \right)^{i} = \frac{1}{\log n} \sum_{i=0}^{k-1} \left( \frac{\log n}{2} \right)^{i} \left( \frac{\log n}{2} \right)^{i}
\]
Case 1: \( \gamma = \left( \frac{\log n}{2} \right) = 1 \)
\[
T(n) \leq \frac{1}{\log n} \sum_{i=0}^{k-1} \left( \frac{\log n}{2} \right)^{i} \left( \frac{\log n}{2} \right)^{i} = \frac{1}{\log n} \sum_{i=0}^{k-1} \left( \frac{\log n}{2} \right)^{i} \left( \frac{\log n}{2} \right)^{i}
\]
Case 2: \( \gamma < \left( \frac{\log n}{2} \right) < 1 \)
\[
T(n) \leq \frac{1}{\log n} \sum_{i=0}^{k-1} \left( \frac{\log n}{2} \right)^{i} \left( \frac{\log n}{2} \right)^{i} \leq \frac{1}{\log n} \sum_{i=0}^{k-1} \left( \frac{\log n}{2} \right)^{i} \left( \frac{\log n}{2} \right)^{i}
\]
More General Analysis
\[ T(n) = T(n/b) + T(n/b^2) + \ldots + T(n/b^k) \]
Case 3: \( k \geq 1 \)
\[ T(n) \leq \sum_{i=0}^{k-1} \left( \frac{n}{b^i} \right)^c \]
\[ \Theta \left( \frac{n^c}{\log bn} \right) \]
|
{"Source-Url": "https://www.cs.purdue.edu/homes/jblocki/courses/580_Spring19/Lectures/CS580-Lecture6MinimSpanningTree.pdf", "len_cl100k_base": 4693, "olmocr-version": "0.1.49", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 30847, "total-output-tokens": 5385, "length": "2e12", "weborganizer": {"__label__adult": 0.0004630088806152344, "__label__art_design": 0.0004270076751708984, "__label__crime_law": 0.0006699562072753906, "__label__education_jobs": 0.0012083053588867188, "__label__entertainment": 0.00014507770538330078, "__label__fashion_beauty": 0.00024068355560302737, "__label__finance_business": 0.0004024505615234375, "__label__food_dining": 0.0006923675537109375, "__label__games": 0.0012044906616210938, "__label__hardware": 0.0027408599853515625, "__label__health": 0.001560211181640625, "__label__history": 0.0004711151123046875, "__label__home_hobbies": 0.00029158592224121094, "__label__industrial": 0.0010118484497070312, "__label__literature": 0.0004703998565673828, "__label__politics": 0.00034165382385253906, "__label__religion": 0.0007891654968261719, "__label__science_tech": 0.201171875, "__label__social_life": 0.00013184547424316406, "__label__software": 0.00981903076171875, "__label__software_dev": 0.77392578125, "__label__sports_fitness": 0.0005970001220703125, "__label__transportation": 0.0008387565612792969, "__label__travel": 0.0002727508544921875}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 14333, 0.01232]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 14333, 0.51877]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 14333, 0.65915]], "google_gemma-3-12b-it_contains_pii": [[0, 2315, false], [2315, 3682, null], [3682, 6755, null], [6755, 9250, null], [9250, 10578, null], [10578, 12214, null], [12214, 12849, null], [12849, 14122, null], [14122, 14333, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2315, true], [2315, 3682, null], [3682, 6755, null], [6755, 9250, null], [9250, 10578, null], [10578, 12214, null], [12214, 12849, null], [12849, 14122, null], [14122, 14333, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 14333, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 14333, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 14333, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 14333, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 14333, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 14333, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 14333, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 14333, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 14333, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 14333, null]], "pdf_page_numbers": [[0, 2315, 1], [2315, 3682, 2], [3682, 6755, 3], [6755, 9250, 4], [9250, 10578, 5], [10578, 12214, 6], [12214, 12849, 7], [12849, 14122, 8], [14122, 14333, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 14333, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
1441d7acaf08b9ca472a4a6f5fac994b9c94c28e
|
HKUST
WEBSITE
GUIDELINES
LAST UPDATED: JUNE 2019
| CONTENTS |
|----------|----------|
| **01** Introduction | **05** Accessibility |
| **02** Registration of a New Affiliated Website | **06** Security |
| **03** Alignment of Affiliated Websites | **07** China Friendly |
| 3.1 HKUST Header/ Footer Templates | **08** Site Launch |
| **04** Site Structure / Elements | 8.1 User Acceptance Test |
| 4.1 HKUST Header | 8.2 Performance Tracking |
| 4.1.1 HKUST Logo | 8.3 Tips on Search Engine Optimization |
| 4.1.2 Affiliated Units | **09** Contact Us |
| 4.1.3 Search | p.30 |
| 4.1.4 Language | p.31 |
| 4.2 Content Body | p.32 |
| 4.2.1 Content Freshness | p.33 |
| 4.2.2 Navigation | |
| 4.2.3 Font Type / Font Size | |
| 4.2.4 Responsive Design | |
| 4.2.5 Images / Graphics | |
| 4.2.6 Videos | |
| 4.2.7 Downloadable Content | |
| 4.2.8 Printer Friendly | |
| 4.2.9 About Us | |
| 4.2.10 Contact Information | |
| 4.3 HKUST Footer | |
| 4.3.1 Copyright | |
| 4.3.2 Privacy Statement | |
| 4.3.3 Sitemap | |
| 4.3.4 Social Icons | |
**HKUST Website Guidelines**
Our website is one of the most important communication tools for the University as a whole. It connects and interacts with our stakeholders and the public everywhere, every minute of the day. As part of The Hong Kong University of Science and Technology (HKUST), all individual HKUST University websites must be regularly updated and achieve the highest level of aesthetic appeal and they must project a consistent design structure. They should contain user friendly navigation and be intuitive, with a tone of voice that helps to build a cohesive impression of HKUST.
The University has developed a site platform using Drupal with relevant functions and templates for website development. The site platform has incorporated all mandatory functions and features based on these guidelines. This customized site platform must be the ultimate site platform used across the University.
You can still enjoy the freedom of website design layout, graphics and multimedia supported by Media Technology and Publishing Center (MTPC) and / or your dedicated agency, with the backend being handled by Information Systems Office (ISO), and hosting being handled by Information Technology Services Center (ITSC).
It is hoped that with the implementation of this set of guidelines, affiliated HKUST University Websites will have a consistent look and feel for building a cohesive brand image of the University.
If you have enquiries related to your School’s/ Office’s/ Unit’s/ Department’s website or brand guidelines, you are welcome to email brand@ust.hk or contact Ms Sherry Yeung, Head of Brand Marketing, Public Affairs Office (PAO) on 2358-5967 for assistance and clarification.
If you are planning to develop a new affiliated website (yourwebsitename.UST.HK), please check with ITSC for web server hosting and domain registration. To avoid outdated websites being searched by the public, please note that all website registration details are set with an expiry date, upon which the content of the particular website is automatically archived and not accessible by public upon expiration, unless an extension of website hosting request has been made.
Upon the launch of your new website, please redirect all old URLs to the new ones. You are also encouraged to archive old website content before removing the expired website from the Internet permanently.
As the administrator of brand guidelines, the Public Affairs Office is also responsible for administering the guidelines. Please therefore inform us (brand@ust.hk) whenever you have established or plan to establish a new affiliated website, so that links can be added / updated from the University website as an official recognition.
It is essential that all HKUST websites addressing the public (i.e. websites with the domain name ust.hk) except those that require internal authentication, must follow the University brand and website guidelines. This is to ensure a consistent look and feel for building a cohesive brand image.
Official websites for the following categories are being prioritized to adopt the HKUST Header/Footer templates with responsive design which should be adaptive to different devices, and must pass ITSC security standards. The listed affiliated websites should adopt HKUST Drupal platform for their next website revamp cycle.
- Schools /Program Offices
- Academic Institutes
- Research Institutes
- Academic Departments
- Academic Programs
- Research Centers / Laboratories
- University Annual Events
- University-wide Projects
- Administrative and Academic Support Units
In cases of partnership with external organizations, the affiliated website under ust.hk domain should include a full color HKUST logo with its corresponding language version linking back to www.ust.hk.
For websites with features that HKUST Drupal Platform is yet to support, basic branding elements should be fulfilled on its current website until the next revamp cycle. These websites should work with ISO for their customized feature development used on the HKUST Drupal Platform. Basic branding elements should include the correct use of a full color HKUST logo with its corresponding language version linking back to www.ust.hk, and the adoption of the full HKUST Footer template.
3.1 HKUST HEADER/FOOTER TEMPLATES
There are two options for HKUST Headers:
Option 1 (HKUST logo on left hand side) is for websites that display their names in capitalized text or with their own logo.
- Recommended locations for navigation menu: Area A, B and C.
- Global icon would only require to be featured in websites with multiple languages.
- If an affiliated unit has its own logo, it could replace the full name, with visual size NOT bigger than the HKUST logo.
- Affiliated units’ names next to HKUST logo must use HKUST official font type (Muli or Arial), size, spacing and color. Please refer to page 14 for details.
Click here to preview the HKUST Header
3.1 HKUST HEADER/FOOTER TEMPLATES
Option 2 (HKUST logo on right hand side) is for websites who would like to feature their own logo.
- Recommended locations for navigation menu: Area A, B and C.
- Global icon would only require to be featured in websites with multiple languages.
- If an affiliated unit has its own logo, it could replace the full name of the affiliated unit, with logo size NOT bigger than the HKUST logo.
3.1 HKUST HEADER/FOOTER TEMPLATES
There is an expandable menu incorporated in the header links within the menu that are to be connected to corresponding pages of the University website.
Click here to preview the HKUST Header.
3.1 HKUST HEADER/FOOTER TEMPLATES
The HKUST Footer includes the HKUST logo abbreviation and links to the, Privacy and Sitemap. The abbreviated logo is featured in the footer to educate users about “HKUST” brand abbreviation, as does the full HKUST logo in the header.
You must link social media icons to your own social media accounts or to HKUST’s social media accounts if you do not have one. Below are the University’s social media accounts:
1. Facebook: https://www.facebook.com/hkust/
2. Instagram: https://www.instagram.com/hkust/
3. LinkedIn: https://www.linkedin.com/school/hkust/
4. YouTube: https://www.youtube.com/hkust
5. WeChat: [QR Code]
Please ensure corresponding logo version is displayed upon switch of language. HKUST logos must link back to ust.hk website.
You are also welcome to include additional social media icons in reversed white with links if you have other social media accounts.
Click here to preview the HKUST Footer
Click here to download the social media icons sample
04. SITE STRUCTURE / ELEMENTS
4.1 HKUST HEADER
All affiliated websites must include the HKUST Header template. Keep in mind that our stakeholders expect certain key elements of a site to be placed in the same general area.
4.1 HKUST HEADER
4.1.1 HKUST LOGO
• The HKUST logo must always be included in the HKUST Header.
• The HKUST logo must incorporate a hyperlink to the University website at www.ust.hk.
• The above must apply to mobile versions of the individual Schools/Departments/Centers/Offices.
• All ust.hk websites must deploy the University’s logo mark as Favicon in the domain display.
• To download the logo files: here
4.1 HKUST HEADER
4.1.2 AFFILIATED UNITS
- All affiliated units (examples: individual Schools/Departments/Divisions/Offices/Central Units) must use the corporate logo with the units’ full name to the right of HKUST logo in corresponding language.
- HKUST logo font style must be applied for affiliated units’ names when featured next to HKUST logo in capitalized text and on the corporate blue bar in HKUST Header.
- If an affiliated unit has its own logo, it could replace the full name, with visual size NOT bigger than the HKUST logo.
- To download the logo files: here
EXAMPLES:
<table>
<thead>
<tr>
<th>SCHOOL</th>
<th>UNIT UNDER SCHOOL</th>
<th>CENTRAL UNIT</th>
</tr>
</thead>
<tbody>
<tr>
<td>THE HONG KONG UNIVERSITY OF SCIENCE AND TECHNOLOGY</td>
<td>THE HONG KONG UNIVERSITY OF SCIENCE AND TECHNOLOGY</td>
<td>THE HONG KONG UNIVERSITY OF SCIENCE AND TECHNOLOGY</td>
</tr>
<tr>
<td>HKUST FOK YING TUNG GRADUATE SCHOOL/ HKUST FOK YING TUNG RESEARCH INSTITUTE</td>
<td>DEPARTMENT OF INFORMATION SYSTEMS, BUSINESS STATISTICS AND OPERATIONS MANAGEMENT</td>
<td>UNDERGRADUATE RECRUITMENT AND ADMISSIONS OFFICE</td>
</tr>
</tbody>
</table>
HKUST Website Guidelines
4.1 HKUST HEADER
4.1.2 AFFILIATED UNITS
- Affiliated unit’s name must follow HKUST official font type (Muli / Arial), size, spacing and color. Follow the same scale of font size and line spacing of the HKUST corporate logo, with vertical center alignment. (see example)
- Follow the scale, spacing & clear space guideline as listed in the example.
- No more than 3 lines with max. 5 words in each line on the English title.
- To download the logo files: [here](#)
ENGLISH EXAMPLE:
```
THE HONG KONG UNIVERSITY OF SCIENCE AND TECHNOLOGY
HKUST FOK YING TUNG GRADUATE SCHOOL/ HKUST FOK YING TUNG RESEARCH INSTITUTE
```
Each line max. 5 words
4.1 HKUST HEADER
4.1.2 AFFILIATED UNITS
- Affiliated unit’s name must follow HKUST official font type (蘋果儷黑體 / 微軟正黑體), size, spacing and color. Follow the same scale of font size and line spacing of the HKUST corporate logo, with vertical center alignment. (see example)
- Follow the scale, spacing & clear space guideline as listed in the example.
- 1 line only with max. 15 words on the Chinese title.
- To download the logo files: here
CHINESE EXAMPLE:
X
香港科技大學 | 香港科大霍英東研究院
ONE line only, max. 15 words
4.1 HKUST HEADER
4.1.3 SEARCH
Often stakeholders visit a website to find information on a very specific topic. Website visitors expect to see a search box to assist them in finding content quickly.
Your website must have search functionality so that multiple stakeholders can swiftly and easily access the content that they are looking for.
4.1.4 LANGUAGE
Apart from English, which is the official language of HKUST, it is suggested all web content is made available in Traditional Chinese and Simplified Chinese.
For a better user experience, the default setting of a website’s language should be set based on the browser settings of visitors.
**4.2 CONTENT BODY**
Schools/Departments/Centers/Offices are free to have their own designs for the content. However, there are elements that are important to deliver a professional image of the University which is part of everyone’s responsibility in the HKUST community.
Please ensure your design provides quality content in particular content freshness and user-friendly functions.
4.2 CONTENT BODY
4.2.1 CONTENT FRESHNESS
To ensure content freshness, it is suggested to include API (or RSS with tags) to the University website for automated content such as events, press releases, news, according to categorization by the University. Moreover, your chosen naming convention must not create wrong expectations, with regards to its content freshness. For example, it is better to name the section “Highlights” instead of “Latest News” or “News” if the content could not be updated very frequently.
4.2.2 NAVIGATION
Consider segmenting audience groups with organized content and website navigation in order to make it easy for stakeholders to find content that they look for.
Consider categorizing main navigation by grouping content by topic. Clear content pathways and keywords in the navigation guide users to the information that they are looking for in an easy-to-understand way.
Breadcrumbs Trail displays the navigation path of visitors. It makes easier for visitors to trace back their navigating path between the current page and the homepage.
4.2 CONTENT BODY
4.2.3 FONT TYPE / FONT SIZE
To ensure consistency across all HKUST affiliated websites, please use the same font types (Muli or Arial) for content.
Please refer to Brand Guidelines under “Typeface” section (p.62). Minimum font size of body font should be 16 pixel, while font size of secondary text should be 13-14 pixel.
• To download Muli font files: here
4.2.4 RESPONSIVE DESIGN
As of 2017, 70% of visitors already access HKUST websites from a mobile device, with high mobility and heavy use of smartphones and tablets to access content online, all the affiliated websites must be mobile responsive. You must verify the responsiveness of your website through different size of devices to make sure that the menu navigation is presented in a clear format for mobile.
There are certain features that do not display properly via mobile devices such as drop down menus which could provide a poor user experience to mobile visitors. Also, you should identify the content and organize information display in mobile to make sure you are still providing users with information they need.
To fit comfortably on an average 1366 x 768 pixel screen (PC and Mac), please place content sections on the center of the browser.
For quick checking of a website’s mobile friendliness, please click here.
4.2 CONTENT BODY
4.2.5 IMAGES / GRAPHICS
Please observe the following guidelines about images:
- Images should be in GIF, JPEG or PNG format.
- Resolution for digital photo should be 72dpi.
- For easy download, the file size should not exceed 2MB.
- Meaningful text (in the “ALT” attribute in IMG tag) should be provided for the images and graphics used on the website.
4.2.6 VIDEOS
When including multimedia content into a website, the file size should be considered to avoid a long loading time. For example, video content should include skip function for its mobile version.
Flash display is fading out and not accessible to many visitors, especially those using mobile devices or older desktops. If using Flash is unavoidable, the following should be noted:
- Flash animations should be embedded in an HTML page in SWF format. It should contain download instruction for browsers without Flash support.
- As some devices such as mobile devices or browsers cannot display Flash content, an alternative image underneath the content should be inserted.
4.2 CONTENT BODY
4.2.7 DOWNLOADABLE CONTENT Please be reminded not to post documents for public download in editable formats such as MS Word, MS PowerPoint or MS Excel, unless the files are free downloadable tools for visitors. Please convert to HTML or PDF format. For details on producing PDFs, please refer to the W3C PDF Techniques for WCAG 2.0.
4.2.8 PRINTER FRIENDLY The University supports sustainability, but if users would like to print a copy of the webpage, please ensure the webpage is printer friendly in order to avoid waste of paper.
4.2 CONTENT BODY
4.2.9 ABOUT US
Include a link to the About Us section, which should include basic information about you or your Schools/Departments/Centers/Offices. This allows users an additional opportunity to ascertain the nature of your site.
4.2.10 CONTACT INFORMATION
Contact information should be included so that stakeholders can send enquiries or feedback through established channels to relevant parties. Designated staff should be assigned to handle these enquiries and feedback.
4.3 HKUST FOOTER
All affiliated websites must include a HKUST Footer template.
4.3 HKUST FOOTER
4.3.1 COPYRIGHT
Include copyright information to protect your website from plagiarism. Copyright must be presented as:
Copyright © The Hong Kong University of Science and Technology.
All Rights Reserved.
4.3.2 PRIVACY STATEMENT
Must include a link from your Schools/Departments/Centers/Offices website to the privacy statement on the HKUST University website.
4.3 HKUST FOOTER
4.3.3 SITE MAP
The site map summarizes the website structure to enable search for information which allows users a place where they could navigate the rest of your site. This way, if anyone gets lost they can find their way in the footer. An XML sitemap is preferable for search engine.
4.3.4 SOCIAL ICON
HKUST Social Icons or social icons from your Schools/Department/Centers/Offices must be included in the HKUST Footer in order not to distract users away from content.
Click here to download the social media icons sample
It is encouraged to fulfill Web Accessibility Initiative (WAI) to make your website accessible to people with disabilities.
**Best View Recommendation**
It is a good practice to include a statement about recommended view settings for your website. Such recommendations usually cover browser versions and any necessary plug-ins. Please avoid using too many plug-ins and use only plug-ins that are common and available on a large range of devices.
Technical recommendations from ITSC: All newly developed/revamped/CMS created web pages should be compatible for viewing with common web browsers including Microsoft Internet Explorer, Google Chrome, Mozilla Firefox, Safari etc. on MS Windows, Apple (Mac OS and iOS), Android and Linux platforms.
**Text-Only Version**
A text-only version of the web content can be made available for visitors with text-only browsers.
**ALT Tag**
Use ALT tags to add text descriptions for graphics, images and multimedia content. This way, visitors who cannot view the images/multimedia content will still get the content information.
**Keyboard Accessibility**
To cater those who cannot use a mouse, please make sure that your website can be navigated easily on keyboard.
For more details, please refer to the Web Accessibility Recognition Scheme [https://www.web-accessibility.hk/zh-hant/](https://www.web-accessibility.hk/zh-hant/)
All affiliated websites must be Hyper Text Transfer Protocol Secured (HTTPS) and websites fall into high risk category of Minimum Security Standard for Application Systems) must pass the Security Vulnerabilities scanning and fixing - to use security vulnerability scanning tool to scan the customized package system.
For any security vulnerability isolated by the scanning tool, the website owner shall immediately perform fix-up to eliminate all vulnerable codes. Please consult ITSC for further details. Reference: here
General approaches to web development may create websites incompatible to certain countries. As for China, it is observed typically that some URLs such as Google API Library, Google Font Library and jQuery Library cannot be accessed from Mainland China occasionally. If the webpage header or content body script loads such URLs, the website loading performance access from Mainland China will be affected.
The International Internet bandwidth in Mainland China is demanding, network traffic congestion may occur during busy hours which also affect the webpage loading time.
There are some tips that can load the webpage faster in Mainland China are listed as below:
- Reduce loading external URLs script, load the script locally instead. Common listing of external URLs script used in HKUST websites:
**Google API Library**
[https://www.google.com/jsapi](https://www.google.com/jsapi)
[http://ajax.googleapis.com/ajax](http://ajax.googleapis.com/ajax)
**Google Fonts Library**
[https://fonts.googleapis.com/](https://fonts.googleapis.com/)
**jQuery Library**
For other list of URLs that cannot access from Mainland China, you can refer to here.
- Design webpage using asynchronous approach such that website keeps loading the remaining elements of the page instead of hanging once it encounters any inaccessible URLs from Mainland China
- Optimize images size to not more than 1MB
- Simplify the website design by reducing the number of loading javascript, css, images files and plugins
For more tips on how to load the webpage faster in China, please consult ITSC Service Desk for further details.
08. SITE LAUNCH
HKUST Website Guidelines
8.1 USER ACCEPTANCE TEST
Please also ensure your new website has passed User Acceptance Test (UAT) before launch. User acceptance testing is the last phase of the website testing process. During UAT, actual website users test the website to make sure it can handle required tasks in real-world scenarios, according to specifications.
UAT is one of the final and critical website project procedures that occurs before newly developed website is rolled out to the market.
Upon the launch of your new website, you are encouraged to review your website performance from time to time for further enhancement. Tracking tools like Google Analytics help for better understanding of your stakeholders and possible identification of useful insights on traffic, demographic and behaviors which could help you to define your strategy and planning. Reports or access of the website analytics must be made available.
To ensure reaching your target stakeholders with the right content, your website should be search engine-friendly. The optimization is an ongoing effort that should be continued after the launch of a new website. Here are some simple tips:
- Use page titles. Each page needs to have a unique page title that accurately describes the page’s content. Be brief and descriptive to help the user understand what the page is about.
- Add a site map.
- Use meta tags. Only use relevant keywords in meta-description.
- Be aware that the content is constantly “crawled” by search engines. By keeping content fresh and original, updated frequently, and using various keywords and phrases, your website will be more attractive to visitors and search engines alike.
- Develop simple, logical internal navigation. Make sure that you have a breadcrumb on all your internal pages. It is easy for visitors to link between related sections and pages on the websites.
- Develop a proper 404 page such as explanation of the situation and options to other related websites / webpages.
- Page speed concern. Be aware of image and video file size or other factors that affect the loading speed. Go to Google Page Speed Service to analyze your website and get performance recommendations.
09. CONTACT US
On branding elements of affiliated websites:
Events Management and Branding,
Public Affairs Office
3469-2440 | brand@ust.hk | https://pao.ust.hk
On website domain registration, server hosting, and security:
Information Technology Services Center
2358 6188, 2358 6200 | cchelp@ust.hk | https://itsc.ust.hk/
On website development on backend site architecture:
Information Systems Office
2358 6240 | issupp@ust.hk | https://iso.ust.hk/
On website layout, graphics and multimedia:
Media Technology and Publishing Center
2358 6807 | mtpc@ust.hk | http://mtpc.ust.hk/
|
{"Source-Url": "https://pao.ust.hk/Bdownload/HKUST_website_guideline.pdf", "len_cl100k_base": 5183, "olmocr-version": "0.1.53", "pdf-total-pages": 34, "total-fallback-pages": 0, "total-input-tokens": 49640, "total-output-tokens": 6519, "length": "2e12", "weborganizer": {"__label__adult": 0.0006461143493652344, "__label__art_design": 0.0179901123046875, "__label__crime_law": 0.0015239715576171875, "__label__education_jobs": 0.270751953125, "__label__entertainment": 0.0005917549133300781, "__label__fashion_beauty": 0.0006957054138183594, "__label__finance_business": 0.025787353515625, "__label__food_dining": 0.0006823539733886719, "__label__games": 0.0010986328125, "__label__hardware": 0.0022373199462890625, "__label__health": 0.0006632804870605469, "__label__history": 0.0015459060668945312, "__label__home_hobbies": 0.0008788108825683594, "__label__industrial": 0.0007839202880859375, "__label__literature": 0.0013790130615234375, "__label__politics": 0.0006127357482910156, "__label__religion": 0.0012350082397460938, "__label__science_tech": 0.004528045654296875, "__label__social_life": 0.0006012916564941406, "__label__software": 0.2166748046875, "__label__software_dev": 0.446533203125, "__label__sports_fitness": 0.0003771781921386719, "__label__transportation": 0.0007977485656738281, "__label__travel": 0.0013933181762695312}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 23496, 0.0417]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 23496, 0.02769]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 23496, 0.88394]], "google_gemma-3-12b-it_contains_pii": [[0, 49, false], [49, 1067, null], [1067, 2741, null], [2741, 3754, null], [3754, 5310, null], [5310, 5981, null], [5981, 6407, null], [6407, 6635, null], [6635, 7642, null], [7642, 7672, null], [7672, 7866, null], [7866, 8278, null], [8278, 9359, null], [9359, 10003, null], [10003, 10516, null], [10516, 11167, null], [11167, 11554, null], [11554, 12629, null], [12629, 13943, null], [13943, 15003, null], [15003, 15554, null], [15554, 16048, null], [16048, 16128, null], [16128, 16510, null], [16510, 17057, null], [17057, 18431, null], [18431, 18954, null], [18954, 20690, null], [20690, 20732, null], [20732, 21204, null], [21204, 21637, null], [21637, 22910, null], [22910, 23496, null], [23496, 23496, null]], "google_gemma-3-12b-it_is_public_document": [[0, 49, true], [49, 1067, null], [1067, 2741, null], [2741, 3754, null], [3754, 5310, null], [5310, 5981, null], [5981, 6407, null], [6407, 6635, null], [6635, 7642, null], [7642, 7672, null], [7672, 7866, null], [7866, 8278, null], [8278, 9359, null], [9359, 10003, null], [10003, 10516, null], [10516, 11167, null], [11167, 11554, null], [11554, 12629, null], [12629, 13943, null], [13943, 15003, null], [15003, 15554, null], [15554, 16048, null], [16048, 16128, null], [16128, 16510, null], [16510, 17057, null], [17057, 18431, null], [18431, 18954, null], [18954, 20690, null], [20690, 20732, null], [20732, 21204, null], [21204, 21637, null], [21637, 22910, null], [22910, 23496, null], [23496, 23496, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 23496, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 23496, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 23496, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 23496, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 23496, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 23496, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 23496, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 23496, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 23496, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 23496, null]], "pdf_page_numbers": [[0, 49, 1], [49, 1067, 2], [1067, 2741, 3], [2741, 3754, 4], [3754, 5310, 5], [5310, 5981, 6], [5981, 6407, 7], [6407, 6635, 8], [6635, 7642, 9], [7642, 7672, 10], [7672, 7866, 11], [7866, 8278, 12], [8278, 9359, 13], [9359, 10003, 14], [10003, 10516, 15], [10516, 11167, 16], [11167, 11554, 17], [11554, 12629, 18], [12629, 13943, 19], [13943, 15003, 20], [15003, 15554, 21], [15554, 16048, 22], [16048, 16128, 23], [16128, 16510, 24], [16510, 17057, 25], [17057, 18431, 26], [18431, 18954, 27], [18954, 20690, 28], [20690, 20732, 29], [20732, 21204, 30], [21204, 21637, 31], [21637, 22910, 32], [22910, 23496, 33], [23496, 23496, 34]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 23496, 0.13008]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
02912691a6bd5bab24c57d32eb0515a36c9eba7b
|
Chernoff Bounds (above mean)
**Theorem.** Suppose $X_1, \ldots, X_n$ are independent 0-1 random variables. Let $X = X_1 + \ldots + X_n$. Then for any $\mu \geq E[X]$ and for any $\delta > 0$, we have
$$\Pr[X > (1 + \delta)\mu] \leq \left(\frac{e^\delta}{(1 + \delta)^{\delta}}\right)^\mu.$$
**Pf.** We apply a number of simple transformations.
1. For any $t > 0$,
$$\Pr[X > (1 + \delta)\mu] = \Pr[e^{tX} > e^{(1 + \delta)t\mu}].$$
2. Let $Y = e^{tX}$ be a random variable. $e^{tX}$ is a monotonically increasing function.
$$\Pr[X > (1 + \delta)\mu] = \Pr[Y > e^{(1 + \delta)t\mu}] = e^{(1 + \delta)t\mu} \Pr[Y > e^{(1 + \delta)t\mu}].$$
Markov’s inequality: $\Pr[Y > a] \leq \frac{E[Y]}{a}$.
**Pf. (cont)** We had derived for any $t > 0$,
$$\Pr[X > (1 + \delta)\mu] \leq e^{-(1 + \delta)t\mu} \Pr[Y > e^{(1 + \delta)t\mu}] = e^{-(1 + \delta)t\mu} \sum p_i.$$
Now
$$E[p_i] = E[e^{tX}] = \sum E[e^{tX_{ij}}].$$
Definition of $X$.
Let $p_i = \Pr[X_i = 1]$. Then,
$$E[e^{tX}] = e^t \sum (1 - p_i)e^{t(1 - p_i)} = 1 + p_i e^t - 1 \leq e^{p_i e^t}$$
for any $t > 0, 1 + a \leq e^a$.
Combining everything:
$$\Pr[X > (1 + \delta)\mu] \leq e^{-(1 + \delta)t\mu} \sum p_i.$$
Let $\Sigma_{X_i, i \leq \mu}$. Then,
$$\Pr[X > (1 + \delta)\mu] \leq e^{-(1 + \delta)t\mu} \sum p_i = e^{-(1 + \delta)t\mu} \sum p_i \leq e^{-(1 + \delta)t\mu} \sum e^{t(1 - p_i)}.$$
Finally, choose $t = \ln(1 + \delta)$.
Chernoff Bounds (below mean)
**Theorem.** Suppose $X_1, \ldots, X_n$ are independent 0-1 random variables. Let $X = X_1 + \ldots + X_n$. Then for any $\mu \leq E[X]$ and for any $0 < \delta < 1$, we have
$$P(X < (1-\delta)\mu) < e^{\delta^2 \mu / 2}$$
**Pf idea.** Similar.
**Remark.** Not quite symmetric since only makes sense to consider $\delta < 1$.
#### 13.10 Load Balancing
**Load Balancing** System in which $m$ jobs arrive in a stream and need to be processed immediately on $n$ identical processors. Find an assignment that balances the workload across processors.
**Centralized controller.** Assign jobs in round-robin manner. Each processor receives at most $\lceil m/n \rceil$ jobs.
**Decentralized controller.** Assign jobs to processors uniformly at random. How likely is it that some processor is assigned "too many" jobs?
**Analysis. (min jobs)**
- Let $X_i$ be number of jobs assigned to processor $i$.
- Let $Y_{ij} = 1$ if job $j$ assigned to processor $i$ and 0 otherwise.
- We have $E[Y_{ij}] = 1/n$.
- Then, $X_i = \sum_{j=1}^{m} Y_{ij}$ and $\mu = E[X_i] = 1$.
- Applying Chernoff bounds with $\delta = c - 1$ yields
$$P(X_i > c) < e^{c^2 / 2c}$$
**Theorem.** Suppose $X_1, \ldots, X_n$ are independent 0-1 random variables. Let $X = X_1 + \ldots + X_n$. Then for any $\mu = E[X]$ and for any $\delta > 0$, we have
$$P(X > (1+\delta)\mu) < e^{\delta \mu / (1+\delta)^2}$$
**Load Balancing: Many Jobs**
**Theorem.** Suppose the number of jobs $m = 16n \ln n$. Then on average, each of the $n$ processors handles $\mu = 16 \ln n$ jobs. With high probability every processor will have between half and twice the average load.
**Pf.**
- Let $X_i$ be as before.
- Applying Chernoff bounds with $\delta = 1$ yields
$$P(X_i > 2\mu) < e^{rac{\mu}{8}}$$
**Fact:** the bound is asymptotically tight: with high probability, some processor receives $\Theta(\log \log n)$ jobs.
**Union bound,** with probability $\geq 1 - 1/n$ no processor receives more than $\theta(n) = \Theta(\log n / \log \log n)$ jobs.
Load Balancing with Asymmetry
Centralized controller. Assign jobs in round-robin manner. Each processor receives at most \( \lceil \frac{m}{n} \rceil \) jobs.
- Suppose each job has cost between 1 and 4
- Round-Robin assignment may be highly unbalanced
- E.g., \( n=4 \) processors: 1,2,3,4,1,2,3,4,...
- Processor 1 total cost: \( \frac{m}{4} \)
- Processor 2 total cost: \( \frac{m}{2} \)
- Processor 3 total cost: \( \frac{3m}{4} \)
- Processor 4 total cost: \( m \)
- Fair: \( \frac{2.5m}{4} \) per processor
Decentralized controller. Assign jobs to processors uniformly at random. How likely is it that some processor is assigned “too many” jobs?
- Still works well in the above scenario (bounded costs)
- Workload on each processor would be \( \approx \frac{2.5m}{4} \) (whp) in above example
Maximum Cut
Maximum cut. Given an undirected graph \( G = (V, E) \) with positive integer edge weights \( w_e \), find a node partition \((A, B)\) such that the total weight of edges crossing the cut is maximized.
\[
W(A, B) = \sum_{u \in A, v \in B} w_{uv}
\]
Toy application.
- \( n \) activities, \( m \) people.
- Each person wants to participate in two of the activities.
- Schedule each activity in the morning or afternoon to maximize number of people that can enjoy both activities.
- Nodes: Activities
- Edge Weights: \( w_{uv} \) = #people who want to participate in both activities
Real applications. Circuit layout, statistical physics.
Maximum Cut: Local Search Analysis
Theorem. Let \((A, B)\) be a locally optimal partition and let \((A^*, B^*)\) be optimal partition. Then \( w(A, B) \geq \frac{1}{2} \sum_{e \in E} w_e \geq \frac{1}{2} w(A^*, B^*) \).
Proof. Local optimality implies that for all \( u \in A \) :
\[
\sum_{v \in B} w_{uv} \leq \sum_{v \in A} w_{uv} = w(A, B)
\]
Adding up all these inequalities yields:
\[
2 \sum_{e \in E} w_{uv} \leq \sum_{u \in A} \sum_{v \in B} w_{uv} = w(A, B)
\]
Similarly,
\[
2 \sum_{e \in E} w_{uv} \leq \sum_{u \in A} \sum_{v \in B} w_{uv} = w(A, B)
\]
Now,
\[
\sum_{e \in E} w_{uv} = \sum_{u \in A} \sum_{v \in B} w_{uv} + \sum_{u \in A} \sum_{v \in A} w_{uv} + \sum_{u \in B} \sum_{v \in B} w_{uv} \leq 2w(A, B)
\]
Maximum Cut: Big Improvement Flips
Local search. Within a factor of 2 for MAX-CUT, but not poly-time!
Big-improvement-flip algorithm. Only choose a node which, when flipped, increases the cut value by at least \( \frac{w(A, B)}{2} \).
Claim. Upon termination, big-improvement-flip algorithm returns a cut \((A, B)\) with \( (2 + \epsilon) w(A, B) \geq w(A^*, B^*) \).
Proof idea. Add \( \frac{w(A, B)}{2} \) to each inequality in original proof.
Claim. Big-improvement-flip algorithm terminates after \( O(\epsilon^{-1} \log W) \) flips, where \( W = \sum_e w_e \).
- Each flip improves cut value by at least a factor of \( 1 + \frac{\epsilon}{2} \).
- After \( k \) iterations the cut value improved by a factor of \( 2^k \).
- Cut value can be doubled at most \( \log W \) times.
\[
f \cdot x \geq 1 \Rightarrow \left(1 + \frac{f}{2}\right)^x \geq 2
\]
Maximum Cut: Context
Theorem. [Sahni-Gonzales 1976] There exists a \( \frac{1}{2} \)-approximation algorithm for MAX-CUT.
- In fact a random cut will cut \( \frac{1}{2} \) of all edges in expectation!
Theorem. [Goemans-Williamson 1995] There exists an 0.878567-approximation algorithm for MAX-CUT.
Theorem. [Håstad 1997] Unless \( P = NP \), no \( 16/17 \) approximation algorithm for MAX-CUT.
12.5 Neighbor Relations
Neighbor Relations for Max Cut
1-flip neighborhood. \((A, B)\) and \((A', B')\) differ in exactly one node.
k-flip neighborhood. \((A, B)\) and \((A', B')\) differ in at most k nodes.
- \( \Theta(nk) \) neighbors.
KL-neighborhood. [Kernighan-Lin 1970]
- To form neighborhood of \((A, B)\):
- Iteration 1: flip node from \((A, B)\) that results in best cut value \((A_1, B_1)\), and mark that node.
- Iteration i: flip node from \((A_{i-1}, B_{i-1})\) that results in best cut value \((A_i, B_i)\) among all nodes not yet marked.
- Neighborhood of \((A, B)\) = \((A_1, B_1), \ldots, (A_{n-1}, B_{n-1})\).
- Neighborhood includes some very long sequences of flips, but without the computational overhead of a k-flip neighborhood.
- Practice: powerful and useful framework.
- Theory: explain and understand its success in practice.
12.3 Hopfield Neural Networks
Hopfield Neural Networks
Hopfield networks. Simple model of an associative memory, in which a large collection of units are connected by an underlying network, and neighboring units try to correlate their states.
Input: Graph \( G = (V, E) \) with integer edge weights \( w \).
Configuration. Node assignment \( s_u = \pm 1 \).
Intuition. If \( w_{uv} < 0 \), then u and v want to have the same state; if \( w_{uv} > 0 \) then u and v want different states.
Note. In general, no configuration respects all constraints.
Def. With respect to a configuration \( S \), edge \( e = (u, v) \) is good if \( w_u s_u s_v < 0 \). That is, if \( w_{uv} > 0 \) then \( s_u = s_v \); if \( w_{uv} < 0 \) then \( s_u \neq s_v \).
Def. With respect to a configuration \( S \), a node \( u \) is satisfied if the weight of incident good edges \( \geq \) weight of incident bad edges.
Def. A configuration is stable if all nodes are satisfied.
Goal. Find a stable configuration, if such a configuration exists.
Hopfield Neural Networks
**Goal.** Find a stable configuration, if such a configuration exists.
**State-flipping algorithm.** Repeatedly flip the state of an unsatisfied node.
```
Hopfield-Flip(G, w) {
S \leftarrow \text{arbitrary configuration}
\text{while (current configuration is not stable)} {
u \leftarrow \text{unsatisfied node}
s_u = -s_u
}
\text{return } S
}
```
**Claim.** State-flipping algorithm terminates with a stable configuration after at most \( W = \sum |w_e| \) iterations.
**Proof attempt.** Consider measure of progress \( \Phi(S) = \# \text{ satisfied nodes} \).
**Conclusion:** Some local flips actually decrease \# satisfied nodes.
### Complexity of Hopfield Neural Network
**Hopfield network search problem.** Given a weighted graph, find a stable configuration if one exists.
**Hopfield network decision problem.** Given a weighted graph, does there exist a stable configuration?
**Remark.** The decision problem is trivially solvable (always yes), but there is no known poly-time algorithm for the search problem.
Dictionary Data Type
Dictionary. Given a universe \( U \) of possible elements, maintain a subset \( S \subseteq U \) so that inserting, deleting, and searching in \( S \) is efficient.
Dictionary interface.
- Create(): Initialize a dictionary with \( S = \emptyset \).
- Insert(u): Add element \( u \in U \) to \( S \).
- Delete(u): Delete \( u \) from \( S \), if \( u \) is currently in \( S \).
- Lookup(u): Determine whether \( u \) is in \( S \).
Challenge. Universe \( U \) can be extremely large so defining an array of size \(|U|\) is infeasible.
Applications. File systems, databases, Google, compilers, checksums, P2P networks, associative arrays, cryptography, web caching, etc.
Hashing
Hash function. \( h : U \rightarrow \{0, 1, \ldots, n-1\} \).
Hashing. Create an array \( H \) of size \( n \). When processing element \( u \), access array element \( H[h(u)] \).
Collision. When \( h(u) = h(v) \) but \( u \neq v \).
- A collision is expected after \( \Theta(\sqrt{n}) \) random insertions. This phenomenon is known as the "birthday paradox."
- Separate chaining: \( H[i] \) stores linked list of elements \( u \) with \( h(u) = i \).
Ad Hoc Hash Function
Ad hoc hash function.
```java
int h(String s, int n) {
int hash = 0;
for (int i = 0; i < s.length(); i++)
hash = (31 * hash) + s[i];
return hash % n;
}
```
Deterministic: If \(|U| \geq n^2\), then for any fixed hash function \( h \), there is a subset \( S \subseteq U \) of \( n \) elements that all hash to same slot. Thus, \( h(n) \) time per search in worst-case.
Challenge. But isn’t ad hoc hash function good enough in practice?
Hashing Performance
Idealistic hash function. Maps \( m \) elements uniformly at random to \( n \) hash slots.
- Running time depends on length of chains.
- Average length of chain = \( a = m / n \).
- Choose \( n = m \Rightarrow \) on average \( O(1) \) per insert, lookup, or delete.
Challenge. Achieve idealized randomized guarantees, but with a hash function where you can easily find items where you put them.
Approach. Use randomization in the choice of \( h \).
Adversary knows the randomized algorithm you’re using, but doesn’t know random choices that the algorithm makes.
Algorithmic Complexity Attacks
When can’t we live with ad hoc hash function?
- Obvious situations: aircraft control, nuclear reactors.
- Surprising situations: denial-of-service attacks.
Real world exploits. [Crosby-Wallach 2003]
- Bro server: send carefully chosen packets to DOS the server, using less bandwidth than a dial-up modem.
- Perl 5.8.0: insert carefully chosen strings into associative array.
- Linux 2.4.20 kernel: save files with carefully chosen names.
Universal Hashing
Universal class of hash functions. [Carter-Wegman 1980s]
- For any pair of elements \( u, v \in U \), \( Pr_{h \in H} [ h(u) = h(v) ] \leq 1/n \).
- Can select random \( h \) efficiently.
- Can compute \( h(u) \) efficiently.
Ex. \( U = \{a, b, c, d, e, f\}, n = 2 \).
<table>
<thead>
<tr>
<th>a</th>
<th>b</th>
<th>c</th>
<th>d</th>
<th>e</th>
<th>f</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>1</td>
<td>0</td>
<td>1</td>
<td>0</td>
<td>1</td>
</tr>
<tr>
<td>0</td>
<td>1</td>
<td>0</td>
<td>1</td>
<td>0</td>
<td>1</td>
</tr>
</tbody>
</table>
```
```
Universal Hashing
Universal hashing property. Let \( H \) be a universal class of hash functions; let \( h \in H \) be chosen uniformly at random from \( H \); and let \( u \in U \). For any subset \( S \subseteq U \) of size at most \( n \), the expected number of items in \( S \) that collide with \( u \) is at most 1.
\[
Pf. \text{ For any element } s \in S, \text{ define indicator random variable } X_s = 1 \text{ if } h(s) = h(u) \text{ and } X_s = 0 \text{ otherwise. Let } X = \text{a random variable counting the total number of collisions with } u.
\]
\[
E_{h \in H}[X] = E \left[ \sum_{s \in S} X_s \right] = \sum_{s \in S} E[X_s] = \sum_{s \in S} \Pr[X_s = 1] \leq \frac{|S|}{n} \leq 1 \\
\text{linearity of expectation, } X_s \text{ is a 0-1 random variable}
\]
Designing a Universal Class of Hash Functions
Theorem. \( H = \{ h_a : a \in A \} \) is a universal class of hash functions.
\[
Pf. \text{ Let } x = (x_1, x_2, \ldots, x_r) \text{ and } y = (y_1, y_2, \ldots, y_r) \text{ be two distinct elements of } U. \text{ We need to show that } \Pr[h_a(x) = h_a(y)] \leq 1/n.
\]
- Since \( x = y \), there exists an integer \( j \) such that \( x_j \neq y_j \).
- We have \( h_a(x) = h_a(y) \) iff
\[
a_j(y_j - x_j) = \sum_{i \neq j} a_i (x_i - y_i) \quad \text{mod } p
\]
- Can assume \( a \) was chosen uniformly at random by first selecting all coordinates \( a_i \) where \( i = j \), then selecting \( a_j \) at random. Thus, we can assume \( a_j \) is fixed for all coordinates \( i \neq j \).
- Since \( p \) is prime, \( a_j z \equiv m \text{ mod } p \) has at most one solution among \( 0 \leq z < p \).
- Thus \( \Pr[h_a(x) = h_a(y)] = 1/p < 1/n \).
|
{"Source-Url": "https://www.cs.purdue.edu/homes/jblocki/courses/580_Spring19/Lectures/CS580-Lecture27RandomizedAlgorithms.pdf", "len_cl100k_base": 4890, "olmocr-version": "0.1.49", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 26500, "total-output-tokens": 5471, "length": "2e12", "weborganizer": {"__label__adult": 0.0004968643188476562, "__label__art_design": 0.0005002021789550781, "__label__crime_law": 0.0008258819580078125, "__label__education_jobs": 0.0010614395141601562, "__label__entertainment": 0.00016057491302490234, "__label__fashion_beauty": 0.0001881122589111328, "__label__finance_business": 0.0004835128784179687, "__label__food_dining": 0.0006699562072753906, "__label__games": 0.0008487701416015625, "__label__hardware": 0.003894805908203125, "__label__health": 0.0013456344604492188, "__label__history": 0.00046324729919433594, "__label__home_hobbies": 0.0002810955047607422, "__label__industrial": 0.001354217529296875, "__label__literature": 0.0005421638488769531, "__label__politics": 0.0003604888916015625, "__label__religion": 0.0006856918334960938, "__label__science_tech": 0.436767578125, "__label__social_life": 0.00014710426330566406, "__label__software": 0.01035308837890625, "__label__software_dev": 0.537109375, "__label__sports_fitness": 0.0003921985626220703, "__label__transportation": 0.0007658004760742188, "__label__travel": 0.00026917457580566406}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 14692, 0.01681]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 14692, 0.58896]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 14692, 0.74197]], "google_gemma-3-12b-it_contains_pii": [[0, 1409, false], [1409, 3451, null], [3451, 6510, null], [6510, 8816, null], [8816, 9904, null], [9904, 13008, null], [13008, 14692, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1409, true], [1409, 3451, null], [3451, 6510, null], [6510, 8816, null], [8816, 9904, null], [9904, 13008, null], [13008, 14692, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 14692, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 14692, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 14692, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 14692, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 14692, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 14692, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 14692, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 14692, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 14692, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, true], [5000, 14692, null]], "pdf_page_numbers": [[0, 1409, 1], [1409, 3451, 2], [3451, 6510, 3], [6510, 8816, 4], [8816, 9904, 5], [9904, 13008, 6], [13008, 14692, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 14692, 0.01739]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
dbc503086dbc10422dc989408752d9bb818e6024
|
Analyzing Dynamic Task-Based Applications on Hybrid Platforms: An Agile Scripting Approach
Vinicius Garcia Pinto, Luka Stanisic, Arnaud Legrand, Lucas Mello Schnorr, Samuel Thibault, Vincent Danjean
To cite this version:
HAL Id: hal-01353962
https://inria.hal.science/hal-01353962v2
Submitted on 17 Jul 2018
HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers. L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.
Distributed under a Creative Commons Attribution 4.0 International License
Analyzing Dynamic Task-Based Applications on Hybrid Platforms: An Agile Scripting Approach
Vinícius Garcia Pinto†∗, Luka Stanisic†, Arnaud Legrand‡,
Lucas Mello Schnorr∗, Samuel Thibault†, Vincent Danjean‡
† Institute of Informatics, Federal University of Rio Grande do Sul – UFRGS, Porto Alegre, Brazil
‡CNRS – Univ. Grenoble Alpes, France
Abstract—In this paper, we present visual analysis techniques to evaluate the performance of HPC task-based applications on hybrid architectures. Our approach is based on composing modern data analysis tools (pjdump, R, ggplot2, plotly), enabling an agile and flexible scripting framework with minor development cost. We validate our proposal by analyzing traces from the full-fledged implementation of the Cholesky decomposition available in the MORSE library running on a hybrid (CPU/GPU) platform. The analysis compares two different workloads and three different task schedulers from the StarPU runtime system. Our analysis based on composite views allows to identify allocation mistakes, priority problems in scheduling decisions, GPU tasks anomalies causing bad performance, and critical path issues.
I. INTRODUCTION
To fulfill the ever-growing need for computation power of High-Performance Computing (HPC) applications, it has become common to rely on hybrid nodes, composed of multi-core processors (CPUs) with multiple accelerators (GPUs). However, due to the heterogeneity and complexity of such machines, achieving portable and scalable performance has become extremely challenging. A possible solution, increasingly used by the community, is to program the application at a high level, independently of the hardware architecture, as a Directed Acyclic Graph (DAG) of tasks. It is then the responsibility of another software layer, called the runtime, to dynamically schedule the resulting tasks on the different computing resources taking into account the possible speed heterogeneity and variability as well as to automatically take care of data movements between resources. This allows removing artificial synchronizations from the application code, implementing complex scheduling and data movement algorithms (such as HEFT [1]) that would be hard to manually incorporate in the application. Thanks to dynamic decisions, the irregular behavior of applications and resources is absorbed and exploited by the scheduler during execution, effectively balancing the load among computing resources.
Task-based executions on hybrid platforms are inherently stochastic. Task mapping, for instance, can drastically change from one execution to another. From the performance analysis perspective, the nature of such opportunistic execution schemes makes classical performance analysis, which expects regularity and highlights heterogeneity, invariably ineffective. At the same time, application and runtime developers seek to understand the attained performance to improve the application design and scheduling decisions. This investigation is challenging because it is hard to compare many traces when parameters affecting task creation and scheduling change.
In this article, we explain how we designed a framework that enables an easy and faithful identification of subtle scheduling problems that would otherwise go unnoticed and misunderstood with classical trace visualization approaches. We built the framework on top of modern data analytics tools, combining the R programming language (and in particular the ggplot2 library) and org-mode [2]. The tool combination comes at a very low development cost when compared to a traditional and monolithic performance visualization tool. The designed views depict task execution along time for each resource, automatically detecting several interleaving critical paths in traces. We demonstrate the effectiveness of our visualization approach by analyzing traces from the dense linear algebra Cholesky factorization of the Chameleon/MORSE package [3], implemented using the StarPU task-based runtime [4]. Two representative factorization workloads are carried out on a hybrid multi-core/multi-GPU architecture. The large workload brings interesting insights on pinpointing resource usage mistakes and comparing three StarPU schedulers (DMDA, DMDAS and Work Stealing). The smaller workload shows that the dynamic critical path analysis provides hints for optimizations.
Section [I] provides some background on task-based runtimes for hybrid platforms and on the Cholesky algorithm. Section [II] presents some related work on trace visualization, motivating our own study. Section [III] presents our trace visualization proposal for the performance analysis of task-based runtimes. In Section [IV] we detail two case studies demonstrating the effectiveness of our visualization strategy. Section [V] gives a summary of results and future work.
II. BACKGROUND AND EXPERIMENTAL CONTEXT
Traditional bulk-synchronous parallel (BSP) applications, made of supersteps (computation, communication, barrier), is a very common design when computing resources are homogeneous. The trend towards heterogeneous resources with accelerators, such as GPUs, makes the task-based programming paradigm much more suitable. Depending on the sophistication of the runtime scheduling algorithms, applications can more or less efficiently exploit heterogeneous configurations.
Several runtimes targeting hybrid platforms have been developed in the recent years. MAGMA [5], for instance, com-
1Code available at [http://perf-ev-runtime.gforge.inria.fr/vpa2016/]
bines multi-core with GPUs for linear algebra applications. OmpSs [6] provides an extension to OpenMP tasks through new directives that allow supporting multi-core systems combined with GPUs. PaRSEC [7] is a generic framework for architecture aware scheduling of tasks on many-core heterogeneous clusters. StarPU [3] is a task parallelism runtime initially designed to exploit hybrid architectures and additionally providing an MPI-based extension [8] to exploit several nodes at once. Dense/sparse linear algebra have been among the first applications to exploit such runtimes but other applications have been also implemented, such as FEM applications [9], seismic wave modeling [10], and others [11], [12].
Experimental Context and Workload Details: We propose to build on a relatively representative use case to address the lack of adequate visualization tools for task-based applications. We use traces of the dense linear algebra Cholesky factorization, more specifically of the full-fledged implementation from the MORSE library [3], compiled with the CUBLAS kernels. A simplified version of this application is shown in Figure 1a and the corresponding DAG for a 5 × 5 matrix size is shown on its right (Figure 1b). For each step k of the outer loop, one dpotrf task releases N−k dtrsm and dsyrk tasks, followed by ∼(N−k)²/2 dgemm tasks. The dependencies indicate that simultaneous execution of several iterations is possible and that the iteration size decreases at the same time as k increases. So, the potential parallelism gets reduced as the algorithm advances (see the DAG of the figure). Finally, the task’s execution time highly depends on the task (dpotrf, dtrsm, dsyrk, and dgemm) and resource types (CPU or GPU). We have used the CUBLAS without the dpotrf code. Hence, dpotrf tasks can only be run on CPUs.
```c
for (k = 0; k < N; k++) {
dpotrf(RW,A[k][k]);
for (i = k+1; i < N; i++)
dtrsm(RW,A[i][k], RW,A[i][i]);
dsyrk(RW,A[i][i], RW,A[i][k]);
for (j = k+1; j < N; j++)
dgemm(RW,A[i][j], RW,A[i][k], RW,A[j][j]);
}
```
(a) The Cholesky Algorithm. (b) Corresponding DAG for N = 5.
Fig. 1: The Cholesky code and its DAG (for N = 5).
Since hybrid heterogeneous nodes motivate the development of task-based runtimes, we execute this Cholesky implementation on IdCin2, a machine with two 14-core Intel(R) Xeon(R) CPU E5-2697v3@2.6GHz and three NVIDIA Titan X. From this set of resources, only 25 CPU cores participate in the computation because it is generally more efficient to let StarPU dedicate one core to manage each GPU. StarPU provides several scheduling algorithms that exploit both the DAG structure (through critical-path based heuristics) and performance models. Here, we focus on three of them.
The DMDA (Deque Model Data Aware) scheduler is a list scheduler, i.e., every time a resource is idle, if a task is ready, it will be scheduled on this particular resource. Such a scheduler therefore never leaves a resource idle on purpose, which ensures the well-known (2−1/p) competitive ratio for homogeneous machines [13]. Deciding which ready task to select has a major influence in practice and the classical heuristic consists of prioritizing tasks based on the critical path. However, the critical path notion is dynamic and obtaining a proper estimation can be quite challenging. With heterogeneous computing resources, such prioritization is generally done with variants of the HEFT (Heterogeneous Earliest Finish Time) strategy [1]. The DMDA algorithm is a very greedy heuristic that schedules tasks in the order they become available, without taking critical path priorities into account. However, it considers data transfer time between CPUs and GPUs as well as the relative performance of resources on each computation kernel when taking its decision. The DMDAS (Deque Model Data Aware Sorted) scheduler is similar to the first strategy, except that it sorts tasks by priority, which can be expensive when the number of tasks is large. It is therefore rather close to the original HEFT algorithm by respecting priorities and taking past scheduling decisions into account. Finally, the WS (Work Stealing) scheduler uses a queue per worker; new tasks are kept local by default. When a worker is idle, it steals tasks from the most loaded worker.
The next section presents related work on performance analysis for BSP and DAG-based HPC programming models. We detail the issues of current solutions, motivating our work.
III. RELATED WORK AND MOTIVATION
Despite the plethora of runtimes to execute task-based applications on heterogeneous resources (see Section II), there are very few established tools to conduct a proper task-aware analysis. Developers usually rely on BSP-based trace visualization tools, whose objectives are different, seeking unexpected heterogeneity where regular, homogeneous behavior is normal. Such tools are therefore unsuitable for visualizing task execution behavior since heterogeneity is the expected scenario for task-based applications. We briefly detail trace visualization strategies for BSP and DAG-based applications to better understand their differences. We also describe the design challenges of novel trace visualization techniques for DAG applications, as well as the typical questions usually raised during the analysis process.
A. Trace visualization analysis for BSP-based applications
Many tools exist to visualize traces from BSP-based applications. Most are focused on MPI applications. The common technique is based on Gantt charts, depicting each thread behavior along time. Behavior is drawn using colors to represent different thread states e.g., MPI operation. Message-passing is depicted with arrows from source to destination, sometimes annotated with the amount of transferred data. Vite [14] is an OpenGL-based open-source tool that has such a view, capable to visualize large traces with thread states and communication. Since this tool relies on the semantic-free Paje language [15], it can depict virtually any kind of traces. Paraver [16] is another open-source Gantt tool that allows filtering, zooming,
and graphical trace aggregation. Its trace format supports many HPC programming models. Vampir [17] is a proprietary tool with multiple views for OTF2 traces. It is more scalable than similar tools due to its distributed organization.
B. Visualizing task execution traces from DAG applications
There are a few tools to perform analysis and visualization of task-based executions. Typically, they are built with resources not designed for data analysis and rely on either non-scalable or non-scriptable strategies i.e., with mouse pointer interaction. DAGViz [18] offers a visual representation of task-based executions focusing on the DAG structure, which is retrieved using macros (translated to Cilk, Intel TBB or OpenMP) and presented in a hierarchical way. The resulting DAG can be folded/unfolded on-demand to show details and the node color indicates where they are executed. There is no way to retrieve the time dimension and task duration, which can make performance analysis difficult. Temeanjoe [19] provides a similar timeless DAG interactive views for many task-based runtimes. Its main features are the debug capabilities, e.g., the user can put a breakpoint in a task and fix its dependencies. These capabilities are very useful during algorithm design on small scale, being unsuited for performance analysis. Haugen et al. proposes an interactive Gantt chart enhanced with dependencies, drawn as edges between tasks [20]. We believe this approach suffers from three issues. First, in term of scalability, since (e.g., in Cholesky) tasks typically have many (∼N) dependencies, drawing everything and finding interesting tasks and dependencies only through mouse interaction can be very tedious. In practice, only tasks belonging to the critical path are important. Second, only one-level dependencies are depicted, while several levels are required to understand the history leading to the scheduling problem. Third, this tool does not really exploit the heterogeneity of resources.
C. Challenges of DAG execution traces analysis
The performance analysis of task-based applications raises many challenges. The stochastic behavior of scheduling decisions induced by actual resource availability and by the task execution variability hinders the performance reproducibility. Moreover, executions are apparently unstructured, with no clear phases as in the BSP model. At the same time, task dependencies are part of the application and should be exploited by the analyst to understand bottlenecks.
Traces are generally much larger than the available screen space and naively displaying everything generally leads to biased views [21]. One, therefore, has to use selection schemes to show only data that is fully relevant from the analysis point of view. In such complex execution traces, many hypotheses (and thus filters) can be proposed regarding the expected behavior. Developing a monolithic tool, such as the ones tailored for BSP analysis, that anticipates all possible performance problems is thus impractical. Moreover, such tool would be quite difficult to maintain and customize. A more flexible solution with scripting capability is thus needed.
During the analysis of DAG traces, the typical questions that arise are different from those of BSP applications. Instead of inspecting whether and why a certain algorithm iteration or phase was slowed down, one needs to analyze if the tasks were properly scheduled and if sufficient parallelism is available. One also needs to examine whether complex data movement techniques, task submission, and many internal runtime mechanisms can be further improved.
A common approach to better understand the application behavior is to compare several execution traces, possibly each one with a different configuration (e.g., scheduling parameter). However, due to the dynamic scheduling, this is generally difficult for task-based traces. To draw relevant conclusions, one needs to synchronize multiple visualizations and filter the unwanted states. Although some support exists in some tools [16], [22], they do not offer enough customization flexibility for such studies.
The next section details our proposal to visualize task-based application traces. It tackles some of the preceding challenges with a framework that combines data analytics tools to create a flexible environment enabling customized analysis.
IV. Visualization Methodology
Visualizing data allows to graphically check many assumptions at once. It helps with assumptions that are difficult to formally state or for which defining a proper statistical test would require building on even more hypothesis that would also have to be verified. This is why it is important to start by listing various hypothesis (or expectations) made on the system under study. From such list, a set of visualizations can be generated. We propose visualizations that are designed for the application and scheduler developers, assisting them to rapidly identify performance issues as well as potential solutions.
The set of hypothesis to check is fairly rich in heterogeneous platforms targeted by task-based runtime systems. It is thus important to build a visualization framework that allows to easily and rapidly combine various views and propose new alternative views in an agile way. Moreover, since dynamic scheduling and machine heterogeneity bring a lot of variabilities, the ideal visualization should exploit any potential regularity coming from the application algorithm. For example, as we have seen in Figure 1, each task can be identified by the loop indices i, j, k. Such kind of information is much more useful than the internal runtime task identification and should thus be provided by the application to the runtime so that it can be traced and further exploited during the visualization.
To meet these different design goals, we decided to use the workflow shown in Figure 2. With few modifications on MORSE, tracing is extended to tag tasks with loop indexes at the task creation. StarPU relies on FXT [23] traces to produce timestamped events in the Paje language [15]. A complete DAG is also created with task identifiers coherent with the Paje trace. Instead of building a complex monolithic tool, we follow the UNIX philosophy and script many small tools. Using pjdump, the paje trace is converted into a Comma-Separated Values (CSV) file that can be loaded into R. Thanks to the
expressiveness and to the rich set of statistical libraries of the R language, many cleanups, filtering, statistic computations, and adaptation to another application than Cholesky can be done with few lines of code. The ggplot2 library provides a grammar of graphics and a very high-level way of building plots, enabling us to easily produce custom visualizations. This environment has enough expressiveness to guarantee different but coherent views (colors, scales, etc.).
We fully analyze two very different Cholesky workloads in the rest of this paper: large (60 × 60 tiles of size 960 × 960) and small matrices (12 × 12 tiles, same size). For each, we detail the expected behavior, then propose composite views allowing to check these expectations. The views are then exploited to compare the three aforementioned StarPU schedulers, enabling us to propose potential improvements.
A. Large Workload (Cholesky of 60 × 60 tiles of size 960 × 960)
1) Expectations: Uniformity. Task duration is expected to depend solely on their type (dgemm, dsyrk, dtrsm or dpotrf) and on the type of resource (CPU or GPU) on which it is executed. Such assumption should be visually verified, highlighting all tasks whose duration is abnormally large compared to the others of the same type/resource. We treat these tasks as independent outliers, unrelated to other tasks behavior. If not so, it may mean that the whole platform has been perturbed at particular moments or that some resource differs from the others. A task is anomalous if its duration exceeds the sampled third quartile plus 1.5 times the sampled interquartile range. Although this outlier notion is highly debatable and context-specific, other definitions could be easily incorporated.
Dependency problems. Large input matrices generate many tasks, especially when the application starts. We, therefore, want to monitor the number of ready and submitted tasks. For this Cholesky implementation, all tasks are expected to be submitted when the application starts. On scale, the number of task dependencies is extremely large. Automatically selecting which ones to display is haphazard. If a detailed view becomes necessary, we should switch to views described in Section V-B.
Progress. The task graph resulting from dense linear algebra always share a common structure (for instance, see Figure 1). In a classical semi-sequential execution, the DAG would be executed much similarly to a breadth-first search. However, it is also possible to carry out a depth-first traversal, favoring task execution on the critical path. Following the pipelining of the sets of tasks submitted by each outer loop iteration can be sufficient to get an overview of how the scheduler is handling the DAG and if it corresponds to the analyst’s intuition or not.
Potential improvements. Dependencies are expected to be easily handled with large workloads. The major issue is the load balancing among CPUs and GPUs. Since one knows the average time \( w_{i,k} \) needed to perform a task of type \( k \) on a resource of type \( i \) as well as the total number \( n_k \) of tasks per type, one can consider that a fraction \( \alpha_{i,k} \) of tasks of type \( k \) will be done on resource \( i \) and that the \( \alpha_{i,k} \) should thus verify:
\[
\forall i : \sum_k \alpha_{i,k} w_{i,k} n_k \leq T
\]
Since such constraints are linear it is possible to compute the optimal makespan \( T \) and allocation \( \alpha_{i,k} \). The \( T \) value is called the Area Bound Estimation (ABE) and is a lower bound for the execution time. Another classical lower bound is the Critical Path Bound Estimation (CPE). It is obtained by assigning each task to its faster processing resource and by summing all durations along the DAG. These execution time bounds, in particular, the ABE when the workload is large,
are quite useful to estimate how much further improvement can be expected. More accurate lower bounds could be used as well, in particular for intermediate size workloads. Moreover, an ideal task allocation is also computed when ABE is defined. Comparing the ideal with the actual allocation may help understanding how scheduling could be improved.
2) Composite View for Pinpointing Scheduling Mistakes: Building on the expectations, we propose a five-area composite view shown in Figure 3 (each area is detailed in the caption).
We see in Figure 3 (a) that the makespan is 62725ms while the ABE is 59464ms. So, one can hope for a 5% improvement. The scheduling seems indeed inefficient since there are periods (white areas in CPUs) when no useful computation is done. These periods correspond to filtered states (for clarity) where threads try to actively fetch data. The total idle state (yellow areas: a summary in the right of the Gantt) for CPUs is about 1%, while for GPUs it ranges from 2 to 6%. This GPU inactivity is likely the main source of potential improvement. From (c), it is clear that this idle time does not come from a sudden lack of ready tasks. Figure 3 (d) clearly indicates that all tasks have been submitted in the beginning and that task execution started immediately after, without waiting for fully unrolling the DAG. As suggested in (b), DAG traversal is rather depth-first. Many outer loop iterations are parallel (the maximum is 30 around 40s), explaining why there are always a sufficient number of ready tasks.
Such GPUs starvation is more likely explained either by data prefetching problem (some tasks are ready but their input data is not yet transferred to GPUs) or possibly by some priority issue (the priorities, used by the scheduler to choose which task to run first when several of them are ready, might be inadequate). The first reason is likely to be the right one here. Indeed, most large idle periods on GPUs and large periods of times where CPUs are not doing useful computations (in white) also coincide with abnormal dgemm tasks (in dark green) on GPUs. Note that the scripting feature allow us to show only tasks of a given type, resource, within a specific time interval, and whose duration is larger than a threshold and therefore clear any doubt the analyst may have. An investigation (such as the one of Section V-B) reveals that, for an unknown reason, the GPUs seem to freeze during a task execution inside the proprietary CUBLAS dgemm kernel, ultimately blocking tasks eagerly waiting for GPU data. Understanding why GPUs sometimes get stuck would certainly solve the issue but this clearly suggests a weakness of the chosen scheduler which assumes that tasks duration have small variability. Using other schedulers may, therefore, alleviate this.
The four plots depicted in Figure 3 (e) show the ideal allocation when calculating the ABE. They show how the GPUs have been overused with dgemm tasks and under-exploited for dsyrk and dtrsm tasks. It, therefore, suggests constraining the dsyrk and dtrsm tasks to run exclusively on GPUs.
3) Comparing Scheduling Strategies and Task Constraints: The previous analysis leads us to vary the scheduler (DMDA, DMDAS, WS) and to force or not the dsyrk/dtrsm allocation on GPUs. Figure 4 provides the six-scenario comparison.
First of all, it is interesting to see how the three schedulers differ in their DAG traversal of the DAG. While the DMDA algorithm has a breath-first traversal (very few iterations of the outer loop are active at the same time), the DMDAS has a much more depth-first traversal as it takes the priority of the critical path into account. The traversal of the Work...
Stealing (WS) is even more depth-first as almost all outer loop iterations are still in progress at the end of the execution. Such way of progressing through the DAG is typical of WS and somehow favors local data accesses even though the algorithm is more dependency myopic than the two other ones.
Second, when constraining the dsyrk and dtrsm to run solely on the GPUs (the plots on the bottom row of Figure 4), task allocation corresponds to the ideal one. However, while such constraint allows both DMDAS and Work Stealing to obtain near optimal executions (within less than 2% of the lower bound), it helped only moderately the DMDA algorithm. Many synchronized idle phases can be observed and imputed to both dependency issues (not enough parallelism is obtained from such a strict breadth-first traversal) and particularly slow tasks (probably slowed down by simultaneous data transfers). Interestingly, very few outlier tasks appear in the DMDAS and WS executions although the latter still seems a bit sensitive to this, as inactivity periods on CPUs (white areas) still correlate with the occurrence of dgemm outliers (darker green) on GPUs.
Finally, we stress that such observations are no coincidence. We randomly ran similar scenarios ten times and although the numbers always slightly differ, the general behavior and conclusions are the same. We also highlight that the area bound estimations (ABE) can vary significantly between two scenarios (e.g., 60s for constrained DMDA vs. 57s for constrained WS), which can be initially surprising since these estimates only depend on the number of tasks and their per-type average execution time on the different resources. The observations can be explained by the use of sample execution time mean, which may vary a bit. From our investigation, this variation is not explained by outliers occurrence but rather biased toward one or another scheduler. We think this is the consequence of a better locality (cache usage) but more complex measurements would be needed to fully evaluate this hypothesis.
B. Small Workload (Cholesky of 12×12 tiles of size 960×960)
1) Expectations: Potential Improvements. The area bound (ABE) is optimistic for small workloads since it ignores task dependencies. The critical path bound (CPE) is much more relevant, especially on very small workloads such as this one. Still, knowing how tight they are is quite difficult. Thus, comparing to the ideal CPU/GPU allocation is meaningless and we should focus mainly on filtering task dependencies.
Idle time everywhere. Having a lot of idle time is expected because of dependencies. It is thus imperative to identify crucial tasks, highlighting the “dynamic critical path”, i.e., the last tasks upon which they depended on. Such important tasks may appear either because of the DAG structure or because they have been particularly delayed.
2) Backtrack Dependencies to Pinpoint Scheduling Mistakes: Since StarPU also exports the DAG, the dependency information can be merged into the trace. For Cholesky, the dpotrf are critical tasks that release many other tasks. It seems, therefore, relevant to track their dependencies. For a given task Ti, it is possible to compute what was the task Tj−1
on which it depends on and that finished the latest, similarly, for \(T_{i−1}\) its latest predecessor \(T_{i−2}\), etc. Such backward tracking of dependencies allows rebuilding the observed critical path. Given the DAG, in an ideal execution one would expect a \(\text{dpotrf}\) to be immediately preceded by a \(\text{dsyrk}\), immediately preceded by a \(\text{dtrsm}\) that would, in turn, be immediately preceded by the \(\text{dpotrf}\) of the previous iteration. Therefore, we compute such filtered backward dependencies for each \(\text{dpotrf}\) and merge them together.
This is illustrated in Figure 5. The makespan is 730ms while the ABE is 434ms and the CPE is 368ms. The bounds may be loose but it seems that there is room for improvement. If we start from the end of the schedule and go backward in time, we can see a dependency path (in blue) that, until timestamp 400ms, fully respects the alternation \(\text{dpotrf}−\text{dsyrk}−\text{dtrsm}\). At the very end, all tasks execute right one after the other, which is optimal. The first “mistake” appears in time 600ms where the \(\text{dsyrk}\) could have been executed a little earlier. Slightly before, some \(\text{dtrsm}\) are not executed right after their \(\text{dpotrf}\) maybe because of data transfer or more likely because of a wrong priority. This critical path does not merge with the one obtained for the \(\text{dpotrf}\) of the first iterations. Now, when looking at the other (red) dependency path, we can see many times that the tasks are scheduled as soon as possible as if there was some priority problem, which could possibly be solved with another scheduler. The scripting feature allows plotting only dependencies whose duration is larger than a given threshold, avoiding graphical clutter.
We identify another problem with the blue dependency path. At the end, tasks are executed on the appropriate resource (\(\text{dpotrf}\) on CPUs, and \(\text{dsyrk}\) and \(\text{dtrsm}\) on GPUs). However, slightly before time 600ms, critical \(\text{dsyrk}\) tasks start running on the CPUs, slowing the progression. Likewise, slightly before time 400ms, critical \(\text{dtrsm}\) tasks are run on CPUs whereas they are known to be very slow on such resources. It seems that this scheduler makes a bad decision and that constraining \(\text{dtrsm}\) and \(\text{dsyrk}\) to be executed on GPUs may reduce the total makespan. Although the potential solutions (fix priority, constraining some tasks to GPUs) suggested by this analysis are the same as in the previous use case, the underlying reasons are fundamentally different.
3) Comparing Scheduling Strategies and Task Constraints: Based on the previous analysis, we vary again the three schedulers and forcing \(\text{dsyrk}/\text{dtrsm}\) tasks on GPUs. Figure 6 compares the six resulting combinations for this workload.
By taking a closer look at the unconstrained top row of Figure 6, we can observe that the behavior demonstrated by the DMDA and DMDAS schedulers are not so different. They both have similar runtime, two unmerged critical paths on which priority and critical task allocation problems can be identified. WS also demonstrates a very bad allocation, which is not surprising because it does not take into account the heterogeneity of the platform. There are three dynamic critical paths in the WS scheduler, with many \(\text{dtrsm}\) and \(\text{dsyrk}\) running on CPUs. When constraining these two task types to execute only on GPUs (the bottom row of Figure 6), we observe that such restriction does not really help for the DMDA and DMDAS schedulers. Tasks on the critical path are no longer an issue, but both schedulers still have priority problems. The behavior demonstrated by DMDA seems easier to understand: we see some typical list scheduling behavior with critical \(\text{dpotrf}\) being delayed because CPUs are used for not so critical \(\text{dgemms}\). If one could run these tasks earlier, it appears that the whole makespan would be greatly improved.
Surprisingly, Work Stealing strongly benefits from the imposed restriction and now favorably compares against DMDA and DMDAS. It is also interesting to note that WS manages to keep all CPUs busy from the very beginning, unlike the other two schedulers. However, GPUs are not fully exploited, in particular at the end where they should be used to accelerate the \(\text{dgemms}\) like the DMDA and DMDAS strategies do. If there was a way to prevent \(\text{dgemm}\) task execution on CPU after time 350ms, we would probably get the best of the two scheduling strategies and be much closer to the optimal execution time.
VI. CONCLUSION
This article presents how an agile scripting framework allows creating faithful and enlightening trace views for the performance analysis of task-based HPC applications running on heterogeneous platforms. The framework follows the UNIX philosophy and builds upon many small existing tools (pjdump, ggplot2, plotly) glued together with the R programming language. Putting interaction at the very end together with scripting capabilities in the core of the analysis process is the key to a flexible design. We have shown how applying this framework in the analysis of large and small scale scenarios based on the MORSE/StarPU implementation of the Cholesky factorization allows to identify and address several non-trivial scheduling problems. The approach has scalability limitations mostly in the graphical representations (static or interactive) and not the scripting methodology for creating them. Plotly, for instance, is incapable of handling too much data, such as when there are many task types or resources.
As future work, we intend to improve the interactive graphical views by using temporal aggregation to reduce trace size and improve the integration between performance visualization...
and runtime debugging. We also intend to extend this approach to analyze the behavior of irregular task-based workloads \cite{25}.
Acknowledgements: This work was supported by the projects: CAPES/Cofecub 764-13, FAPERGS/Inria ExaSE, CNPq 447311/2014-0, HPC4E 689772 from EU/H2020 and MCTI/RNP-Brazil, and the CNRS/LICIA Intl. Lab. We also thank Emmanuel Agullo, Lionel Eyraud-Dubois, and Suraj Kumar for their help in better understanding the traces and the visualization needs of the runtime scheduler developers.
REFERENCES
\cite{19} R. Keller, S. Brinkmann, J. Gracia, and C. Niethammer, Temanejo: Debugging of Thread-Based Task-Parallel Programs in StarSS. Springer, 2012, pp. 131–137.
|
{"Source-Url": "https://inria.hal.science/hal-01353962/file/vpa2016-submitted.pdf", "len_cl100k_base": 7574, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 32896, "total-output-tokens": 10172, "length": "2e12", "weborganizer": {"__label__adult": 0.0003681182861328125, "__label__art_design": 0.0005574226379394531, "__label__crime_law": 0.00040650367736816406, "__label__education_jobs": 0.0011262893676757812, "__label__entertainment": 0.0001665353775024414, "__label__fashion_beauty": 0.00020933151245117188, "__label__finance_business": 0.00048470497131347656, "__label__food_dining": 0.0003304481506347656, "__label__games": 0.0007495880126953125, "__label__hardware": 0.002658843994140625, "__label__health": 0.0006070137023925781, "__label__history": 0.0005640983581542969, "__label__home_hobbies": 0.00015223026275634766, "__label__industrial": 0.0009279251098632812, "__label__literature": 0.00030875205993652344, "__label__politics": 0.0004620552062988281, "__label__religion": 0.0006299018859863281, "__label__science_tech": 0.42333984375, "__label__social_life": 0.00014460086822509766, "__label__software": 0.0161590576171875, "__label__software_dev": 0.5478515625, "__label__sports_fitness": 0.00037980079650878906, "__label__transportation": 0.001033782958984375, "__label__travel": 0.0002722740173339844}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 41935, 0.02668]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 41935, 0.33276]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 41935, 0.90188]], "google_gemma-3-12b-it_contains_pii": [[0, 1266, false], [1266, 6809, null], [6809, 12951, null], [12951, 19377, null], [19377, 23226, null], [23226, 26922, null], [26922, 30156, null], [30156, 36021, null], [36021, 41935, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1266, true], [1266, 6809, null], [6809, 12951, null], [12951, 19377, null], [19377, 23226, null], [23226, 26922, null], [26922, 30156, null], [30156, 36021, null], [36021, 41935, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 41935, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 41935, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 41935, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 41935, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 41935, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 41935, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 41935, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 41935, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 41935, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 41935, null]], "pdf_page_numbers": [[0, 1266, 1], [1266, 6809, 2], [6809, 12951, 3], [12951, 19377, 4], [19377, 23226, 5], [23226, 26922, 6], [26922, 30156, 7], [30156, 36021, 8], [36021, 41935, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 41935, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
1d0720cae3cc0dc0a189ee49951030f912d03ee9
|
Don’t Bring a Spreadsheet to a Database Fight: A Case for Microsoft Access
Ryan Burns, Rho, Inc., Chapel Hill, USA
ABSTRACT
Microsoft Excel is a popular spreadsheet program used by professionals in the pharmaceutical industry from programmers to project managers. In most cases, there is little to no startup time when creating a spreadsheet and the results can be very pretty. These characteristics make Excel a product that is hard to pass up. However, it is often misused as a database platform. Luckily, Microsoft also makes a database program: Access. Access allows for more structure and easier sharing. It is also far superior if the data will be read or written by SAS®. This paper will make a case for using Access instead of Excel and will also present some examples for setting up and using Access databases.
INTRODUCTION
Pharmaceutical programmers work with and create many types of data. This data may be related to clinical data, such as lookup tables used in data mapping, or it may be related to business tasks, such as project tracking. When dealing with clinical data, SAS is the default tool for most programmers. For non-clinical data most people look first to Microsoft Excel because they have a copy of it, they have experience using it, and they can produce something that looks nice relatively easily. So, why not use it? For one, it is a spreadsheet—not a database application. Fortunately, most installations of Microsoft Office now include Access: a flexible, robust, and user-friendly database application. Compared to Excel, Access requires users to spend more time at startup, is less omnipresent, and produces less pretty results. However, in most cases these drawbacks are far outweighed by increased structure, easier sharing, and improved interactions with SAS.
LOOKUP TABLES
Recoding and categorizing data are common programming tasks. In many cases, these are trivial tasks that involve only a handful of original values. However, there are datasets that start with scores of values that need to be handled. The most common example of this is lab data. When dealing with a large number of tests and test codes that need to be standardized and grouped, manually keying each recode is tedious and error prone, so external lookup tables are often used. These lookup tables are created to be functional more than presentable and are often put together rapidly as they are needed. One way to create them is to create a simple Excel worksheet with a few needed columns, such as "old test name", "new test name", and "category". Programmers can then import the spreadsheet into SAS. Then they just have to hope that no one has the spreadsheet open while they run their program, that SAS properly guesses column attributes, and that the program will be able to separate the data rows from the header rows. It may be simple to create a lookup table in Excel, but there is more to consider than just ease of setup.
Another way to create lookup tables is to use Access. A simple, one-table database can take the place of an Excel worksheet. Using the Jet database engines, SAS can interact with any Access table or query. When importing from Access, SAS will run successfully if the database is open as the program runs, attributes are also transferred, and the data and descriptor portions of the table will already be separate. In addition, Access offers a view that is similar to that of Excel and it requires only slightly more effort at setup. The example that follows will show how to create such a database and illustrate that in addition to being powerful and useful there is no reason to be afraid of Access.
LAB TEST LOOKUP TABLE EXAMPLE
• Open Access and create a new blank database—unlike other Office application, you must specify a file name and location before the database is created
• A database will open with a blank table (Table1) displayed—the table can be renamed; this paper will refer to this table as TabNames
• Switch the view to Design View—it is possible to start entering data in the table without changing the view, but explicitly creating columns/fields in Design View is preferable
• Design View is used to create fields and set their attributes
o By default there will be a variable ID which is the primary key and has type Auto Number; this can be renamed, but should be kept
PhUSE 2011
- The data type should be thoughtfully set for each field
- In the lower section other attributes can be set—the most important are Field Size, Required, and Indexed (especially if duplicates should not be allowed)
- For TabNames, in addition to ID, the following fields should exist
<table>
<thead>
<tr>
<th>Field Name</th>
<th>Data Type</th>
<th>Field Size</th>
<th>Required</th>
</tr>
</thead>
<tbody>
<tr>
<td>oldName</td>
<td>Text</td>
<td>255</td>
<td>Yes</td>
</tr>
<tr>
<td>newName</td>
<td>Text</td>
<td>200</td>
<td>No</td>
</tr>
<tr>
<td>newCode</td>
<td>Text</td>
<td>8</td>
<td>No</td>
</tr>
</tbody>
</table>
- Switch the view back to Datasheet View and enter data
- Data can be pasted in or typed
- The ID field will populate automatically for each row
- Adjust and hide columns to suit data and personal preference
The above process requires only a couple of minutes to complete, but can save hours of headaches down the road. Additionally, some time can be saved because there is no need to enable sharing or even save changes as data is entered. Access requires changes to be saved to database design—via manual request or option button when prompted—but changes to data are saved automatically whenever the focus moves from the edited row or a table or database is closed.
**QUERIES**
In the previous example, SAS would read the data table directly. SAS is also capable of reading Access queries. Queries in Access are similar to data views in SAS and usually represent a subset of a table or the result of joining multiple tables. Access provides multiple methods for creating queries: a point-and-click interface, a wizard, and SQL. Programmers with knowledge of SQL can use that method to create queries as they would anywhere, and people without knowledge of SQL can still create queries using one of the other methods—do not worry, the dancing paper clip should not appear.
Continuing the example of working with lab data, we will now work on adding categories to the data (Hematology, Urinalysis, &c.). Assume there is a table that already exists, TabCats, which contains a list of lab test codes and corresponding categories and is used with multiple projects and lab vendors. It is possible to add a field to TabNames and populate it with the information from TabCats. Populating that field would be error-prone and redundant. A better option would be to create a query that joins TabNames and TabCats. The following SQL code could be used to create the query:
```
SELECT n.oldName, n.newName, n.newCode, c.labCat
FROM TabNames as n left join TabCats as c
ON n.newCode = c.labCode;
```
If a user viewed the resulting query in Access or read it with SAS it would appear the same as a table with fields for old name, new name, new code, and category. There are other ways to accomplish the same result, such as merging datasets in SAS, but it is not advisable to attempt to use Excel for this task.
Recoding and categorizing lab tests are relatively simple tasks. However, it is still a data-driven task, so a database is a more appropriate tool than a spreadsheet. The added costs for using Access instead of Excel are minimal, if they exist at all, and the benefits are clear.
**APPLICATIONS FOR NON-CLINICAL DATA**
When non-clinical data exists, more times than not Excel, with all its colors and variable cell sizes, is used. Allowing people to enter data anywhere on a spreadsheet, using any format, and then trying to analyze that data, can be a nightmare. Many people would rather compile hand-written notes and make all calculations using a slide rule. Alternatively, Access provides a platform that can keep everyone smiling. Programmers can create an Access database that is restrictive where it needs to be, flexible in other places, and user-friendly. Data can be collected in several ways including a data entry screen, a tabular form, or imported from some other database. At setup, reports and queries can also be created and viewed by programmers and non-programmers once data has been entered. Finding a balance between the technical requirements of a database that concern programmers and the aesthetics and usability of a database for non-programmers can be tricky. Excel leans too far towards the latter; employing only SAS probably leans too far towards the former; and Access, like mama bear's porridge, is just right.
This paper has touched on tables and queries in Access. Another core component of Access databases is the form. Forms provide a way to control data entry, the ability to restrict viewing and changing the database, and a visually pleasing user interface. Forms can be used for different purposes such as hiding some of the guts of a database from users that do not need to see them or integrating queries, tables, and reports into one interface. The complexity of forms can also vary widely from a simple form that looks like a standard tabular datasheet to complex forms with subforms, controls, and macros. It is easy to get carried away when creating forms, but when done appropriately and in conjunction with good database design, forms help make Access a powerful and useful tool for developers and end-users alike.
One place where a non-clinical database can be useful is the tracking of projects and budgets. This paper will walk through the creation of a database that tracks current contracts including the project lead, contract cap, budget analysis, and sponsor contacts. The database to be created was originally stored in an Excel spreadsheet with no associated reports. In the end the database will be used to enter current project information, store snapshots of the data, and produce several reports without the use of any external applications.
PROJECT TRACKING DATABASE EXAMPLE
Task requirements:
- The following fields need to be present: Project Code, Sponsor, Project Lead, Sponsor Contact, Budget Cap, Cap Type (money vs. time), Money Spent, Hours Spent
- Data entry should be easy, have few restrictions, and be consistent
- Must be able to store and view snapshots of the data
- Allow users to generate the following reports as needed:
- List of project leads with active projects
- Number of projects by project lead
- Projects within 90% of their cap
- All fields considered important
The first step is to create the data tables.
- Table People will store information about any people that will be used in the database; fields include:
- Person_ID: the primary key of type AutoNumber
- Name: a text field
- Internal: a field to differentiate internal employees from clients of type Yes/No
- Client: a text field
- Title: a text field
- Table ActivityCurrent will store the latest data for all fields included in the task requirements
- A primary key will be included
- Project Lead and Sponsor Contact will store values of Person_ID from the People table and will have a datatype of number and field size of long integer
- Project Lead will be selected by users from a pull-down list that is populated with the names of people from the People table who are internal employees; the following attributes under the lookup tab should be set:
- Row Source Type: Table/Query
- Row Source: SELECT person_id, name FROM people WHERE internal=-1 ORDER BY name; (-1 is how 'yes' is stored for a yes/no field)
- Bound Column: 1 (specifies which column from the row source statement will be stored in the Project Lead field)
- Column Count: 2 (specifies how many fields are included in the row source statement)
- Column Widths: 0"; 3" (hides the first column selected in the row source statement)
Access is capable of generating fancy reports, but for the purpose of this example formatting is not important. In order to get the reports needed, a set of queries will be created. Anytime the queries are opened, the desired reports will be displayed as a table. The table ActivityCurrent stores project lead ID numbers rather than names, but Access is aware of this connection and will display project lead names in the query results. This is another way that Access allows developers to design a database according to their preferences without exposing disinterested—and often easily confused—end users to its internal workings.
Queries can become very complicated when multiple tables have to be joined or there are nested queries. Luckily, for this example, the queries are simple. Below are SQL statements that will yield the desired information.
- List of project leads with active projects: SELECT DISTINCT Lead FROM ActivityCurrent WHERE active=−1 ORDER BY lead;
- Number of projects by project lead: SELECT Lead, Count(1) AS [Number of Projects] FROM ActivityCurrent GROUP BY Lead;
- Projects within 90% of their cap: SELECT * FROM ActivityCurrent WHERE iif(capType=“Dollars”, MoneyTotal/Cap, HoursTotal/Cap) >= 0.90;
- All fields considered important: simple select statement including only the important fields
The most familiar, and often most useful, form style in Access is the datasheet form. A datasheet form is tabular and looks like a table or Excel worksheet. The formatting and display options in a datasheet form are not as extensive as those in Excel. For example, all rows in the form will have the same height. On the other hand, Access forms are much more powerful than Excel worksheets. A form can contain data from a table or query, which can be modified via filters and sorting. This permits data that is stored in multiple locations in the database to be displayed together. Forms also have events. Events are the actions of the user and range from when a mouse button is pressed down to when the form is closed. Specific tasks can be assigned to run anytime a certain event happens. One of the most commonly used event/action pairs is checking values before saving them. The Before Update event happens between the time a user indicates a cell or row should be updated and when it is actually updated. At that moment values can be checked and based on the results, changes can be cancelled, users can be prompted to confirm the changes, or other values can be changed as a result of the update. The possibilities for what one can accomplish using events and associated actions are almost limitless.
For this example of a project tracking database, a datasheet form based on the ActivityCurrent table will be created and called FormActivity. One way to do this: with the table open, click Create and then select Datasheet Form. This provides a datasheet form with all fields and is an excellent starting point. Since data entry should not be restricted in this case, all that is left to do is move columns around to be in a logical order and adjust their widths (or hide them) as needed. At this point the form will still look much like a table. The next step is to put this form in a container that provides the ability to carry out the other requirements of the project.
One other type of form is an unbound form, which is a form that is not tied to any data. This example will use an unbound form as a container for FormActivity and buttons that will open the various queries. The first step is to create a blank form; it will be called FormContainer. Make sure that FormContainer is displayed with Design View before continuing. It is possible to embellish the blank form with pictures or background colors, but that is not a requirement of this project. The largest feature that will be in this form is FormActivity, so that will be dragged in first and become a subform. Next, a button will be added above the subform for each of the four queries. To create a button, select Button from the Controls section of the Design menu and then draw a rectangle—if a wizard pops up, click cancel. Once one button is created, it may be easier to paste several copies of that button instead of creating new buttons from scratch. Since the wizard was not used, these buttons will not perform a function until one is assigned.
Event actions, captions, control names, and many other things associated with objects in a form can be set in the Property Sheet. The Property Sheet can be opened directly or by right clicking on any object and selecting properties. For each of the buttons there are three properties that need to be set. One is the caption (Format tab)—this is the text that will be displayed on the button. Next is the name (Other tab)—this is the name that Access will use internally to identify the button; it makes work much easier to have a name with meaning rather than a meaningless number. The last crucial property is the On Click (Event tab)—this will assign the action that will start when the button is clicked. To assign an action, click in the cell next to On Click and then click the ellipsis. Options for using different builders will be presented. The Macro Builder or Code Builder will work. The Macro Builder is a menu-based method of using internal Access macros, while the Code Builder brings up a Visual Basic editor. The VBA statement that is needed is <DoCmd.OpenQuery "HasActive"> (replace "HasActive" with the name of the respective query for each button).
In addition to the buttons that open queries, a button will need to be added to archive the current week’s data and later a pull down will be added to select the week to be displayed. Create a new button and in the properties change the caption to "Archive Week", change the name to "cmdArchive", and enter the code builder for the On Click event. The below code should be added to the newly created cmdArchive_Click subroutine:
```vba
Dim weekNum As String
'Check that data displayed is for the current week.
If Me.FormActivity.Form.RecordSource <> "ActivityCurrent" Then
MsgBox "Archiving is only for current week", vbInformation, "Not Current Week"
Exit Sub
End If
numEntry:
'Prompt user for date range of the week being archived
weekNum = InputBox("Enter date range for week", "Archive Week")
'Check that a data range was entered, and if not, give the user the option to cancel the archive.
If weekNum & "" = "" Then
If MsgBox("Would you like to cancel archive", vbYesNo, "Cancel?") = vbYes Then
Exit Sub
End If
End If
'Check that the date range entered does not already exist
If TableExists("Activity" & weekNum) = True Then
If MsgBox("The week already exists.", vbCrLf & "Would you like to enter a different week?", vbYesNo, "Duplicate Week") = vbNo Then
MsgBox "Archive cancelled", vbInformation, "Oops"
Else
Exit Sub
End If
End If
```
The code above will check that the data range entered does not already exist and will prompt the user if it does. If the user clicks yes, the archive will be cancelled and the current week will be displayed. If the user clicks no, the code will check that the date range entered is not already used and if it is, the code will ask if the user wants to enter a different week. If the user clicks yes, the code will display the current week. If the user clicks no, the FormActivity form will be displayed.
PhUSE 2011
Exit Sub
Else
GoTo numEntry
End If
Else
'Copy current table to archive table
DoCmd.CopyObject , "Activity" & weekNum, acTable, "ActivityCurrent"
Me.cmbWeekSelect.Requery
End If
Each time a user clicks this button and successfully enters all information a new table will be created as a copy of ActivityCurrent and stored in the database with a name like Activity[Date range].
The final requirement of the project is to be able to view the archived weeks. This will be accomplished by adding a pull down that lists all available weeks and uses that selection to change the data source of the FormActivity subform. Adding a pull down is very similar to adding a button—the difference is that instead of selecting Button from the Controls section of the Design menu, Combo Box is selected. Once the combo box (pull down) is added to FormContainer, the properties need to be set. As before, it is advisable to name the new control—in this case the pull down will be named cmbWeekSelect. The Row Source property (Data tab) should be set to:
\[
\text{SELECT sortvar, sName, name}
\text{FROM (SELECT 0 as sortvar, MAX("Current") AS sName, max("ActivityCurrent") as name FROM msysobjects)
UNION ALL (SELECT 1 as sortvar, mid(name,9) as sname, name FROM msysobjects where type=1 and name like "activity*" and name<>"ActivityCurrent")
ORDER BY sortvar;}
\]
The Bound Column property (Data tab) should be set to 3. The Column Count and Column Widths properties (Format tab) should be set to 3 and <0","0"> respectively. The above steps will populate the pull down with a list of all tables in the database that start with "Activity" and will display either "Current" or the date range, with "Current" always first. The final step is to change the On Change property (Event tab) by going to the Code Builder and entering
\[
<Me.FormActivity.Form.RecordSource = cmbWeekSelect>
\text{and}<Me.FormActivity.Requery>, on separate lines.
\]
This will update and refresh the FormActivity subform each time the selected value of the pull down changes.
Everything can now be saved and the required tasks will be completed. There is one more step that makes life easier for end users—setting the database to open FormContainer on startup. Under Access Options there is a section for Current Database. Within that section is an option Display Form with a pull down. Select FormContainer from the list and that form will open anytime the database is opened. If it is necessary for development purposes to open the database without opening the form, simply hold down Shift while Access is starting. This project tracking database has some complicated components, but end users will only see a single form that seamlessly does everything they need. Furthermore, while the data entered could be garbage, at least everyone's name will only be spelled one way and budget numbers will only be entered as numbers.
CONCLUSION
Access is a tool and therefore not a replacement for common sense. However, it is a flexible and powerful tool that ought to be considered. As has been shown, an Access database can be simple and straightforward or it can be a more complex entity with many parts and a user-friendly shell. Excel is not a bad or evil product—it simply is not made to house a database. The next time you open a new Excel workbook, whether it be to recode lab tests, track contracts, or plan a party, I hope that you will ask yourself, "Do I want to create a database to store and perhaps analyze this data or do I want to present something that's in a nice grid?" If you decide that a database is desired, consider closing Excel and opening Access in its place.
ACKNOWLEDGMENTS
Een speciaal woord van dank aan Liedeke Allyn Sharp, zonder wie dit papier zou niet half zo leesbaar. I would also like to thank Jeff Abolafia and Susan Boyer for their encouragement and support.
CONTACT INFORMATION
Your comments and questions are valued and encouraged. Contact the author at:
Ryan Burns
Rho, Inc.
6330 Quadrangle Dr
Chapel Hill, NC 27517
Work Phone: +1 (919) 408-8000
Fax: +1 (919) 408-0999
Email: rburns@rhoworld.com
Web: www.rhoworld.com
Brand and product names are trademarks of their respective companies.
|
{"Source-Url": "https://www.lexjansen.com/phuse/2011/dh/DH01.pdf", "len_cl100k_base": 5096, "olmocr-version": "0.1.49", "pdf-total-pages": 5, "total-fallback-pages": 0, "total-input-tokens": 17873, "total-output-tokens": 5320, "length": "2e12", "weborganizer": {"__label__adult": 0.0002510547637939453, "__label__art_design": 0.0007739067077636719, "__label__crime_law": 0.0002999305725097656, "__label__education_jobs": 0.002552032470703125, "__label__entertainment": 6.693601608276367e-05, "__label__fashion_beauty": 0.00012123584747314452, "__label__finance_business": 0.001346588134765625, "__label__food_dining": 0.0002951622009277344, "__label__games": 0.00040984153747558594, "__label__hardware": 0.0007495880126953125, "__label__health": 0.00048279762268066406, "__label__history": 0.00019538402557373047, "__label__home_hobbies": 0.00017464160919189453, "__label__industrial": 0.0004439353942871094, "__label__literature": 0.00018036365509033203, "__label__politics": 0.00011146068572998048, "__label__religion": 0.00031757354736328125, "__label__science_tech": 0.01470947265625, "__label__social_life": 0.00011497735977172852, "__label__software": 0.192626953125, "__label__software_dev": 0.783203125, "__label__sports_fitness": 0.00018644332885742188, "__label__transportation": 0.0002388954162597656, "__label__travel": 0.00018668174743652344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 23556, 0.01707]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 23556, 0.51629]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 23556, 0.91119]], "google_gemma-3-12b-it_contains_pii": [[0, 4343, false], [4343, 9475, null], [9475, 13237, null], [13237, 19340, null], [19340, 23556, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4343, true], [4343, 9475, null], [9475, 13237, null], [13237, 19340, null], [19340, 23556, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 23556, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 23556, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 23556, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 23556, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 23556, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 23556, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 23556, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 23556, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 23556, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 23556, null]], "pdf_page_numbers": [[0, 4343, 1], [4343, 9475, 2], [9475, 13237, 3], [13237, 19340, 4], [19340, 23556, 5]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 23556, 0.03425]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
f2f9b3d10eaec1688806f524ba3d242f171c670b
|
Pairwise sequence alignment with the Smith-Waterman algorithm
Manel Fernández
Intel HPC Software Workshop Series 2016
HPC Code Modernization for Intel® Xeon and Xeon Phi™
February 18th 2016, Barcelona
Pairwise sequence alignment
Comparison applied to *pairs* of biomolecular sequences
- RNA, DNA, or amino-acids
The goal is to identify how similar they are (homology)
Also used on non-biological sequences, such as natural language and financial data
Pairwise comparison of Naegleria NgTet1 vs E. coli AlkB (a–c) and human ABH2 (d–f)
From “Structure of a Naegleria Tet-like dioxygenase in complex with 5-methylcytosine DNA”, by H. Hashimoto Et Al., Nature 506, 391–395 (20 February 2014)
### Pairwise sequence alignment methods
**Global alignment**
- Covers the entire sequences
- Needleman-Wunsch algorithm finds the best global alignment
```
FTFTA L I L L A V A V
F - - T A L - L L A - A V
```
**Local alignment**
- Only covers parts of the sequences
- Smith-Waterman (S-W) algorithm finds the best local(s) alignment(s)
```
FTFTA L I L L - A V A V
- - F T A L - L L A A V - -
```
Smith-Waterman (SW) algorithm
Step 1. Compute the **alignment matrix** or **score matrix** \((\in \mathbb{N})\)
- Best alignment starts on the \([i,j]\) location with the highest score value in the matrix
\[
H[i,0] = H[0,j] = E[0,j] = F[i,0] = 0 \quad 0 \leq i \leq m, 0 \leq j \leq n
\]
\[
H[i,j] = \max \begin{cases}
E[i,j] = \max \left\{
\begin{array}{ll}
0 & \text{Match/Mismatch} \\
H[i-1,j-1] + \sigma(S_1[i], S_2[j]) & \text{Deletion} \quad (S_1[i] \text{ aligned to a gap}) \\
E[i-1,j] - \omega_e & \text{Insertion} \quad (S_2[j] \text{ aligned to a gap}) \\
H[i-1,j] - \omega_o - \omega_e & \text{ } \\
F[i,j-1] - \omega_e & \\
H[i,j-1] - \omega_o - \omega_e & \text{ } \\
F[i,j-1] & \text{ } \\
\end{array} \right.
\end{cases}
\]
Where
- \(S_1[1..m], S_2[1..n]\) are sequences over alphabet \(\Sigma\)
- \(\sigma(a,b)\) is the similarity function on alphabet letters (substitution matrix)
- \(\omega_o\) and \(\omega_e\) are gap opening and gap extension penalty scheme
Step 2. Find the **optimum local alignment** in the matrix
- From the highest value, go backwards on the direction of used to construct the matrix
- Alignment sequence ends when a matrix cell with zero value is reached
Smith-Waterman algorithm: example
\[ S_1 = \text{AGCACACA}, \ S_2 = \text{ACACACTA} \]
\[ \omega_o = -1, \ \omega_e = 0, \ \sigma(a,b) = \begin{cases} +2, & a = b \\ -1, & a \neq b \end{cases} \]
\[
\begin{array}{c|cccccccc}
--- & --- & --- & --- & --- & --- & --- & --- & --- & --- \\
- & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
A & 0 & 2 & 1 & 2 & 1 & 2 & 1 & 0 & 2 \\
G & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 1 \\
C & 0 & 0 & 3 & 2 & 3 & 2 & 3 & 2 & 1 \\
A & 0 & 2 & 2 & 5 & 4 & 5 & 4 & 3 & 4 \\
C & 0 & 1 & 4 & 4 & 7 & 6 & 7 & 6 & 5 \\
A & 0 & 2 & 3 & 6 & 6 & 9 & 8 & 7 & 8 \\
C & 0 & 1 & 4 & 5 & 8 & 8 & 11 & 10 & 9 \\
A & 0 & 2 & 3 & 6 & 7 & 10 & 10 & 10 & 12 \\
\end{array}
\]
\[
\begin{array}{c|cccccccc}
--- & --- & --- & --- & --- & --- & --- & --- & --- & --- \\
- & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
A & 0 & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } \\
G & 0 & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } \\
C & 0 & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } \\
A & 0 & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } \\
C & 0 & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } \\
A & 0 & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } \\
C & 0 & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } \\
A & 0 & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } & \text{ } \\
\end{array}
\]
**Step 1**
**Step 2**
\[ S_1 = \text{AGCACAC-A} \]
\[ S_2 = \text{A-CACACTA} \]
SW score matrix example
Simple example
- Slightly different sequences
- Similar length (~500 symbols)
Colour gradient for matrix values
- Blue for $H[i,j] = 0$
- Red for high score values
High homology
- About 352 score for this example
- Not necessarily always the case
Other algorithm considerations
Only address Step 1 of the algorithm (*).
- Build the score matrix ("recurrence") and find the highest score ("reduce").
- We will briefly discuss Step 2 later on this presentation.
Algorithm complexity
- Computational complexity: $O(mn)$ (quadratic)
- "Recurrence" and "reduce" steps can be fused.
- Space complexity: $O(mn)$ (quadratic) ?? $O(m+n)$ (linear)
- No need to store the whole matrix to find the highest score value.
(*) Code modernization proposed by “Pairwise DNA sequence alignment optimization” by Yongchao Liu and Bertil Schmidt (“High performance parallelism pearls”, Vol. 2, Ch. 4)
Code modernization of S-W algorithm
How to parallelize the score matrix computation?
- Dependency when parallelizing by rows or columns
- **Parallelize over NE-SW diagonals!**
Assuming
- $S_1$ is placed vertically, indexed by $i$, and $\text{length}(S_1) = m$
- $S_2$ is placed horizontally, indexed by $j$, and $\text{length}(S_2) = n$
- $m \leq n$
We can see that
- Diagonal $d = i + j$, where $0 \leq d < m + n - 1$
- Starting row index $srow_d = \max(0, d - n + 1)$
- Ending row index $erow_d = \min(d, m - 1)$
Intra-process (SMP) parallelization
**Scale-and-vectorize approach**
- Partition the matrix into tiles
- Tile size is $\alpha$ rows $\times$ $\beta$ columns
- Matrix size is $R = \left\lfloor \frac{m}{\alpha} \right\rfloor$ rows $\times$ $C = \left\lfloor \frac{n}{\beta} \right\rfloor$ columns
- TLP on tiles for every external diagonal
- DLP on every internal diagonal
**Current implementation parameters**
- $C = \#\text{threads}$, $\beta = \left\lfloor \frac{n}{\#\text{threads}} \right\rfloor$
- $\alpha = \text{SIMD}_{\text{length}} \times K$
- $\text{SIMD}_{\text{length}} = 8$ for AVX2, 16 for AVX-512/IMCI
- Small $K$ (i.e., $K = 1$) maximize external diagonals with $\#\text{threads}$ tiles, since $\alpha \ll \beta$ and $R \gg C$
S-W in action
Simple example animation
- 8 threads (column tiles)
- Taller tiles than actual ones
Thread parallelism with OpenMP
Private to every thread
GVs are private pointers to global GV[C] arrays
Shared by all threads
C = \#threads horizontal tiles
R = \#vertical tiles
\( C = \#\text{threads horizontal tiles} \)
\( R = \#\text{vertical tiles} \)
\( G = \#\text{vertical tiles} \)
\( H = \#\text{horizontal tiles} \)
\( n-1 \)
\( (d-1) \)
\( (d+1) \)
\( \alpha-1 \)
\( H_{\text{left}} \)
\( F \)
\( G_{\text{Din}} \)
\( G_{\text{Dout}} \)
\( G_{\text{Vin}} \)
\( G_{\text{Vout}} \)
OpenMP implementation
```c
#pragma omp parallel firstprivate(GV,GD) default(shared)
for (d = 0; d < R+C-1; d++)
{
sExtRow = max(0,d-C+1);
eExtRow = min(d,R-1);
Load the per-thread maximum score lmaxScore;
#pragma omp barrier
#pragma omp for schedule(static,1) nowait
for (r = sExtRow; r <= eExtRow; r++)
Compute all cells in tile (r,d-r);
Save lmaxScore to a global variable;
Swap the input and output of GV and GD;
}
Reduce to get the optimal local alignment score;
```
- Threads need to be synchronized before moving to the next external diagonal.
- For every diagonal, every thread will process one tile.
- No need to synchronize at the end since updates are not shared.
- Place together threads with consecutive IDs to improve locality.
S-W within a tile
Auto-vectorization with SIMD
```c
for (int row = 0; row < alpha; row++)
for (int col = 0; col < beta; col++)
H[row][col] = max(0, ...);
```
- **loop was not vectorized: vector dependence prevents vectorization**
```c
for (int d = 0; d < (alpha + beta - 1); d++)
int row = max(0, d - beta + 1);
int erow = min(d, alpha - 1);
int col = min(d, beta - 1);
int ecol = max(0, d - alpha + 1);
for (; (row <= erow) && (col >= ecol); row++, col--)
H[row][col] = max(0, ...);
```
- **loop was not vectorized: parallel loop condition operator must be one of <, <=, >, >=, or !=**
Auto-vectorization with SIMD (cont’d)
// main (assume beta > alpha)
for (int d = alpha - 1; d < beta; d++)
for (int row = 0, int col = d; row < alpha; row++, col--);
H[row][col] = max(0, ...);
➤ LOOP WAS VECTORIZED, *but*...
Resulting code plenty of **gather/scatter** constructs
• SIMD elements are not consecutive in memory
• Scatter instruction does not even exists in AVX2 (software scatter)
What other choices?
• **Guided** (Cilk Plus)
• **Low-level vectorization** (SIMD C++ classes, intrinsics)
Vectorization with SIMD intrinsics
Main loop without peel/remainder (IMCI)
Compute column index gCol for current tile;
for (d = alpha - 1; d < beta; d++, gCol++)
{
// vE[:] = max((GH[gcol].e :: vE[:VL-1]) - ge, (GH[gcol].h :: vH[:VL-1]) - goe)
vHup = __mm512_alignr_epi32(vH, __mm512_set1_epi32(GH[gCol].h), 15);
vE = __mm512_alignr_epi32(vE, __mm512_set1_epi32(GH[gCol].e), 15);
vE = __mm512_max_epi32(__mm512_sub_epi32(vE, vGapE), __mm512_sub_epi32(vHup, vGapOE));
// vF[:] = max(vF[:] - ge, vH[:]) - goe)
vF = __mm512_max_epi32(__mm512_sub_epi32(vF, vGapE), __mm512_sub_epi32(vH, vGapOE));
Compute vScore[:] = \sigma(vS1[:], S2[gCol] :: vS2[0:VL-1]);
// vH[:] = max(vZero, vD[:]) + vScore[:], vE, vF)
vH = __mm512_max_epi32(__mm512_max_epi32(vD, vScore), __mm512_max_epi32(vE, vF));
vD = vHup; // Diagonal values for next iteration
Save vH[VL-1] and vE[VL-1] on GH (new cell on the last row of the stripe);
}
Save vH[0] and vF[0] on GV.out (new cell on the last column of the stripe);
Inter-process parallelization with MPI
Second level tiling
- Blocks size is $\alpha_{mpi} \times \beta_{mpi}$
- Matrix size is $R_{mpi} = \left[ \frac{m}{\alpha_{mpi}} \right] \times C_{mpi} = \left[ \frac{n}{\beta_{mpi}} \right]$
- $\beta_{mpi} = \left[ \frac{n}{P} \right]$, being $P$ number of MPI ranks
Distributed approach
- Block-level GH, GV, GD distributed buffers
- MPI communication between block diagonals
- Non-blocking MPI communication primitives
- MPI_Isend(), MPI_Irecv()
- MPI_Barrier() for synchronization
Final reduction with MPI_Reduce()
Performance evaluation: preliminary questions
Hint: not all answers need to be correct here...
What’s the ideal target? Xeon, Xeon Phi, or offload?
• Problem is highly parallel, Xeon Phi should be better target
• There should be no big difference in using native or offload approach
• Computational complexity bigger than space complexity
Compute bound or memory bandwidth bound?
• Kind of “stencil” which tends to be memory bound
• But, proposal does not build a real matrix, so should be compute bound
What’s the expected strong/weak scalability?
• Highly parallel and compute bound might indicate good scalability
• Possible issues for MPI/thread communication/synchronization
Methodology
<table>
<thead>
<tr>
<th>Methodology</th>
<th>Y. Liu and B. Schmidt</th>
<th>Bayncore</th>
</tr>
</thead>
<tbody>
<tr>
<td>Intel® Xeon® Processor</td>
<td>E5-2670 (2s, 8c/s, 2ht/c)</td>
<td>E5-2650 v2 (2s, 8c/s, 2ht/c)</td>
</tr>
<tr>
<td>Intel® Xeon Phi™ Coprocessor</td>
<td>4x 5110P (60c, 4t/c, 1GHz)</td>
<td>2x 7120A (61c, 4t/c, 1.2GHz)</td>
</tr>
<tr>
<td>Operating System</td>
<td>Linux</td>
<td>RHEL Server 6.6 (Santiago)</td>
</tr>
<tr>
<td>Intel® C++ Compiler Version</td>
<td>15.0 ?</td>
<td>15.0.2.164 (build 20150121)</td>
</tr>
<tr>
<td>OpenMP Affinity</td>
<td>Balanced</td>
<td>Balanced</td>
</tr>
<tr>
<td>MPI Library</td>
<td>OpenMPI</td>
<td>Intel® MPI 5.0</td>
</tr>
<tr>
<td>S-W MPI Implementation</td>
<td>Only MPI + Offload + Xeon Phi SIMD source code provided</td>
<td></td>
</tr>
<tr>
<td></td>
<td>MPI ranks and MPI communication on the processor</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Every rank offloads to a coprocessor (1-rank per coprocessor)</td>
<td></td>
</tr>
<tr>
<td></td>
<td>( \alpha = \text{SIMD}<em>{\text{length}} ), ( \alpha</em>{\text{mpi}} = 128K )</td>
<td></td>
</tr>
<tr>
<td>S-W Input Set (Seq1 vs Seq2) (*)</td>
<td>Seq.</td>
<td>Length</td>
</tr>
<tr>
<td></td>
<td>S4.4</td>
<td>4,411,532</td>
</tr>
<tr>
<td></td>
<td>S4.6</td>
<td>4,641,652</td>
</tr>
</tbody>
</table>
(*) More longer sequences in Y. Liu and B. Schmidt’s performance evaluation
Intra-coprocessor scalability
Smith-Waterman, s4.4 vs s4.6
- Y. Liu and B. Schmidt (Measured)
- Y. Liu and B. Schmidt (Ideal)
- Bayncore (Measured)
- Bayncore (Ideal)
Billion cell updates per second (GCUPS)
Inter-coprocessor scalability
Smith-Waterman, s4.4 vs s4.6
- Y. Liu and B. Schmidt (Measured)
- Bayncore (Measured)
- Y. Liu and B. Schmidt (Ideal)
- Bayncore (Ideal)
Million cell updates per second (GCUPS)
- OpenMP (Xeon)
- OpenMP (Xeon Phi)
- OpenMP + SIMD (Xeon Phi)
- 2x MPI + OpenMP + SIMD (Xeon Phi)
- 4x MPI + OpenMP + SIMD (Xeon Phi)
Inter-coprocessor scalability (cont’d)
Smith-Waterman, MPI strong scaling
- s4.4 vs s4.6
- s23 vs s33
- s23 vs s42
- s23 vs s50
- s33 vs s42
- s33 vs s50
- s42 vs s50
- Average Ideal
Billion cell updates per second (GCUPS)
Number of MPI ranks (i.e., number of Xeon Phi coprocessors)
Compute bound or bandwidth bound?
- Compute bound, but...
- Also latency bound, since L1-misses not being served by L2
- Probably from $GH_{in/out}$ on every diagonal
- Software prefetching might help!
S-W Step 2: Finding optimum local alignment
**Traceback** procedure leading from highest score value
- It would require to store the complete score matrix, which is prohibitive!
Proposal: store *partial* information of score matrix
- Then recompute only the tiles following the alignment path
- Space needed from $m \times n$ down to $C \times R$
\[
\begin{align*}
\alpha - 1 & \quad 0 \quad \beta - 1 \\
\alpha - 1 & \quad 0 \\
\alpha - 1 & \quad 0 \\
m - 1 & \quad \beta - 1 \\
m - 1 & \quad 0 \\
m - 1 & \quad 0 \\
0 & \quad \beta - 1 \\
0 & \quad 0 \\
0 & \quad 0 \\
0 & \quad n - 1 \\
0 & \quad n - 1
\end{align*}
\]
Code modernization: not a single solution
A whole family of parallel programming models
Cache oblivious algorithm
- Cilk Plus, TBB, OpenMP teams with nested parallelism, etc.
```c
void diamond_sw (matrix d)
{
if (d is small)
small_sw(d);
else
{
divide d into d0, d1, d2, d3;
diamond_sw(d0);
cilk_spawn diamond_sw(d1);
/*nospawn*/diamond_sw(d2);
cilk_sync;
diamond_sw(d3)
}
}
```
“Future” improvements
Intrinsics are rarely a long-term option
- Compiler **must** vectorize the diagonal-based loop in source code
- Demand the compiler to vectorize the source code loop (w/ or w/o pragmas)
- Properly generating “alignr” with the expression: `{ c[1:n] = c[0:n-1]; c[0] = x; }
- File compiler defects at Intel Premier
Observation: values in score matrix are:
- Relatively “small” natural numbers \( n < 2^k, \ n \in \mathbb{N} \land k = \{8,16\} \)
- Stored in 32-bit cells (i.e., 32-bit vector elements)
- Idea: we want longer vectors!
AVX-512 – Byte and Word Instruction (**BWII**) extension
- 512-bit vectors also supporting 16- and 8-bit datatypes (32 and 64 elements!)
- DNA algorithms will shine on future AVX-512 BWI extension
- Currently supported by Intel compilers, but not by Intel hardware yet
Summary
Intel® Xeon Phi™ speedup
• vs Intel® Xeon Phi™ w/o SIMD: 15.4x
• vs Intel® Xeon® w/o SIMD: 12.1x
• vs “best” Intel® Xeon® w/ SIMD: ?
Benchmark ends to be compute bound
• Not bad intra-process scalability: 60%-70% efficiency
• Excellent inter-process scalability: 80%-90% efficiency
Still room for additional improvements
• Little extra performance by using MPI ranks with native Xeon Phi binaries
• Software prefetching to mitigate current latency problems
• It would be desirable to get rid of intrinsics
• Using auto-vectorization or Intel® Cilk Plus™ array notation
• Significant future improvement targeting AVX-512 BWI extension
|
{"Source-Url": "https://danysoft.com/estaticos/free/24%20-%20Case%20study%20-%20Pairwise%20sequence%20alignment%20with%20the%20Smith-Waterman%20algorithm.pdf", "len_cl100k_base": 5432, "olmocr-version": "0.1.50", "pdf-total-pages": 27, "total-fallback-pages": 0, "total-input-tokens": 44325, "total-output-tokens": 6746, "length": "2e12", "weborganizer": {"__label__adult": 0.0004429817199707031, "__label__art_design": 0.00036454200744628906, "__label__crime_law": 0.0006213188171386719, "__label__education_jobs": 0.000812530517578125, "__label__entertainment": 0.0001055598258972168, "__label__fashion_beauty": 0.000270843505859375, "__label__finance_business": 0.00038242340087890625, "__label__food_dining": 0.0006051063537597656, "__label__games": 0.0007715225219726562, "__label__hardware": 0.0044708251953125, "__label__health": 0.0011243820190429688, "__label__history": 0.0004875659942626953, "__label__home_hobbies": 0.00020265579223632812, "__label__industrial": 0.0012445449829101562, "__label__literature": 0.0002512931823730469, "__label__politics": 0.0004394054412841797, "__label__religion": 0.0007476806640625, "__label__science_tech": 0.317626953125, "__label__social_life": 0.00011593103408813477, "__label__software": 0.009918212890625, "__label__software_dev": 0.6572265625, "__label__sports_fitness": 0.000644683837890625, "__label__transportation": 0.0009794235229492188, "__label__travel": 0.0002777576446533203}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 16427, 0.03233]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 16427, 0.04898]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 16427, 0.63434]], "google_gemma-3-12b-it_contains_pii": [[0, 203, false], [203, 456, null], [456, 694, null], [694, 1093, null], [1093, 2303, null], [2303, 4069, null], [4069, 4343, null], [4343, 4982, null], [4982, 5503, null], [5503, 6256, null], [6256, 6355, null], [6355, 6863, null], [6863, 7665, null], [7665, 8278, null], [8278, 8798, null], [8798, 9837, null], [9837, 10406, null], [10406, 11092, null], [11092, 12816, null], [12816, 13026, null], [13026, 13372, null], [13372, 13659, null], [13659, 13868, null], [13868, 14493, null], [14493, 14946, null], [14946, 15781, null], [15781, 16427, null]], "google_gemma-3-12b-it_is_public_document": [[0, 203, true], [203, 456, null], [456, 694, null], [694, 1093, null], [1093, 2303, null], [2303, 4069, null], [4069, 4343, null], [4343, 4982, null], [4982, 5503, null], [5503, 6256, null], [6256, 6355, null], [6355, 6863, null], [6863, 7665, null], [7665, 8278, null], [8278, 8798, null], [8798, 9837, null], [9837, 10406, null], [10406, 11092, null], [11092, 12816, null], [12816, 13026, null], [13026, 13372, null], [13372, 13659, null], [13659, 13868, null], [13868, 14493, null], [14493, 14946, null], [14946, 15781, null], [15781, 16427, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 16427, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 16427, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 16427, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 16427, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 16427, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 16427, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 16427, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 16427, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 16427, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 16427, null]], "pdf_page_numbers": [[0, 203, 1], [203, 456, 2], [456, 694, 3], [694, 1093, 4], [1093, 2303, 5], [2303, 4069, 6], [4069, 4343, 7], [4343, 4982, 8], [4982, 5503, 9], [5503, 6256, 10], [6256, 6355, 11], [6355, 6863, 12], [6863, 7665, 13], [7665, 8278, 14], [8278, 8798, 15], [8798, 9837, 16], [9837, 10406, 17], [10406, 11092, 18], [11092, 12816, 19], [12816, 13026, 20], [13026, 13372, 21], [13372, 13659, 22], [13659, 13868, 23], [13868, 14493, 24], [14493, 14946, 25], [14946, 15781, 26], [15781, 16427, 27]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 16427, 0.04011]]}
|
olmocr_science_pdfs
|
2024-11-29
|
2024-11-29
|
52ab95643afe8a1a8e0ae1714c4444e7e52fa2ec
|
Algorithm runtime analysis and computational tractability
As soon as an Analytic Engine exists, it will necessarily guide the future course of the science. Whenever any result is sought by its aid, the question will arise - By what course of calculation can these results be arrived at by the machine in the shortest time? - Charles Babbage
Charles Babbage (1864) Analytic Engine (schematic)
Time Complexity of an Algorithm
How do we measure the **complexity** (time, space requirements) of an algorithm.
The **size** of the problem: an integer $n$
- # inputs (for sorting problem)
- # digits of input (for the primality problem)
- sometimes more than one integer
- Knapsack problem:
- $C$: capacity of the knapsack,
- $N$: number of objects
We want to characterize the running time of an algorithm for increasing problem sizes by a function $T(n)$
Units of time
1 microsecond?
1 machine instruction?
# of code fragments that take constant time?
Units of time
1 microsecond?
no, too specific and machine dependent
1 machine instruction?
no, still too specific and machine dependent
# of code fragments that take constant time?
yes
# what kind of instructions take constant time?
arithmetic op, memory access, finite combination of these
unit of space
bit?
int?
unit of space
bit?
very detailed but sometimes necessary
int?
nicer, but dangerous: we can code a whole program or array (or disk) in one arbitrary sized int, so we have to be careful with space analysis (take value ranges into account when needed). Better to think in terms of machine words
i.e. fixed size, e.g. 64, collections of bits
Worst-Case Analysis
Worst case running time.
A bound on largest possible running time of algorithm on inputs of size n.
- Generally captures efficiency in practice, but can be an overestimate.
Same for worst case space complexity
Average case running time. A bound on the average running time of algorithm on random inputs as a function of input size $n$. In other words: the expected number of steps an algorithm takes.
$$\sum_{i \in I_n} P_i \cdot C_i$$
- $P_i$: probability input $i$ occurs
- $C_i$: complexity given input $i$
- $I_n$: all possible inputs of size $n$
- Hard to model real instances by random distributions.
- Algorithm tuned for a certain distribution may perform poorly on other inputs.
- Often hard to compute.
Why It Matters
Table 2.1 The running times (rounded up) of different algorithms on inputs of increasing size, for a processor performing a million high-level instructions per second. In cases where the running time exceeds $10^{25}$ years, we simply record the algorithm as taking a very long time.
<table>
<thead>
<tr>
<th>$n$</th>
<th>$n$</th>
<th>$n \log_2 n$</th>
<th>$n^2$</th>
<th>$n^3$</th>
<th>$1.5^n$</th>
<th>$2^n$</th>
<th>$n!$</th>
</tr>
</thead>
<tbody>
<tr>
<td>10</td>
<td>< 1 sec</td>
<td>< 1 sec</td>
<td>< 1 sec</td>
<td>< 1 sec</td>
<td>< 1 sec</td>
<td>< 1 sec</td>
<td>4 sec</td>
</tr>
<tr>
<td>30</td>
<td>< 1 sec</td>
<td>< 1 sec</td>
<td>< 1 sec</td>
<td>< 1 sec</td>
<td>< 1 sec</td>
<td>18 min</td>
<td>$10^{25}$ years</td>
</tr>
<tr>
<td>50</td>
<td>< 1 sec</td>
<td>< 1 sec</td>
<td>< 1 sec</td>
<td>< 1 sec</td>
<td>11 min</td>
<td>36 years</td>
<td>very long</td>
</tr>
<tr>
<td>100</td>
<td>< 1 sec</td>
<td>< 1 sec</td>
<td>< 1 sec</td>
<td>1 sec</td>
<td>12,892 years</td>
<td>$10^{17}$ years</td>
<td>very long</td>
</tr>
<tr>
<td>1,000</td>
<td>< 1 sec</td>
<td>< 1 sec</td>
<td>1 sec</td>
<td>18 min</td>
<td>very long</td>
<td>very long</td>
<td>very long</td>
</tr>
<tr>
<td>10,000</td>
<td>< 1 sec</td>
<td>< 1 sec</td>
<td>2 min</td>
<td>12 days</td>
<td>very long</td>
<td>very long</td>
<td>very long</td>
</tr>
<tr>
<td>100,000</td>
<td>< 1 sec</td>
<td>2 sec</td>
<td>3 hours</td>
<td>32 years</td>
<td>very long</td>
<td>very long</td>
<td>very long</td>
</tr>
<tr>
<td>1,000,000</td>
<td>1 sec</td>
<td>20 sec</td>
<td>12 days</td>
<td>31,710 years</td>
<td>very long</td>
<td>very long</td>
<td>very long</td>
</tr>
</tbody>
</table>
A definition of tractability: Polynomial-Time
**Brute force.** For many problems, there is a natural brute force search algorithm that checks every possible solution.
- Typically takes exponential time for inputs of size n.
- Unacceptable in practice.
- Permutations, TSP
An algorithm is said to be polynomial if there exist constants $c > 0$ and $d > 0$ such that on every input of size $n$, its running time is bounded by $c n^d$ steps.
- What about an $n \log n$ algorithm?
Worst-Case Polynomial-Time
On the one hand:
- Possible objection: Although $6.02 \times 10^{23} \times n^{20}$ is technically poly-time, it would be useless in practice, (e.g. n=10)
- In practice, the poly-time algorithms that people develop typically have low constants and low exponents.
- Breaking through the exponential barrier of brute force typically exposes some crucial structure of the problem.
On the other:
- Some exponential-time (or worse) algorithms are widely used because the worst-case (exponential) instances seem to be rare.
- simplex method solving linear programming problems
Characterizing algorithm running times
Suppose that algorithm A has a running time bounded by
\[ T(n) = 1.62 \, n^2 + 3.5 \, n + 8 \]
- There is more detail than is useful
- We want to quantify running time in a way that will allow us to identify broad classes of algorithms
- I.e., we only care about Orders of Magnitude and only consider the leading factor
- in this case: \( T(n) = O(n^2) \)
Asymptotic Growth Rates
Upper bounds
Recap from cs220:
T(n) is \( O(f(n)) \) if there exist constants \( c > 0 \) and \( n_0 \geq 0 \) such that
\[
T(n) \leq c \cdot f(n)
\]
for all \( n \geq n_0 \).
Example: \( T(n) = 32n^2 + 16n + 32 \).
- \( T(n) \) is \( O(n^2) \)
- BUT ALSO: \( T(n) \) is \( O(n^3) \), \( T(n) \) is \( O(2^n) \).
There are many possible upper bounds for one function! We always look for the best (lowest) upper bound.
Big O doesn’t always express what we want:
Any comparison-based sorting algorithm requires at least \( c(n \log n) \) comparisons, for some constant \( c \).
- Use \( \Omega \) for lower bounds.
\( T(n) \) is \( \Omega(f(n)) \) if there exist constants \( c > 0 \) and \( n_0 \geq 0 \) such that for all \( n \geq n_0 : T(n) \geq c \cdot f(n) \)
Example: \( T(n) = 32n^2 + 16n + 32 \).
- \( T(n) \) is \( \Omega(n^2) \)
Tight Bounds
$T(n)$ is $\Theta(f(n))$ if $T(n)$ is both $O(f(n))$ and $\Omega(f(n))$.
**Example:** $T(n) = 32n^2 + 17n + 32$.
- $T(n)$ is $\Theta(n^2)$.
If we show that the running time of an algorithm is $\Theta(f(n))$, we have closed the problem and found a bound for the problem and its algorithm solving it.
$F(n)$ is $O(G(n))$
$F(n)$ is $\Omega(H(n))$
if $G(n) = c \cdot H(n)$
then $F(n)$ is $\Theta(G(n))$
These measures were introduced in CS220
**priority Queue**: data structure that maintains a set $S$ of elements.
Each element $v$ in $S$ has a key $\text{key}(v)$ that denotes the priority of $v$.
Priority Queue provides support for inserting, deleting elements, selection / extraction of smallest (Min prioQ) or largest (Max prioQ) key element, changing key value.
Applications
E.g. used in managing real time events where we want to get the earliest next event and events are added and deleted on the fly.
Also used in Sorting:
- build a prioQ
- Iteratively extract the smallest element
PrioQs can be implemented using heaps
Heaps
Heap: array representation of a
**Complete Binary tree**
- every level is completely filled except the bottom level: filled from left to right
- Can compute the index of parent and children: WHY?
- parent(i) = floor((i-1)/2)
- leftChild(i) = 2i+1
- rightChild(i) = 2(i+1)
Max Heap property:
for all nodes i>0: A[parent(i)] >= A[i]
Max heaps have the max at the root
Min heaps have the min at the root
Heapify\((A,i,n)\)
To create a heap at index \(i\), assuming \(\text{left}(i)\) and \(\text{right}(i)\) are heaps, **bubble** \(A[i]\) **down**: swap with max child until heap property holds
\[
\text{heapify}(A,i,n):
\]
# precondition
# \(n\) is the size of the heap
# tree left\((i)\) and tree right\((i)\) are heaps
.......
# postcondition: tree \(A[i]\) is a heap
Swapping Down
Swapping down enforces (max) heap property at the swap location:
\[
\begin{array}{c}
\text{new} \\
/ \ \\
y \ \\
\quad x \\
\end{array}
\rightarrow
\begin{array}{c}
\text{x} \\
/ \ \\
y \ \\
\quad \text{new}
\end{array}
\]
\[
\text{new} < x \quad \text{and} \quad y < x:
\]
\[
\Rightarrow \quad x > y \quad \text{and} \quad x > \text{new}
\]
\[
\text{swap}(x, \text{new})
\]
Are we done now?
NO! When we have swapped we need to carry on checking whether new is in heap position. We stop when that is the case.
Heap Extract
Heap extract:
Delete (and return) the root
**Step 1:** replace root with last array element to keep completeness
**Step 2:** reinstate the heap property
Which element does **not** necessarily have the heap property?
How can it be fixed? Complexity?
heapify the root O(log n)
Swap **down:** swap with maximum (maxheap), minimum (minheap) child as necessary, until in place.
Sometimes called bubble down
Correctness based on the fact that we started with a heap, so the children of the root are heaps
Heap Insert
**Step 1:** put a new value into first open position (maintaining completeness), i.e. at the end of the array, but now we potentially violated the heap property, so:
**Step 2:** bubble up
- Re-enforcing the heap property
- Swap with parent, if new value > parent, until in the right place.
- The heap property holds for the tree below the new value, when swapping up. **WHY? We only compared the new element to the parent, not to the sibling!**
Swapping up enforces heap property for the sub tree below the new, inserted value:
\[
\begin{array}{c}
x \\
\ \ \ \ \ \ \\
Y \ \ \ \ \ \ \\
\ \ \ \ \ \ \\
new
\end{array}
\quad \quad \quad
\begin{array}{c}
new \\
\ \ \ \ \ \ \\
y \ \ \ \ \ \ \\
\ \ \ \ \ \ \\
x
\end{array}
\]
if \((\text{new} > x)\) swap\((x,\text{new})\) \\
\(x>y\), therefore \(\text{new} > y\)
Building a heap
heapify performs at most $\lg n$ swaps
why? what is $n$?
buildheap: builds a heap out of an array:
- the leaves are all heaps WHY?
- heapify backwards starting at last internal node
WHY backwards?
WHY last internal node?
which node is that?
LET'S DO THE BUILDHEAP!
[4, 8, 7, 2, 14, 1]
NOW LET'S ADD 18
Build heap [4, 8, 7, 2, 14, 1]
add 18
bubble up (2*)
NOW LET'S EXTRACT MAX
Delete max (18) move 7 to root bubble down (1*)
Complexity buildheap
Initial thought: $O(n \log n)$, but
half of the heaps are height 0
quarter are height 1
only one is height $\log n$
It turns out that $O(n \log n)$ is not tight!
complexity buildheap
height
0
1
2
3
max #swaps?
complexity buildheap
max #swaps, see a pattern?
(What kind of growth function do you expect?)
<table>
<thead>
<tr>
<th>height</th>
<th>max #swaps, see a pattern?</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>2</td>
<td>2*1+2 = 4</td>
</tr>
<tr>
<td>3</td>
<td>2*4+3 = 11</td>
</tr>
<tr>
<td>height</td>
<td>max # swaps</td>
</tr>
<tr>
<td>--------</td>
<td>-------------</td>
</tr>
<tr>
<td>0</td>
<td>0 = 2^1 - 2</td>
</tr>
<tr>
<td>1</td>
<td>1 = 2^2 - 3</td>
</tr>
<tr>
<td>2</td>
<td>2*1 + 2 = 4 = 2^3 - 4</td>
</tr>
<tr>
<td>3</td>
<td>2*4 + 3 = 11 = 2^4 - 5</td>
</tr>
</tbody>
</table>
Conjecture:
height = \( h \)
max #swaps = \( 2^{h+1}-(h+2) \)
Proof: induction
base?
step:
height = \( (h+1) \)
max #swaps:
\[
2\times(2^{h+1}-(h+2))+(h+1)
\]
\[
= 2^{h+2}-2h-4+h+1
\]
\[
= 2^{h+2}-(h+3)
\]
\[
= 2^{(h+1)+1}-(((h+1)+2))
\]
n nodes \( \to \Theta(n) \) swaps
Describe the Heap Operations
Heapify(A,i,n)
A is a heap BELOW i, bubble A[i] DOWN, A is heap at i
Extract(A)
heap not empty, remove and return top, replace by last element,
Heapify top (0), A is a heap, 1 smaller
Insert(A,x)
A is a heap, append x to A, bubble x UP until in place, A is a heap,
1 larger
Buildheap(A)
A is an array, view as complete tree, GO BACKWARDS from last internal, heapifying until top is heapified, now A is a heap
Heapsort, complexity
heapsort(A):
buildheap(A)
for i = n-1 downto 1 :
# put max at end array
# max is removed from heap
n=n-1
#heap one smaller, sorted array one larger
# reinstate heap property
# for reduced n elements
- heapify: $\Theta(lgn)$
- heapExtract: $\Theta(lg\ n)$
- buildheap: $\Theta(n)$
- heapsort: $\Theta(n \ lg\ n)$
- space: in place: $\Theta(n)$
DO THE HEAPSORT, DO IT, DO IT!
```
2 4 1
8
1
4 7 8 14
```
```
2
4
1
1
8 14
```
```
7
8
14
```
```
2
4
7
8
14
```
```
1
2
4
7
8
14
```
How not to heapExtract, heapInsert
# These "snail" implementations are NOT preserving the algorithm
# complexity of extractMin: log n and insert: log n and are therefore
# INCORRECT! from a complexity point of view (even though they are
# functionally correct). Remember one of the goals of our course:
# implementing the algorithms maintaining the analyzed complexity
# What are their complexities?
def snailExtractMin(A):
n = len(A)
if n == 0:
return None
min = A[0]
A[0]=A[n-1]
A.pop()
buildHeap(A) # O(n)
return min
def snailInsert(A,v):
A.append(v)
buildHeap(A) # O(n)
Additive Theorem:
Suppose that \( f_1(x) \) is \( O(g_1(x)) \) and \( f_2(x) \) is \( O(g_2(x)) \). Then \( (f_1 + f_2)(x) \) is \( O(\max(g_1(x), g_2(x))) \).
Sequences of code are additive in complexity:
```c
int c = 0;
// loop 1
for(int i=0; i<n; i++)
c++;
// loop 2
for(int j=0; j<n*n; j++)
c++;
```
**Complexity?**
- loop 1: \( O(n) \)
- loop 2: \( O(n^2) \)
**Total complexity:** \( O(n^2) \)
Combinations of functions /code fragments
Multiplicative Theorem:
Suppose that \( f_1(x) \) is \( O(g_1(x)) \) and \( f_2(x) \) is \( O(g_2(x)) \).
Then \( (f_1f_2)(x) \) is \( O(g_1(x)g_2(x)) \).
Nested code is multiplicative in complexity
\[
\begin{align*}
\text{for} & \ (\text{int } i=0; i<n; i++) \\
& \ \ \ \text{for} (\text{int } j=0; j<n; j++) \\
& \ \ \ \ \ \ \ \ \ \ \ \ c++;
\end{align*}
\]
**Complexity:** \( O(n^2) \)
BUT, be careful with nests where the inner loop bounds depend on outer loop variables:
\[
\begin{align*}
\text{int } b &= n; \\
\text{while} (b>0)\{} \\
& \ \ \ b/=2; \\
& \ \ \ \text{for} (\text{int } i=0; i<b; i++) \\
& \ \ \ \ \ \ \ \ \ \ \ c++;
\end{align*}
\]
**Complexity:** \( n/2 + n/4 + \ldots + 2 + 1 = O(n) \)
Recursive Code
Draw the call tree, and assert the number of nodes in the tree and their individual complexity, as a function of n.
Draw the call tree, and assert the number of nodes in the tree and their individual complexity, as a function of $n$.
```java
public int divCo(int n){
if(n<=1)
return 1;
else
return 1 + divCo(n-1) + divCo(n-1);
}
```
How many recursive calls?
How much work per call?
What is the role of “return 1” and return 1+...”?
So what does this function count?
Complexity? $O(2^n)$
Polynomials. $a_0 + a_1 n + \ldots + a_d n^d$ is $O(n^d)$ if $a_d > 0$.
Polynomial time. Running time is $O(n^d)$ for some constant $d$
Logarithms. $\log_a n$ is $O(\log_b n)$ for any constants $a, b > 0$.
can avoid specifying the base
for every $x > 0$, $\log n$ is $O(n^x)$.
Combinations. Merge sort, Heap sort $O(n \log n)$
A Survey of Common Running Times
Constant time: $O(1)$
A single line of code that involves “simple” expressions, e.g.:
- Arithmetical operations (+, -, *, /) for fixed size inputs
- assignments ($x = \text{simple expression}$)
- conditionals with simple sub-expressions
- function calls (excluding the time spent in the called function)
Logarithmic time
Example of a problem with $O(\log(n))$ bound:
binary search
How did we get that bound?
Repeated HALVING
How many times can I halve $n$ until I get to 1?
$log\ n$ times
Guessing game
I have a number between 0 and 63
How many (Y/N) questions do you need to find it?
What’s the number?
What (kind of) questions would you ask?
Guessing game
I have a number between 0 and 63
How many (Y/N) questions do you need to find it?
<table>
<thead>
<tr>
<th>Question</th>
<th>Answer</th>
</tr>
</thead>
<tbody>
<tr>
<td>is it >= 32</td>
<td>N</td>
</tr>
<tr>
<td>is it >= 16</td>
<td>Y</td>
</tr>
<tr>
<td>is it >= 24</td>
<td>N</td>
</tr>
<tr>
<td>is it >= 20</td>
<td>N</td>
</tr>
<tr>
<td>is it >= 18</td>
<td>Y</td>
</tr>
<tr>
<td>is it >= 19</td>
<td>Y</td>
</tr>
</tbody>
</table>
What's the number?
19
Take N=0 and Y=1, what is 010011 ?
WHY?
When in each step of an algorithm we halve the size of the problem then it takes $\log_2 n$ steps to get to the base case.
We often use $\log(n)$ when we should use $\text{floor}(\log(n))$. That's OK since $\text{floor}(\log(n))$ is $\Theta(\log(n))$.
Similarly, if we divide a problem into $k$ equal parts the number of steps is $\log_k n$. For the purposes of big-O analysis it doesn't matter since $\log_a n$ is $O(\log_b n)$.
log(n) and algorithms
Logarithms
definition:
\[ b^x = a \implies x = \log_b a, \text{ eg } 2^3 = 8, \log_2 8 = 3 \]
- \[ b^{\log_b a} = a \quad \log_b b = 1 \quad \log 1 = 0 \]
- \[ \log(x \cdot y) = \log x + \log y \text{ because } b^x \cdot b^y = b^{x+y} \]
- \[ \log(x/y) = \log x - \log y \]
- \[ \log x^a = a \log x \]
- \log x is a 1-to-1 monotonically (slow) growing function
\[ \log x = \log y \iff x = y \]
- \[ \log_a x = \log_b x / \log_b a \]
- \[ y^{\log x} = x^{\log y} \]
- \log x grows slower than any polynomial \( x^d \)
\[ \log_a x = \log_b x / \log_b a \]
\[ b^{\log_b x} = x = a^{\log_a x} = b^{(\log_b a)(\log_a x)} \]
\[ \log_b x = (\log_b a)(\log_a x) \]
\[ \log_a x = \log_b x / \log_b a \]
therefore \( \log_a x = O(\log_b x) \) for any \( a \) and \( b \)
\[ y^{\log x} = x^{\log y} \]
\[ x^{\log_b y} = \]
\[ y^{\log_y x \log_b y} = \]
\[ y^{(\log_b x / \log_b y) \log_b y} = \]
\[ y^{\log_b x} = \]
Linear Time: $O(n)$
**Linear time.** Running time is proportional to the size of the input.
**Computing the maximum.** Compute maximum of $n$ numbers $a_1, \ldots, a_n$.
\[
\begin{aligned}
\text{max} & \leftarrow a_1 \\
\text{for } i = 2 \text{ to } n \{ & \\
\text{if } (a_i > \text{max}) & \\
\quad \text{max} & \leftarrow a_i
\}
\end{aligned}
\]
Also $\Theta(n)$?
Linear Time: $O(n)$
**Merge.** Combine two sorted lists $A = a_1, a_2, \ldots, a_n$ with $B = b_1, b_2, \ldots, b_n$ into a single sorted list.
Claim. Merging two lists of size $n$ takes $O(n)$ time.
Polynomial evaluation. Given
\[ A(x) = a_n x^n + a_{n-1} x^{n-1} + \ldots + a_1 x + a_0 \quad (a_n \neq 0) \]
Evaluate \( A(x) \)
How not to do it:
\[ a_n \exp(x,n) + a_{n-1} \exp(x,n-1) + \ldots + a_1 x + a_0 \]
Why not?
How to do it: Horner's rule
\[a_n x^n + a_{n-1} x^{n-1} + \ldots + a_1 x^1 + a_0 =
\]
\[(a_n x^{n-1} + a_{n-1} x^{n-2} + \ldots + a_1) x + a_0 = \ldots =
\]
\[(\ldots(a_n x + a_{n-1}) x + a_{n-2}) x \ldots + a_1) x + a_0
\]
\[y = a[n]
\]
for \((i=n-1;i>=0;i--)
\]
\[y = y * x + a[i]
\]
Polynomial evaluation using Horner: complexity
Lower bound: $\Omega(n)$ because we need to access each $a[i]$ at least once
Upper bound: $O(n)$
Closed problem!
But what if $A(x) = x^n$
\[ A(x) = x^n \]
**Recurrence:**
\[ x^{2n} = x^n \cdot x^n \quad x^{2n+1} = x \cdot x^{2n} \]
```python
def pwr(x, n):
if (n==0):
return 1
if odd(n):
return x * pwr(x, n-1)
else:
a = pwr(x, n/2)
return a * a
```
**Complexity?**
$O(n \log n)$ Time
Often arises in divide-and-conquer algorithms like mergesort.
```
mergesort(A):
if len(A) <= 1 return A
else return merge(mergesort(left half(A)),
mergesort(right half(A)))
```
Merge Sort - Divide
{7,3,2,9,1,6,4,5}
{7,3,2,9} {1,6,4,5}
{7,3} {2,9} {1,6} {4,5}
{7} {3} {2} {9} {1} {6} {4} {5}
Merge Sort - Merge
mergesort(A):
if len(A) <= 1 return A
else return merge(mergesort(left half(A)),
mergesort(right half(A)))
Quadratic time example. Enumerate all pairs of elements.
Closest pair of points. Given a list of $n$ points in the plane $(x_1, y_1), \ldots, (x_n, y_n)$, find the pair that is closest.
$O(n^2)$ solution. Try all pairs of points.
```
min ← (x_1 - x_2)^2 + (y_1 - y_2)^2
for i = 1 to n {
for j = i+1 to n {
d ← (x_i - x_j)^2 + (y_i - y_j)^2
if (d < min)
min ← d
}
}
```
Remark. $\Omega(n^2)$ seems inevitable, but ....
Example 1: Matrix multiplication
Tight?
Example 2: Set disjoint-ness. Given \( n \) sets \( S_1, \ldots, S_n \) each of which is a subset of \( 1, 2, \ldots, n \), is there some pair of these which are disjoint?
\( O(n^3) \) solution. For each pairs of sets, determine if they are disjoint.
```plaintext
foreach set \( S_i \) {
foreach other set \( S_j \) {
foreach element \( p \) of \( S_i \) {
determine whether \( p \) also belongs to \( S_j \)
}
if (no element of \( S_i \) belongs to \( S_j \))
report that \( S_i \) and \( S_j \) are disjoint
}
}
```
what do we need for this to be \( O(n^3) \)?
Polynomial Time: $O(n^k)$ Time
Independent set of size $k$. Given a graph, are there $k$ nodes such that no two are joined by an edge?
$O(n^k)$ solution. Enumerate all subsets of $k$ nodes.
```
foreach subset S of k nodes {
check whether S in an independent set
if (S is an independent set)
report S is an independent set
}
```
- Check whether $S$ is an independent set = $O(k^2)$.
- Number of $k$ element subsets = $\binom{n}{k} = \frac{n (n-1) (n-2) \cdots (n-k+1)}{k (k-1) (k-2) \cdots (2) (1)} \leq \frac{n^k}{k!}$
- $O(k^2 n^k / k!) = O(n^k)$.
poly-time for $k=17$, but not practical
Exponential Time
Independent set. Given a graph, what is the maximum size of an independent set?
$O(n^2 2^n)$ solution. Enumerate all subsets.
```plaintext
S* ← φ
foreach subset S of nodes {
check whether S in an independent set
if (S is largest independent set seen so far)
update S* ← S
}
```
For some problems (e.g. TSP) we need to consider all $n!$ permutations of $n$ items.
The factorial function ($n!$) grows much faster than $2^n$
Questions
1. Is $2^n O(3^n)$?
2. Is $3^n O(2^n)$?
3. Is $2^n O(n!)$?
4. Is $n! O(2^n)$?
5. Is $\log_2 n O(\log_3 n)$?
6. Is $\log_3 n O(\log_2 n)$?
Some problems (such as matrix multiply) have a polynomial complexity solution: an $O(n^p)$ time algorithm solving them. ($p$ constant)
Some problems (such as Hanoi) take an exponential time to solve: $\Theta(p^n)$ ($p$ constant)
For some problems we only have an exponential solution, but we don't know if there exists a polynomial solution. Trial and error algorithms are the only ones we have so far to find an exact solution, and if we would always make the right guess, these algorithms would take polynomial time.
We call these problems NP (non deterministic polynomial) We will discuss NP later.
Some NP problems
**TSP**: Travelling Salesman
given cities \(c_1, c_2, \ldots, c_n\) and distances between all of these, find a minimal tour connecting all cities.
**SAT**: Satisfiability
given a boolean expression \(E\) with boolean variables \(x_1, x_2, \ldots, x_n\) determine a truth assignment to all \(x_i\) making \(E\) true.
Back tracking searches (walks) a state space, at each choice point it guesses a choice.
In a leaf (no further choices) if solution found OK, else go back to last choice point and pick another move.
NP is the class of problems for which we can check in polynomial time whether it is correct (certificates, later)
NP problems become intractable quickly
**TSP for 100 cities?**
How would you enumerate all possible tours? How many?
Coping with intractability:
- Approximation: Find a nearly optimal tour
|
{"Source-Url": "https://www.cs.colostate.edu/~cs320/fall20/slides/02_bigO.pdf", "len_cl100k_base": 8069, "olmocr-version": "0.1.49", "pdf-total-pages": 71, "total-fallback-pages": 0, "total-input-tokens": 106157, "total-output-tokens": 10661, "length": "2e12", "weborganizer": {"__label__adult": 0.0003867149353027344, "__label__art_design": 0.0003871917724609375, "__label__crime_law": 0.0005865097045898438, "__label__education_jobs": 0.0014219284057617188, "__label__entertainment": 9.578466415405272e-05, "__label__fashion_beauty": 0.00021064281463623047, "__label__finance_business": 0.00024437904357910156, "__label__food_dining": 0.0006213188171386719, "__label__games": 0.0012664794921875, "__label__hardware": 0.0019168853759765625, "__label__health": 0.0008325576782226562, "__label__history": 0.0004498958587646485, "__label__home_hobbies": 0.000255584716796875, "__label__industrial": 0.000789642333984375, "__label__literature": 0.0003666877746582031, "__label__politics": 0.0003933906555175781, "__label__religion": 0.0006694793701171875, "__label__science_tech": 0.097900390625, "__label__social_life": 0.00013113021850585938, "__label__software": 0.00592041015625, "__label__software_dev": 0.88330078125, "__label__sports_fitness": 0.0006747245788574219, "__label__transportation": 0.0010309219360351562, "__label__travel": 0.00028014183044433594}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22968, 0.06558]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22968, 0.30452]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22968, 0.79817]], "google_gemma-3-12b-it_contains_pii": [[0, 395, false], [395, 865, null], [865, 965, null], [965, 1264, null], [1264, 1290, null], [1290, 1635, null], [1635, 1869, null], [1869, 2375, null], [2375, 3505, null], [3505, 3988, null], [3988, 4590, null], [4590, 4993, null], [4993, 5017, null], [5017, 5442, null], [5442, 5867, null], [5867, 6182, null], [6182, 6325, null], [6325, 6653, null], [6653, 6917, null], [6917, 7334, null], [7334, 7707, null], [7707, 8238, null], [8238, 8756, null], [8756, 9220, null], [9220, 9607, null], [9607, 9869, null], [9869, 9914, null], [9914, 9989, null], [9989, 10062, null], [10062, 10248, null], [10248, 10302, null], [10302, 10633, null], [10633, 10804, null], [10804, 11078, null], [11078, 11520, null], [11520, 11928, null], [11928, 12071, null], [12071, 12694, null], [12694, 13107, null], [13107, 13867, null], [13867, 13999, null], [13999, 14401, null], [14401, 14743, null], [14743, 14776, null], [14776, 15081, null], [15081, 15272, null], [15272, 15430, null], [15430, 15757, null], [15757, 16214, null], [16214, 16735, null], [16735, 16983, null], [16983, 17132, null], [17132, 17503, null], [17503, 17705, null], [17705, 17932, null], [17932, 18220, null], [18220, 18409, null], [18409, 18685, null], [18685, 18912, null], [18912, 19032, null], [19032, 19051, null], [19051, 19182, null], [19182, 19640, null], [19640, 20304, null], [20304, 20914, null], [20914, 21374, null], [21374, 21523, null], [21523, 22128, null], [22128, 22463, null], [22463, 22777, null], [22777, 22968, null]], "google_gemma-3-12b-it_is_public_document": [[0, 395, true], [395, 865, null], [865, 965, null], [965, 1264, null], [1264, 1290, null], [1290, 1635, null], [1635, 1869, null], [1869, 2375, null], [2375, 3505, null], [3505, 3988, null], [3988, 4590, null], [4590, 4993, null], [4993, 5017, null], [5017, 5442, null], [5442, 5867, null], [5867, 6182, null], [6182, 6325, null], [6325, 6653, null], [6653, 6917, null], [6917, 7334, null], [7334, 7707, null], [7707, 8238, null], [8238, 8756, null], [8756, 9220, null], [9220, 9607, null], [9607, 9869, null], [9869, 9914, null], [9914, 9989, null], [9989, 10062, null], [10062, 10248, null], [10248, 10302, null], [10302, 10633, null], [10633, 10804, null], [10804, 11078, null], [11078, 11520, null], [11520, 11928, null], [11928, 12071, null], [12071, 12694, null], [12694, 13107, null], [13107, 13867, null], [13867, 13999, null], [13999, 14401, null], [14401, 14743, null], [14743, 14776, null], [14776, 15081, null], [15081, 15272, null], [15272, 15430, null], [15430, 15757, null], [15757, 16214, null], [16214, 16735, null], [16735, 16983, null], [16983, 17132, null], [17132, 17503, null], [17503, 17705, null], [17705, 17932, null], [17932, 18220, null], [18220, 18409, null], [18409, 18685, null], [18685, 18912, null], [18912, 19032, null], [19032, 19051, null], [19051, 19182, null], [19182, 19640, null], [19640, 20304, null], [20304, 20914, null], [20914, 21374, null], [21374, 21523, null], [21523, 22128, null], [22128, 22463, null], [22463, 22777, null], [22777, 22968, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 22968, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22968, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22968, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22968, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 22968, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22968, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22968, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22968, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22968, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, true], [5000, 22968, null]], "pdf_page_numbers": [[0, 395, 1], [395, 865, 2], [865, 965, 3], [965, 1264, 4], [1264, 1290, 5], [1290, 1635, 6], [1635, 1869, 7], [1869, 2375, 8], [2375, 3505, 9], [3505, 3988, 10], [3988, 4590, 11], [4590, 4993, 12], [4993, 5017, 13], [5017, 5442, 14], [5442, 5867, 15], [5867, 6182, 16], [6182, 6325, 17], [6325, 6653, 18], [6653, 6917, 19], [6917, 7334, 20], [7334, 7707, 21], [7707, 8238, 22], [8238, 8756, 23], [8756, 9220, 24], [9220, 9607, 25], [9607, 9869, 26], [9869, 9914, 27], [9914, 9989, 28], [9989, 10062, 29], [10062, 10248, 30], [10248, 10302, 31], [10302, 10633, 32], [10633, 10804, 33], [10804, 11078, 34], [11078, 11520, 35], [11520, 11928, 36], [11928, 12071, 37], [12071, 12694, 38], [12694, 13107, 39], [13107, 13867, 40], [13867, 13999, 41], [13999, 14401, 42], [14401, 14743, 43], [14743, 14776, 44], [14776, 15081, 45], [15081, 15272, 46], [15272, 15430, 47], [15430, 15757, 48], [15757, 16214, 49], [16214, 16735, 50], [16735, 16983, 51], [16983, 17132, 52], [17132, 17503, 53], [17503, 17705, 54], [17705, 17932, 55], [17932, 18220, 56], [18220, 18409, 57], [18409, 18685, 58], [18685, 18912, 59], [18912, 19032, 60], [19032, 19051, 61], [19051, 19182, 62], [19182, 19640, 63], [19640, 20304, 64], [20304, 20914, 65], [20914, 21374, 66], [21374, 21523, 67], [21523, 22128, 68], [22128, 22463, 69], [22463, 22777, 70], [22777, 22968, 71]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22968, 0.04792]]}
|
olmocr_science_pdfs
|
2024-11-25
|
2024-11-25
|
49e8546c6cbf7c277ea11adf3eed86eb2015b777
|
Execution of an Advanced Data Analytics by Integrating Spark with MongoDB
Ms. C. Vijayalakshmi, M.C.A., M.Phil.,
Department of Computer Science and Engineering, Jubail University College (Female Branch)
PO Box 10074, Jubail Industrial City - 31961, Kingdom of Saudi Arabia
vijimichael50@gmail.com
ABSTRACT
Spark has several advantages compared to other big data and MapReduce technologies like Hadoop and Storm. Spark provides a comprehensive, unified framework to manage big data processing requirements with a variety of data sets that are diverse in nature (text data, graph data etc.) as well as the source of data (batch vs. real-time streaming data). Spark SQL is an easy-to-use and power API provided by Apache Spark. Spark SQL makes it much easier reading and writing data to do analysis. MongoDB Connector for Apache Spark is a powerful integration that enables developers and data scientists to create new insights and drive real-time action on live, operational and streaming data. This paper demonstrates some experimentation on the MongoDB Connector for Apache Spark that how Spark SQL library can be used to store, retrieve and execute the structured/semi-structured datasets such as BSON against the Non-Relational database MongoDB, an open-source and leading NoSQL database.
KEYWORDS
Spark SQL, MongoDB, NoSQL databases, MongoDB Connector for Apache Spark, Data Analytics with Spark SQL and MongoDB, Data Mining on NoSQL data
1 INTRODUCTION
In the era of Big data, the Complex data is growing. Unstructured data will account for more than 80% of the data collected by organizations. Data increasingly stored in Non-Relational databases as shown in Table 1. The Non-Relational databases (such as MongoDB, HBASE etc.) are very efficient in the domains of Big data, Content Management and Delivery, Mobile and Social Infrastructure, User Data Management and Data Hub etc. as MongoDB provides document oriented storage, index on any attribute, replication, high availability, Auto-sharding, fast in-place updates and rich queries.
Table 1. Comparison of Data
<table>
<thead>
<tr>
<th>Volume</th>
<th>GBs-TBs</th>
<th>TBs-PBs</th>
</tr>
</thead>
<tbody>
<tr>
<td>Structure</td>
<td>Structured</td>
<td>Structured, Semi-structured and Unstructured</td>
</tr>
<tr>
<td>Database</td>
<td>Relational Databases: (Oracle, SQL Server, MySQL etc.)</td>
<td>Non-Relational Datastores: (Hadoop, HBASE, MongoDB etc.)</td>
</tr>
<tr>
<td>Schema</td>
<td>Fixed</td>
<td>Dynamic/Flexible</td>
</tr>
<tr>
<td>Structure</td>
<td>DBA-controlled</td>
<td>Application-controlled</td>
</tr>
</tbody>
</table>
Apache Spark started as a research project at UC Berkeley in the AMPLab, which focuses on big data analytics. Their goal was to design a programming model that supports a much wider class of applications than MapReduce, while maintaining its automatic fault tolerance. In particular, MapReduce is inefficient for multi-pass applications that require low-latency data sharing across multiple parallel operations. These applications [1] are quite common in analytics, and include:
• *Iterative algorithms*, including many machine learning algorithms and graph algorithms like PageRank.
• *Interactive data mining*, where a user would like to load data into RAM across a cluster and query it repeatedly.
• *Streaming applications* that maintain aggregate state over time.
2 SPARK
Apache Spark is an open source big data processing framework built around speed, ease of use and sophisticated analytics. Spark is written in Scala Programming Language and runs on Java Virtual Machine (JVM) environment. Creating and running Spark programs are faster due to its less read and write of code. It supports other languages such as Java, Python and R etc. for developing applications. In addition to Map and Reduce operations, it supports SQL queries, streaming data, machine learning and graph data processing [2] as shown in Figure 1.

Spark operates on RDDs (Resilient Distributed Dataset) which is an in-memory data structure. Each RDD represents a chunk of the data which is partitioned across the data nodes in the cluster. RDDs are immutable and a new one is created when transformations are applied. RDDs are operated in parallel using transformations/actions like mapping, filtering etc. These operations are performed simultaneously on all the partitions in parallel. RDDs are resilient, if a partition is lost due to a node crash, it can be reconstructed from the original sources.
Spark Streaming can be used for processing the real-time streaming data. This is based on micro batch style of computing and processing. Spark Streaming provides as abstraction called DStream (Discrete Streams) which is a continuous stream of data. DStreams are created from input data stream or from sources such as Kafka, Flume or by applying operations on other DStreams. A DStream is essentially a sequence of RDDs.
Spark SQL provides the capability to expose the Spark datasets over JDBC API and allow running the SQL like queries on Spark data using traditional BI\(^1\) and visualization tools. Spark SQL can read both SQL and NoSQL data sources. StreamSQL is a Spark component that combines Catalyst\(^2\) and Spark Streaming to perform SQL queries on DStreams.
Spark MLlib [3] is Spark’s scalable machine learning library consisting of common learning algorithms and utilities including classification, regression, clustering, collaborative filtering, dimensionality reduction as well as underlying optimization primitives.
Spark GraphX [3] is the new (alpha) Spark API for graphs and graph-parallel computation. At a high level, GraphX extends the Spark RDD by introducing the Resilient Distributed Property Graph: a directed multi-graph with properties attached to each vertex and edge. To support
---
\(^1\) Business Intelligence (BI) is a broad category of computer software solutions that enables a company or organization to gain insight into its critical operations through reporting applications and analysis tools.
\(^2\) Catalyst Optimizer optimizes the Relational algebra and expressions. It does Query optimization.
graph computation, GraphX exposes a set of fundamental operators (such as subgraph, joinVertices, and aggregateMessages etc.) as well as an optimized variant of the Pregel API. In addition, GraphX includes a growing collection of graph algorithms and builders to simplify graph analytics tasks.
3 SPARK SQL
SparkSQL is a distributed and fault tolerant query engine. It allows users to run interactive queries on structured and semi-structured data. Spark SQL can support Batch or Streaming SQL. It runs SQL/Hive queries, connects existing BI tools to Spark through JDBC. It binds Python, Scala, Java and R. Spark SQL’s data source API can read and write DataFrames\(^3\) using a variety of formats such as JSON, CSV, Parquet, MySQL, HDFS, HIVE, HBASE, Avro or JDBC etc.
3.1 Capabilities of SparkSQL [5]
- **Seamless Integration**
Spark SQL allows us to write queries inside Spark programs, using either SQL or a DataFrame API. We can apply normal spark functions (map, filter, ReduceByKey etc) to SQL query results.
- **Supports variety of Data Formats and Sources**
Data Frames and SQL provide connection to access a variety of data sources, including Hive, Avro, Parquet, Cassandra, CSV, ORC, JSON or JDBC. We can load, query and join data across these sources.
- **Hive Compatibility**
We neither to make any changes to our data in existing hive metastore to make it work with Spark nor to change our hive queries.
Spark SQL reuses the Hive frontend and metastore, giving full compatibility with existing Hive data, queries and UDF\(^4\)s.
- **Standard Connectivity for JDBC or ODBC**
A server mode provides industry standard JDBC and ODBC connectivity for Business Intelligence tools. We can use our existing BI tools like tableau.
- **Performance Scalability**
At the core of Spark SQL is the Catalyst optimizer, which leverages advanced programming language features like columnar storage and code generation in a novel way to build an extensible query optimizer. It scales to thousands of nodes and multi hour queries using the Spark engine, which provides full mid-query fault tolerance.
4 MONGODB
MongoDB is an open-source document database that provides high performance, high availability and automatic scaling. MongoDB obviates the need for an Object Relational Mapping (ORM) to facilitate development. A record in MongoDB is a document, which is a data structure composed of field and value pairs. MongoDB documents are similar to JSON objects. The values of fields may include other documents, arrays and arrays of documents.
<table>
<thead>
<tr>
<th>RDBMS</th>
<th>MongoDB</th>
</tr>
</thead>
<tbody>
<tr>
<td>Database</td>
<td>Database</td>
</tr>
<tr>
<td>Table</td>
<td>Collection</td>
</tr>
<tr>
<td>Tuple/Row</td>
<td>Document</td>
</tr>
<tr>
<td>Column</td>
<td>Field</td>
</tr>
</tbody>
</table>
---
\(^3\) DataFrame is a distributed collection of rows organized into named columns. It is an abstraction for selecting, filtering, aggregating and plotting structured data.
\(^4\) User-Defined Functions (UDF) is a feature of Spark SQL to define new Column-based functions that extend the vocabulary of Spark SQL’s DSL to transform Datasets.
MongoDB stores documents in collections. Collections are analogous to tables in relational databases. Unlike a table, however, a collection does not require its documents to have the same schema. In MongoDB, documents stored in a collection must have a unique _id field that acts as a primary key. MongoDB stores data records as BSON documents.
4.1 Advantages of MongoDB over RDBMS
- Schema less (Number of fields, content and size of the document can be differing from one document to another.)
- Structure of a single object is clear
- No complex joins
- Deep query-ability (MongoDB supports dynamic queries on documents using a document-based query language.)
- Tuning
- Ease to scale
- Conversion / mapping of application objects to database objects is not needed
- Uses internal memory for storing the (windowed) working set, enabling faster access of data
5 MONGODB SPARK CONNECTOR
The MongoDB Spark Connector provides integration between MongoDB and Apache Spark. With the connector, we have access to all Spark libraries for use with MongoDB datasets: Datasets for analysis with SQL (benefiting from automatic schema inference), streaming, machine learning, and graph APIs.
We can also use the connector with the Spark Shell.
The connector enables developers to build more functional applications faster and with less complexity, using a single integrated analytics and database technology stack. With industry estimates assessing that data integration consumes 80% of analytics development, the connector enables data engineers to eliminate the requirement for shuttling data between separate operational and analytics infrastructure. Each of these systems demands their unique configuration, maintenance and management requirements.
Written in Scala, Apache Spark’s native language, the connector provides a more natural development experience for Spark users. The connector exposes all of Spark’s libraries, enabling MongoDB data to be materialized as DataFrames and Datasets for analysis with machine learning, graph, streaming and SQL APIs, further benefiting from automatic schema inference. The connector also takes advantage of MongoDB’s aggregation pipeline and rich secondary indexes to extract, filter and process only the range of data it needs.
To maximize performance across large, distributed data sets, the MongoDB Connector for Apache Spark can co-locate Resilient Distributed Datasets (RDDs) with the source MongoDB node, thereby minimizing data movement across the cluster and reducing latency as shown in Figure 2.
---
5 BSON is a binary representation of JSON documents, though it contains more data types than JSON.
6 EXPERIMENTATION
This experimentation demonstrates on how the MongoDB Connector for Apache Spark can access to all Spark libraries to analyze MongoDB dataset [10][11][12].
MongoDB Spark Connector is compatible with MongoDB 2.6 or later, Apache Spark 1.6.x and Scala 2.10.x (if using the mongo-spark-connector_2.10 package) or Scala 2.11.x (if using the mongo-spark-connector_2.11 package). This experimentation uses the Spark shell with Mongo shell⁶.
6.1 Proposed Model:
The MongoDB Connector is a plugin for both Hadoop and Spark that provides the ability to use MongoDB as an input source and/or an output destination for jobs running in both environments.
- Start the MongoDB Spark Connector, while starting the Spark shell (with Scala)
- Create a BSON file in Spark
- Save the BSON file (from Spark) into MongoDB (as a Collection)
- When needed, Load the MongoDB collection into Spark (as a DataFrame)
- Perform required SQL queries on the DataFrame of Spark
- Store the output of the SQL queries (from the DataFrame of Spark) into MongoDB (as a Collection)
6.2 Model Implementation:
Step (1): To Start Mongo Shell
```
hduser@ubuntu:~$ sudo service mongod start
```
```
hduser@ubuntu:~$ mongo
MongoDB shell version: 3.2.8
connecting to: test
>
```
Note: When we run mongo without any arguments, the mongo shell will attempt to connect to the MongoDB instance running on the localhost interface on port 27017.
Step (2): To show Current databases of MongoDB
```
> show dbs
```
```
> show dbs
Vljay 0.000GB
local 0.000GB
test 0.000GB
>
```
Step (3): To Start Scala
```
hduser@ubuntu:~$ cd /usr/local/scala
hduser@ubuntu:~$ bin/scala
```
Step (4): To Start MongoDB Spark Connector
```
hduser@ubuntu:/usr/local/scala$ cd ../spark
hduser@ubuntu:/usr/local/spark$ bin/spark-shell --conf "spark.mongodb.input.uri=mongodb://127.0.0.1/Sivijaya.primer?readPreference=primaryPreferred" --conf "spark.mongodb.output.uri=mongodb://127.0.0.1/Sivijaya.primer" --packages org.mongodb.spark:mongo-spark-connector_2.10:1.0.0
```
Note:
- The `bin/spark-shell` to start the Spark shell.
- The `--conf` option to configure the MongoDB Spark Connector. These settings configure the SparkConf object.
- The `spark.mongodb.input.uri` specifies the MongoDB server address (127.0.0.1), to connect the database (Sivijaya) and the collection (primer) from which to read data with the read preference.
- The `spark.mongodb.output.uri` specifies the MongoDB server address (127.0.0.1), to connect the database (Sivijaya) and the collection (primer) to which to write data.
- The `--packages` option to download the MongoDB Spark Connector package `mongo-spark-connector_2.10:1.0.0` to use with Scala 2.10.x
Step (5): To import necessary packages
```
scala> import com.mongodb.spark._
scala> import org.bson.Document
scala> import com.mongodb.spark.sql._
scala> import org.apache.spark.sql.SQLContext
scala> val sqlContext = SQLContext.getOrCreate(sc)
```
Step (6): To create a BSON file in Spark, We took a sample JSON file named `primer-dataset.json`:
```
scala> val mydocs = """ |
| {"address": {"building": "1007", "coord": [-73.856077, 40.848447], "street": "Morris Park Ave", "zipcode": "10462"}, "borough": "Bronx", "cuisine": "Bakery", "grades": [{"date": {"$date": 1393804800000}, "grade": "A", "score": 2}], {"date": {"$date": 1378857600000}, "grade": "A", "score": 6}, {"date": {"$date": 1358985600000}, "grade": "A", "score": 10}, {"date": {"$date": 1322006400000}, "grade": "A", "score": 9}], {"date": {"$date": 1299715200000}, "grade": "B", "score": 14}], "name": "Morris Park Bake Shop", "restaurant_id": "30075445"} |
| {"address": {"building": "469", "coord": [-73.961704, 40.662942], "street": "Flatbush Avenue", "zipcode": "11225"}, "borough": "Brooklyn", "cuisine": "Bakery", "grades": [{"date": {"$date": 1393804800000}, "grade": "A", "score": 5}], {"date": {"$date": 1378857600000}, "grade": "A", "score": 2}, {"date": {"$date": 1358985600000}, "grade": "A", "score": 6}, {"date": {"$date": 1322006400000}, "grade": "A", "score": 8}], "name": "Brooklyn Bake Shop", "restaurant_id": "30175445"} |
```
---
7 https://raw.githubusercontent.com/mongodb/docs-assets/primer-dataset/primer-dataset.json
Step (7): To save the BSON file into MongoDB collection
```scala
scala> sc.parallelize(mymdocs.map(Document.par
se)).saveToMongoDB()
```
Step (8): To view the stored collection (primer) of the database (Sivijaya) from MongoDB
```bash
> show dbs
> use Sivijaya
> show collections
> db.primer.find()
```
```
> db.primer.find().pretty()
```
Step (9): To load the stored collection (primer) from MongoDB into Spark (as DataFrame)
```scala
scala> val sample = MongoSpark.load(sqlContext)
```
Step (10): To Store (or To Register) the DataFrame into Table
```scala
scala> sample.registerTempTable("primer")
```
Step (11): To perform SQL queries on the loaded data (registered as Table) in Spark
```scala
scala> val mydf1 = sqlContext.sql("select restaurant_id, name, borough, cuisine from primer where cuisine == 'American'")
scala> mydf1.show()
```
```scala
scala> val mydf2 = sqlContext.sql("select restaurant_id, address, grades, borough, cuisine from primer where borough == 'Queens' or cuisine == 'American'")
scala> mydf2.show()
```
Step (12): To save the outputs of the (Step 11) SQL queries from Spark into MongoDB
```scala
scala> mydf1.write.option("collection", "Query1_output").mode("overwrite").format("com.mongodb.spark.sql").save()
```
```scala
scala> mydf2.write.option("collection", "Query2_output").mode("overwrite").format("com.mongodb.spark.sql").save()
```
Step (13): To view the stored outputs of the Step 12 SQL queries (as collections) from the database (Sivijaya) of MongoDB
Step (14): To Stop Mongo Shell
hduser@ubuntu:~$ sudo service mongod stop
mongod stop/waiting
7 INTEGRATING MONGODB & SPARK ANALYTICS WITH BI TOOLS & HADOOP
Real time analytics generated by MongoDB and Spark can serve both online operational applications and offline reporting systems, where it can be blended with historical data and analytics from other data sources. To power dashboards, reports and visualizations, MongoDB offers integration with more of the leading BI and Analytics platforms than any other non-relational database, including tools from Actuate, Alteryx, Informatica, Qliktech, and Talend etc.
A range of ODBC/JDBC connectors\(^8\) for MongoDB provide integration with additional analytics and visualization platforms including Tableau [13] and others. At the most fundamental level, each connector provides read and write access to MongoDB. The connector enables the BI platform to access MongoDB documents, parse them before blend them with other data. Result sets can also be written back to MongoDB if required. More advanced functionality available in some BI connectors [14] includes integration with the MongoDB aggregation framework for in-database analytics and summarization, schema discovery and intelligent query routing within a replica set.
8 CONCLUSION
The MongoDB Connector is a plugin for both Hadoop and Spark that provides the ability to use MongoDB as an input source and/or an output destination for jobs running in both environments. The connector directly integrates Spark with MongoDB and has no dependency on also having a Hadoop cluster running.
Input and output classes are provided allowing users to read and write against both live MongoDB collections and against BSON (Binary JSON) files that are used to store MongoDB snapshots. Also, JSON formatted queries and projections can be used to filter the input collection, which uses a method in the connector to create a Spark RDD from the MongoDB collection.
\(^8\) http://www.simba.com/
https://www.progress.com/datadirect-connectors
MongoDB natively provides a rich analytics framework within the database. Multiple connectors are also available to integrate Spark with MongoDB to enrich analytics capabilities by enabling analysts to apply libraries for machine learning, streaming and SQL to MongoDB data.
REFERENCES
[8] https://www.mongodb.com
[10] https://docs.mongodb.com/
|
{"Source-Url": "http://sdiwc.net/digital-library/request.php?article=1ed2a4b58e5be78bec5c4e1eae4dc444", "len_cl100k_base": 4607, "olmocr-version": "0.1.48", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 26855, "total-output-tokens": 5447, "length": "2e12", "weborganizer": {"__label__adult": 0.000247955322265625, "__label__art_design": 0.00031495094299316406, "__label__crime_law": 0.00033164024353027344, "__label__education_jobs": 0.0005745887756347656, "__label__entertainment": 8.630752563476562e-05, "__label__fashion_beauty": 0.00011414289474487303, "__label__finance_business": 0.00047850608825683594, "__label__food_dining": 0.00028586387634277344, "__label__games": 0.0004405975341796875, "__label__hardware": 0.0011663436889648438, "__label__health": 0.0003638267517089844, "__label__history": 0.0001952648162841797, "__label__home_hobbies": 8.702278137207031e-05, "__label__industrial": 0.0004477500915527344, "__label__literature": 0.00017273426055908203, "__label__politics": 0.0002065896987915039, "__label__religion": 0.00030732154846191406, "__label__science_tech": 0.07208251953125, "__label__social_life": 0.00011157989501953124, "__label__software": 0.05999755859375, "__label__software_dev": 0.861328125, "__label__sports_fitness": 0.0001971721649169922, "__label__transportation": 0.00034308433532714844, "__label__travel": 0.00017917156219482422}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 20766, 0.02013]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 20766, 0.44219]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 20766, 0.80687]], "google_gemma-3-12b-it_contains_pii": [[0, 2916, false], [2916, 6006, null], [6006, 9089, null], [9089, 11745, null], [11745, 13399, null], [13399, 15957, null], [15957, 16299, null], [16299, 17463, null], [17463, 19505, null], [19505, 20766, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2916, true], [2916, 6006, null], [6006, 9089, null], [9089, 11745, null], [11745, 13399, null], [13399, 15957, null], [15957, 16299, null], [16299, 17463, null], [17463, 19505, null], [19505, 20766, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 20766, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 20766, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 20766, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 20766, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 20766, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 20766, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 20766, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 20766, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 20766, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 20766, null]], "pdf_page_numbers": [[0, 2916, 1], [2916, 6006, 2], [6006, 9089, 3], [9089, 11745, 4], [11745, 13399, 5], [13399, 15957, 6], [15957, 16299, 7], [16299, 17463, 8], [17463, 19505, 9], [19505, 20766, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 20766, 0.06667]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
3a36f2840e4988d5e30e11dbf4c0017d297a5b31
|
Route Origin Validation - A MANRS Approach
Md. Zobair Khan
MANRS Ambassador
Acknowledgement
• This paper is made taking notes, diagram, configurations from MANRS, APNIC training materials & blog, NLnet Labs, Github & Dr. Philip Smith along with the operational experience of the author.
MANRS
• Mutually Agreed Norms for Routing Security (MANRS) is a global initiative, supported by the Internet Society, that provides crucial fixes to reduce the most common routing threats.
MANRS
• MANRS outlines four simple but concrete actions that network operators should take:
• Filtering
• Anti-spoofing
• Coordination
• Global Validation
Global Validation
- Publish your data, so others can validate routing information on a global scale
- Automated information validation needs arrangements
- Securing global routing information is done by RPKI
Resource Public Key Infrastructure (RPKI)
• RPKI allows holders of Internet number resources to make verifiable statements about how they intend to use their resources.
• RPKI is a way to define data in an out-of-band system such that the information that are exchanged by BGP can be validated to be correct.
• RPKI is used to make Internet routing more secure.
Importance of RPKI
• Secured Routing Table
• Dynamic LOA checking
• Maintaining a Dynamic Chain of Trust
• Digitally Signed Resources Certificate (X.509 Certificates-RFC5280)
• Helps to Stop Route Hijack
Route Origin Authorizations (ROA)
• Using the RPKI system, the legitimate holder of a block of IP addresses can use their resource certificate to make an authoritative, signed statement about which autonomous system is authorized to originate their prefix in BGP.
• These statements are called Route Origin Authorizations (ROAs).
Route Origin Validation (ROV)
- RPKI system tries to closely mimic what route objects in the IRR intend to do, but then in a more trustworthy manner.
- This process is called route origin validation (ROV)
Validity
• Valid - Resources found in database which is called Validated ROA Payload (VRP).
• Invalid – Resources found but partial/whole information doesn’t match with database.
• Not Found - The prefix in this announcement is not covered by a VRP.
RPKI - Chain Of Trust
RIR Root CA
- APNIC
- LACNIC
- ARIN
- RIPE NCC
- AFRINIC
NIR Child CA
- Some APNIC & LACNIC countries only
- NIR
- LIR
- LIR
- LIR
- LIR
- LIR
LIR Child CA
- ISP
- ISP
(Optional) ISP Child CA
Ecosystem
Working Steps
• Creating ROA for owned resources for RPKI
• Implementing Validator relying software for ROV
• Enforcing policies for based on Validation
Creating ROA
- Go to Resources > Route Management and select Create route
Creating ROA
• Mention your prefix with ASN & desired subnet & Submit
Example for IPv4
Relying Party Software
- NLnet Labs Routinator
https://github.com/NLnetLabs/routinator
- LACNIC/NIC Mexico validator (FORT)
https://github.com/NICMx/FORT-validator
- Cloudflare validator (OctoRPKI)
https://github.com/cloudflare/cfrpki
- RPKI-Client
https://github.com/kristapsdz/rpki-client
Routinator
- Routinator is free, open source RPKI Relying Party software written by NLnet Labs in the Rust programming language.
- Routinator connects to the Trust Anchors of the five Regional Internet Registries (RIRs) — APNIC, AFRINIC, ARIN, LACNIC and RIPE NCC — downloads all of the certificates and ROAs in the various repositories, verifies the signatures and makes the result available for use in the BGP workflow.
- The validated cache can be fed directly into RPKI-capable routers via the RPKI to Router Protocol (RPKI-RTR), described in RFC 8210.
Installation (Routinator)
Step by step installation process is given in Appendix-1 at the end of this slide.
OctoRPKI
- Developed and used by Cloudflare
- This application periodically refreshes the data provided by the RIRs and the delegated organizations.
- No development after December 2020.
- RTR session is handled by GoRTR – a separate module.
Installation (OctoRPKI)
Step by step installation process is given in Appendix-1 at the end of this slide.
FORT Validator
• FORT validator is an MIT-licensed RPKI Relying Party, this is a tool offered as part of the FORT project.
• FORT is a joint initiative by LACNIC, the Regional Internet Registry for Latin America and the Caribbean, and NIC.MX.
• RTR Configuration is done with json file.
Installation (FORT)
Start fort as a service.
Check the status. It will take some time to build the first validated cache.
Step by step installation process is given in Appendix-1 at the end of this slide.
RPKI-Client
• rpki-client is a FREE, easy-to-use implementation of the Resource Public Key Infrastructure (RPKI)
• The program queries the RPKI repository system and outputs Validated ROA Payloads in the configuration format of either OpenBGPD or BIRD, but also as CSV or JSON objects for consumption by other routing stacks.
• rpki-client was primarily developed as part of the OpenBSD Project and gets released as a base component of OpenBSD every six months.
Installation (RPKI-Client)
If everything goes smoothly, you will be able to see the ROA summary.
`bgpctl show sets`
You can apply RPKI information to reject invalids on import and export
`deny quick from ebgp ovs invalid`
`deny quick to ebgp ovs invalid`
Step by step installation process is given in Appendix-1 at the end of this slide.
Hardware OS
**Juniper** - Junos version 12.2 and newer.
**Cisco** - IOS release 15.2 and newer, as well as Cisco IOS/XR since release 4.3.2.
**Nokia** - SR OS 12.0.R4 and newer, running on the 7210 SAS, 7250 IXR, 7750 SR, 7950 XRS and the VSR.
**Arista** - EOS 4.24.0F and newer
**MikroTik** - 7.0beta7 and newer
**Huawei** - VRP 8.150 and newer.
Router Configuration
```
router bgp [ASN]
rpki server [SERVER IP]
transport tcp port 3323
refresh-time 120
address-family ipv4 unicast
bgp origin-as validation signal ibgp
address-family ipv6 unicast
bgp origin-as validation signal ibgp
```
Decision
• Since now the validation states are visible to you, you can decide what to do with invalids
• You can –
– Use them with low preference
– Or drop them
Policy
route-policy RPKI
if validation-state is invalid then
set local-preference 50
else
if validation-state is valid then
set local-preference 200
else
pass
endif
endif
endif
end-policy
route-policy RPKI
if validation-state is invalid then
drop
else
if validation-state is valid then
set local-preference 200
else
pass
endif
endif
endif
end-policy
FAH Deployment
• Fiber@Home is one of the largest Internet Gateway in Bangladesh.
• We have implemented Routinator as our validator software.
• We are still in observation period and not dropping the invalids yet.
• Communicating with our clients to make them ready for the dropping of invalids.
• A proud member of MANRS and getting all the benefits from being in the elite platform of Routing Security.
• Securing global routing information is done by RPKI.
One Last Thing
• ARIN has announced a surprised maintenance of 30 min in July 2021. Announcement was made on 2\textsuperscript{nd} June 2021.
• They are doing it to make sure that their RPKI infrastructure is running with peak performance.
• \url{https://www.arin.net/announcements/20210602-rpki/}
• Also Job Snijders has shared some valuable insights on this maintenance work.
• \url{https://lists.arin.net/pipermail/arin-tech-discuss/2021-June/000932.html}
• Our learning –
– When you deploy RPKI, you need to keep an eye on your RPKI infrastructure performance.
– You need to make sure that any maintenance work is informed to your clients way ahead.
– Also you need to be aware of the events taking places in RIRs regarding their RPKI Infrastructure.
Reference
- https://www.manrs.org/about/
- https://blog.apnic.net/2019/10/28/how-to-installing-an-rpki-validator/
- https://github.com/cloudflare/cfrpki#ctorpki
- https://www.rpki-client.org/
Appendix-1
- Step by Step Installation of Routinator
- Step by Step Installation of OctoRPKI
- Step by Step Installation of Fort
- Step by Step Installation of RPKI-Client
Appendix-1
• Step by Step Installation of Routinator
Installation (Routinator)
Add the line below that corresponds to your operating system to your `/etc/apt/sources.list` or `/etc/apt/sources.list.d/`
```
deb [arch=amd64] https://packages.nlnetlabs.nl/linux/debian/ stretch main
deb [arch=amd64] https://packages.nlnetlabs.nl/linux/debian/ buster main
deb [arch=amd64] https://packages.nlnetlabs.nl/linux/ubuntu/ xenial main
deb [arch=amd64] https://packages.nlnetlabs.nl/linux/ubuntu/ bionic main
deb [arch=amd64] https://packages.nlnetlabs.nl/linux/ubuntu/ focal main
```
Installation (Routinator)
Then run the following commands to add the public key and update the repository list:
```
wget -qO- https://packages.nlnetlabs.nl/aptkey.asc | sudo apt-key add -
sudo apt update
```
You can then install Routinator by running this command
```
sudo apt install routinator
```
```bash
nano@ROV:~$ sudo apt install routinator
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
routinator
0 upgraded, 1 newly installed, 0 to remove and 197 not upgraded.
Need to get 3,287 kB of archives.
After this operation, 10.1 MB of additional disk space will be used.
Get:1 https://packages.ninetlabs.nl/linux/ubuntu xenial/main amd64 routinator amd64 0.9.0-1xenial [3,287 kB]
Fetched 3,287 kB in 2s (1,438 kB/s)
Selecting previously unselected package routinator.
(Reading database ... 80683 files and directories currently installed.)
Preparing to unpack .../routinator_0.9.0-1xenial_amd64.deb ...
Unpacking routinator (0.9.0-1xenial) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up routinator (0.9.0-1xenial) ...
Adding system user 'routinator' (UID 113) ...
Adding new group 'routinator' (GID 120) ...
Adding new user 'routinator' (UID 113) with group 'routinator' ...
Creating home directory '/var/lib/routinator/' ...
routinator.service is a disabled or a static unit, not starting it.
```
Installation (Routinator)
Initialise, enable and start Routinator by running these commands.
```bash
sudo routinator-init # (This command should be given in /home/user/ directory)
sudo systemctl enable --now routinator
```
```bash
nano@ROV:~$ sudo routinator-init
Running command as user routinator: routinator --config /etc/routinator/routinator.conf init
before we can install the ARIN TAL, you must have read
and agree to the ARIN Relying Party Agreement (RPA).
It is available at
https://www.arin.net/resources/manage/rpki/rpa.pdf
If you agree to the RPA, please run the command
again with the --accept-arin-rpa option.
Fatal error. Exiting.
```
```bash
nano@ROV:~$ sudo routinator-init --accept-arin-rpa
Running command as user routinator: routinator --config /etc/routinator/routinator.conf init --accept-arin-rpa
Created local repository directory /var/lib/routinator/rpki-cache
Installed 5 TALs in /var/lib/routinator/tals
```
```bash
nano@ROV:~$ sudo systemctl enable --now routinator
Created symlink from /etc/systemd/system/multi-user.target.wants/routinator.service to /lib/systemd/system/routinator.service.
nano@ROV:~$
```
Installation (Routinator)
By default, Routinator will start the RTR server on port 3323 and the HTTP server on port 8323 which can be changed in `/etc/routinator/routinator.conf`. You can check the status of Routinator with `sudo systemctl status routinator` and view the logs with `sudo journalctl --unit=routinator`
Installation (Routinator)
routinator -v vrps
routinator server --rtr SERVER-IP:3323 --http SERVER-IP:9556 --refresh=900 &
Installation (Routinator)
Appendix-1
• Step by Step Installation of OctoRPKI
Installation (OctoRPKI)
First, go to the Releases tab, download the latest version matching your platform.
Installation (OctoRPKI)
To install the Linux deb package and start it:
```bash
$ sudo dpkg -i octorpki_1.1.4_amd64.deb
$ sudo systemctl start octorpki
```
Installation (OctoRPKI)
mkdir tals
cd tals
wget https://www.arin.net/resources/manage/rpki/arin-rfc7730.tal -O arin.tal
cd ..
Installation (OctoRPKI)
Look into the tals directory to check if you have got all the 5 tals or not.
Run the validator by issuing the following command.
```
nohup octorpki -output.sign=false > out 2> err &
```
Installation (OctoRPKI)
If the validator runs smoothly, you will see the ROAs in web format by querying a json file.
The validated cache output uses default port 8081.
GoRTR metrics uses default port 8080.
You can build RTR session on your desired port.
Installation (OctoRPKI)
GoRTR is Cloudflare’s RPKI-RTR server component, which allows RPKI-enabled routers to connect to it and fetch the validated cache (ROA cache).
```bash
wget https://github.com/cloudflare/gotr/releases/download/v0.14.7/gotr_0.14.7_amd64.deb
dpkg -i gotr_0.14.7_amd64.deb
```
Installation (OctoRPKI)
```
```
```
root@routinator-2:~#
root@routinator-2:~# nophup gortr -bind=163.47.159.22:8282 -metrics.addr=:8080 -verify=false -cache=http://163.47.159.22:8081/output.json > out 2> err &
[2] 6483
root@routinator-2:~#
root@routinator-2:~# ps ax | grep gortr
6483 pts/0 Sl 0:06 gortr -bind=163.47.159.22:8282 -metrics.addr=:8080 -verify=false -cache=http://163.47.159.22:8081/output.json
6584 pts/0 Sr+ 0:00 grep --color=auto gortr
root@routinator-2:~# ps ax | grep octo
5690 pts/0 Sl 6:02 octorpi -output.sign=false
6588 pts/0 Sr+ 0:00 grep --color=auto octo
root@routinator-2:~#
```
```
RP/0/RSP1/CPU0:C-AGG-1#sh bgp rpki server summary
Mon Jun 7 16:20:55.602 BST
Hostname/Address | Transport | State | Time | ROAS (IPv4/IPv6)
-----------------|-----------|-------|------|----------------
163.47.159.22 | TCP:8282 | ESTAB | 00:02:07 | 214077/39923
RP/0/RSP1/CPU0:C-AGG-1#
```
Appendix-1
• Step by Step Installation of Fort
Installation (FORT)
It has some dependencies. So need to resolve those first.
```
sudo apt install openssl rsync libjansson-dev -y
```
Version 1.5.0 is the latest official release. To fetch or review it, visit the GitHub release
```
sudo wget https://github.com/NICMx/FORT-validator/releases/download/v1.5.0/fort_1.5.0-1_amd64.deb
sudo apt install ./fort_1.5.0-1_amd64.deb
```
Installation (FORT)
You will find an example config.json file inside `/etc/fort/example`.
Rename the actual config.json file to something else and copy the config file from example directory to `/etc/fort/`
In this way it will be much more easier to configure without destroying the json format.
Change the below parameters if required.
Tal
Local-repository
Address
Port
Rest of the fields should be fine with default values.
Installation (FORT)
Get the tals including Arin.
```
sudo fort --init-tals --tal=/etc/fort/tal
```
```bash
nano@routinator-2:~$ cd /etc/fort/tal
nano@routinator-2:/etc/fort/tal$
Please download and read ARIN Relying Party Agreement (RPA) from https://www.arin.net/resources/manage/rpki/rpa.pdf. Once you've read it and if you agree ARIN RPA, type 'yes' to proceed with ARIN's TAL download:
```
yes
Successfully fetched '/etc/fort/tal/arin.tal'!
Successfully fetched '/etc/fort/tal/apnic.tal'!
Successfully fetched '/etc/fort/tal/afrinic.tal'!
Successfully fetched '/etc/fort/tal/ripe.tal'!
Successfully fetched '/etc/fort/tal/lacnic.tal'!
```
Installation (FORT)
Start fort as a service.
Check the status. It will take some time to build the first validated cache.
Appendix-1
• Step by Step Installation of RPKI-Client
Installation (RPKI-Client)
First, you'll need a recent OpenSSL library (version 1.1.1c and above) on your operating system.
Next, you'll need the /var/cache/rpki-client directory in place. It must be writable by the operator of rpki-client.
```
mkdir /var/cache/rpki-client
```
The default output directory is /var/db/rpki-client, which must also be writable (if not overridden).
```
mkdir /var/db/rpki-client
```
Installation (RPKI-Client)
Get the software from git hub
`gh repo clone kristapsdz/rpki-client`
Edit the make file and put 0 in the value of RPKI_PRIVDROP. If the value is 0, it doesn’t use the Privilege Drop user.
Installation (RPKI-Client)
Get the TALs.
fetch https://rpki.afrinic.net/tal/afrinic.tal
fetch https://www.arin.net/resources/manage/rpki/arin-rfc7730.tal
fetch https://www.lacnic.net/innovaportal/file/4983/1/lacnic.tal
fetch https://tal.apnic.net/apnic.tal
fetch https://tal.rpki.ripe.net/ripe-ncc.tal
Installation (RPKI-Client)
You will be needing open rsync for cache refresh operation.
```
pkg install openrsync
```
Go to rpki-client directory and Install rpki-client and run it with mentioning the cache location.
```
./configure
make
make install
./rpki-client --v --d /var/cache/rpki-client/ /var/db/rpki-client/
```
Installation (RPKI-Client)
If everything goes smoothly, you will be able to see the ROA summury.
```
bgpctl show sets
```
You can apply RPKI information to reject invalids on import and export
```
deny quick from ebgp ovs invalid
deny quick to ebgp ovs invalid
```
Query !!
Join MANRS : manrs.org/join/
Thanks ...
|
{"Source-Url": "https://www.sanog.org/resources/sanog37/SANOG37_Conference-Route_Origin_Validation-A_MANRS_Approach-Md_Zobair_Khan-FiberatHome.pdf", "len_cl100k_base": 4770, "olmocr-version": "0.1.50", "pdf-total-pages": 60, "total-fallback-pages": 0, "total-input-tokens": 65273, "total-output-tokens": 7409, "length": "2e12", "weborganizer": {"__label__adult": 0.00040340423583984375, "__label__art_design": 0.0002351999282836914, "__label__crime_law": 0.0008654594421386719, "__label__education_jobs": 0.0009822845458984375, "__label__entertainment": 0.0001709461212158203, "__label__fashion_beauty": 0.00019276142120361328, "__label__finance_business": 0.0007429122924804688, "__label__food_dining": 0.0002930164337158203, "__label__games": 0.00102996826171875, "__label__hardware": 0.005954742431640625, "__label__health": 0.000331878662109375, "__label__history": 0.00046706199645996094, "__label__home_hobbies": 0.00015783309936523438, "__label__industrial": 0.000823974609375, "__label__literature": 0.00031757354736328125, "__label__politics": 0.0004534721374511719, "__label__religion": 0.0004608631134033203, "__label__science_tech": 0.1470947265625, "__label__social_life": 0.00018715858459472656, "__label__software": 0.2388916015625, "__label__software_dev": 0.59814453125, "__label__sports_fitness": 0.0004582405090332031, "__label__transportation": 0.0011234283447265625, "__label__travel": 0.00028634071350097656}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 18037, 0.02109]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 18037, 0.19367]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 18037, 0.77478]], "google_gemma-3-12b-it_contains_pii": [[0, 77, false], [77, 289, null], [289, 479, null], [479, 643, null], [643, 852, null], [852, 1217, null], [1217, 1426, null], [1426, 1758, null], [1758, 1965, null], [1965, 2218, null], [2218, 2436, null], [2436, 2446, null], [2446, 2602, null], [2602, 2677, null], [2677, 2843, null], [2843, 3146, null], [3146, 3767, null], [3767, 3877, null], [3877, 4120, null], [4120, 4228, null], [4228, 4518, null], [4518, 4726, null], [4726, 5191, null], [5191, 5534, null], [5534, 5887, null], [5887, 6131, null], [6131, 6298, null], [6298, 6718, null], [6718, 7179, null], [7179, 7943, null], [7943, 8354, null], [8354, 8527, null], [8527, 8581, null], [8581, 9105, null], [9105, 9315, null], [9315, 10513, null], [10513, 11657, null], [11657, 11976, null], [11976, 12100, null], [12100, 12126, null], [12126, 12178, null], [12178, 12286, null], [12286, 12443, null], [12443, 12943, null], [12943, 13156, null], [13156, 13414, null], [13414, 13713, null], [13713, 14766, null], [14766, 14814, null], [14814, 15196, null], [15196, 15628, null], [15628, 16275, null], [16275, 16399, null], [16399, 16454, null], [16454, 16873, null], [16873, 17091, null], [17091, 17395, null], [17395, 17720, null], [17720, 17987, null], [17987, 18037, null]], "google_gemma-3-12b-it_is_public_document": [[0, 77, true], [77, 289, null], [289, 479, null], [479, 643, null], [643, 852, null], [852, 1217, null], [1217, 1426, null], [1426, 1758, null], [1758, 1965, null], [1965, 2218, null], [2218, 2436, null], [2436, 2446, null], [2446, 2602, null], [2602, 2677, null], [2677, 2843, null], [2843, 3146, null], [3146, 3767, null], [3767, 3877, null], [3877, 4120, null], [4120, 4228, null], [4228, 4518, null], [4518, 4726, null], [4726, 5191, null], [5191, 5534, null], [5534, 5887, null], [5887, 6131, null], [6131, 6298, null], [6298, 6718, null], [6718, 7179, null], [7179, 7943, null], [7943, 8354, null], [8354, 8527, null], [8527, 8581, null], [8581, 9105, null], [9105, 9315, null], [9315, 10513, null], [10513, 11657, null], [11657, 11976, null], [11976, 12100, null], [12100, 12126, null], [12126, 12178, null], [12178, 12286, null], [12286, 12443, null], [12443, 12943, null], [12943, 13156, null], [13156, 13414, null], [13414, 13713, null], [13713, 14766, null], [14766, 14814, null], [14814, 15196, null], [15196, 15628, null], [15628, 16275, null], [16275, 16399, null], [16399, 16454, null], [16454, 16873, null], [16873, 17091, null], [17091, 17395, null], [17395, 17720, null], [17720, 17987, null], [17987, 18037, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 18037, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 18037, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 18037, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 18037, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 18037, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 18037, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 18037, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 18037, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 18037, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 18037, null]], "pdf_page_numbers": [[0, 77, 1], [77, 289, 2], [289, 479, 3], [479, 643, 4], [643, 852, 5], [852, 1217, 6], [1217, 1426, 7], [1426, 1758, 8], [1758, 1965, 9], [1965, 2218, 10], [2218, 2436, 11], [2436, 2446, 12], [2446, 2602, 13], [2602, 2677, 14], [2677, 2843, 15], [2843, 3146, 16], [3146, 3767, 17], [3767, 3877, 18], [3877, 4120, 19], [4120, 4228, 20], [4228, 4518, 21], [4518, 4726, 22], [4726, 5191, 23], [5191, 5534, 24], [5534, 5887, 25], [5887, 6131, 26], [6131, 6298, 27], [6298, 6718, 28], [6718, 7179, 29], [7179, 7943, 30], [7943, 8354, 31], [8354, 8527, 32], [8527, 8581, 33], [8581, 9105, 34], [9105, 9315, 35], [9315, 10513, 36], [10513, 11657, 37], [11657, 11976, 38], [11976, 12100, 39], [12100, 12126, 40], [12126, 12178, 41], [12178, 12286, 42], [12286, 12443, 43], [12443, 12943, 44], [12943, 13156, 45], [13156, 13414, 46], [13414, 13713, 47], [13713, 14766, 48], [14766, 14814, 49], [14814, 15196, 50], [15196, 15628, 51], [15628, 16275, 52], [16275, 16399, 53], [16399, 16454, 54], [16454, 16873, 55], [16873, 17091, 56], [17091, 17395, 57], [17395, 17720, 58], [17720, 17987, 59], [17987, 18037, 60]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 18037, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
069472844ce12826c2dde50e7b680bd05fde0b53
|
INVESTIGATING THE POSSIBILITY OF A MICROPROCESSOR-BASED MACHINE TRANSLATION SYSTEM
Harold L. Somers
Centre for Computational Linguistics
University of Manchester Institute of Science and Technology
PO Box 88, Manchester M60 1QD, England
ABSTRACT
This paper describes ongoing research project being carried out by staff and students at the Centre for Computational Linguistics to examine the feasibility of Machine Translation (MT) in a microprocessor environment. The system incorporates as far as possible features of large-scale MT systems that have proved desirable or effective; it is multilingual, algorithms and data are strictly separated, and the system is highly modular. Problems of terminological polysemy and syntactic complexity are reduced via the notions of controlled vocabulary and restricted syntax. Given these constraints, it seems feasible to achieve translation via an 'interlingua', avoiding any language-pair oriented 'transfer' stage. The paper concentrates on a description of the separate modules in the translation process as they are currently envisaged, and details some of the problems specific to the microprocessor-based approach to MT that have so far come to light.
I. BACKGROUND AND OVERVIEW
This paper describes preliminary research in the design of Bede, a limited-syntax controlled-vocabulary Machine Translation system to run on a microprocessor, translating between English, French, German and Dutch. Our experimental corpus is a car-radio manual. Bede (named after the 7th Century English linguist) is essentially a research project: we are not immediately concerned with commercial applications, though such are clearly possible if the research proves fruitful. Work on Bede at this stage though is primarily experimental. The aim at the moment is to investigate the extent to which a microprocessor-based MT system of advanced design is possible, and the limitations that have to be imposed in order to achieve a working system. This paper describes the overall system design specification to which we are currently working.
In the basic design of the system we attempt to incorporate as much as possible features of large-scale MT systems that have proved to be desirable or effective. Thus, Bede is multilingual by design. Algorithms and linguistic data are strictly separated, and the system is designed in core or less independent modules.
The microprocessor environment means that certain important data structures both dynamic (created by and manipulated during the translation process) and static (dictionaries and linguistic rule packages) are constrained to be as economical in terms of storage space and access procedures as possible. Limitations on in-core and peripheral storage are important considerations in the system design.
In large general purpose MT systems, it is necessary to assume that failure to translate the given input correctly is generally not due to incorrectly formed input, but to insufficiently elaborated translation algorithms. This is particularly due to two problems: the lexical problem of choice of appropriate translation equivalents, and the strategic problem of effective analysis of the wide range of syntactic patterns found in natural language. The reduction of these problems via the notions of controlled vocabulary and restricted syntax seems particularly appropriate in the microprocessor environment, since the alternative of making a system infinitely extendable is probably not feasible.
Given these constraints, it seems feasible to achieve translation via an Interlingua, in which the canonical structures from the source language are mapped directly onto those of the target language(s), avoiding any language-pair oriented 'transfer' stage. Translation thus takes place in two phases: analysis of source text and synthesis of target text.
A. Incorporation of recent design principles
Modern MT system design can be characterised by three principles that have proved to be desirable and effective (Lenmann et al, 1980:1-3): each of these is adhered to in the design of Bede.
Bede is multilingual by design: early MT systems were designed with specific language-pairs in mind, and translation algorithms were elaborated on this basis. The main consequence of this was that source language analysis was effected within the perspective of the given target language, and was therefore often of little or no use on the addition into the system of a further language (cf. King, 1971:12; King & Perschke, 1982:28).
In Bede, there is a strict separation of algorithms and linguistic data: early MT systems were quite simply 'translation programs', and the
underlying linguistic theory which might have been present was inextricably bound up with the program itself. This clearly entailed the disadvantage that any modification of the system had to be done by a skilled programmer (cf. Johnson, 1970:140). Furthermore, the side-effects of apparently quite innocent modifications were often quite far-reaching, and difficult to trace (see for example Bostad, 1982:130). Although this has only recently become an issue in MT (e.g. Vauquois, 1979:1:3; 1981:10), it has of course for a long time been standard practice in other areas of knowledge-based programming (Newell, 1973; Davis & King, 1977).
The third principle now current in MT and to be incorporated in Bede is that the translation process should be modular. This approach was a feature of the earliest 'second generation' systems (cf. Vauquois, 1975:33), and is characterised by the general notion that any complicated computational task is best tackled by dividing it up into smaller more or less independent sub-tasks which communicate only by means of a strictly defined interface protocol (Aho et al, 1974). This is typically achieved in the MT environment by a gross division of the translation process into analysis of source language and synthesis of target language, possibly with an intermediate transfer stage (see 1.0 below), with these phases in turn sub-divided, for example into morphological, lexical and syntactico-semantic modules. This modularity may be reflected both in the linguistic organisation of the translation process and in the provision of software devices specifically tailored to the relevant sub-task (Vauquois, 1975:33). This is the case in Bede, where for each sub-task a grammar interpreter is provided which has the property of being no more powerful than necessary for the task in question. This contrasts with the approach taken in TAUM-Médéro (TAUM, 1973), where a single general-purpose device (Colmerauer's (1970) 'O-Systems') is provided, with the associated disadvantage that for some 'simple' tasks the superfluous power of the device means that processes are seriously uneconomical. Bede incorporates five such 'grammar types' with associated individual formalisms and processors: these are described in detail in the second half of this paper.
B. The microprocessor environment
It is in the microprocessor basis that the principle interest in this system lies, and, as mentioned above, the main concern is the effects of the restrictions that the environment imposes. Development of the Bede prototype is presently taking place on Z80-based machines which provide 64k bytes of in-core memory and 720k bytes of peripheral store on two 5-1/4" double-density floppy disks. The intention is that any commercial version of Bede would run on more powerful processors with larger address space, since we feel that such machines will soon rival the non-sufficiency of the less powerful Z80's as the standard desk-top hardware. Programming so far has been in Pascal-" (Soricic, 1979), a Pascal dialect closely resembling UCSD Pascal, but we are conscious of the fact that both C (Kernighan & Ritchie, 1978) and BCPL (Richards & Whitty-Strevens, 1979) may be more suitable for some of the software elements, and do not rule out completing the prototype in a number of languages. This adds the cost of more complex interfacial data-structures and interfaces, and we are currently investigating the relative merits of these languages. Portability and efficiency seem to be in conflict here.
Microprocessor-based MT contrasts sharply with the mainframe-based activity, where the significance of problems of economy of storage and efficiency of programs has decreased in recent years. The possibility of introducing an element of human interaction with the system (cf. Kay, 1980; Melby, 1981) is also highlighted in this environment. Contrast systems like SYSTRAN (Toma, 1977) and GETA (Vauquois, 1975, 1979; Boitet & Nedobekjine, 1980) which work on the principle of large-scale processing in batch mode.
Our experience so far is that the economy and efficiency in data-structure design and in the elaboration of interactions between programs and data and between different modules is of paramount importance. While it is relatively evident that large-scale MT can be simulated in the microprocessor environment, the cost in real time is tremendous: entirely new design and implementation strategies seem to be called for. The ancienst skills of the programmer that have become eroded by the generosity afforded by modern mainframe configurations become highly valued in this microprocessor application.
C. Controlled vocabulary and restricted syntax
The state of the art of language processing is such that the analysis of a significant range of syntactic patterns has been shown to be possible, and by means of a number of different approaches. Research in this area nowadays is concentrated on the treatment of more problematic constructions (e.g. Marcus, 1980). This observation has led us to believe that a degree of success in a small scale MT project can be achieved via the notion of restricting the complexity of acceptable input, so that only constructions that are sure to be correctly analysed are permitted. This notion of restricted syntax MT has been tried with some success in larger systems (cf. Elliston, 1970; Lawson, 1979:181; Somers & McNaught, 1980:141), resulting both in more accurate translation, and in increased legibility from the human point of view. As Elliston points out, the development of strict guidelines for writers leads not only to the use of simpler constructions, but also to the avoidance of potentially ambiguous text. In either case, the benefits for MT are obvious. Less obvious however is the acceptability of such constraints; yet 'restricted syntax' need not imply 'baby talk', and a reasonably extensive range of constructions can be included.
Just as problems of syntactic analysis can be alleviated by imposing some degree of control over
the syntactic complexity of the input, so the corresponding problem of lexical disambiguation that large-scale MT users are faced with can be eased by the notion of controlled vocabulary. A major problem for MT is the choice of appropriate translation equivalents at the lexical level, a choice often determined by a variety of factors at all linguistic levels (syntax, semantics, pragmatics). In the field of multilingual terminology, this problem has been tackled via the concept of terminological equivalence (Wüster, 1971); for a given concept in one language, a translation in another language is established, these being considered by definition to be in one-to-one correspondence. In the case of Bede, where the subject-matter of the texts to be translated is fixed, such an approach for the 'technical terms' in the corpus is clearly feasible; the notion can be extended as far as possible to general vocabulary as well. For each concept a single term only is permitted, and although the resulting style may appear less mature (since the use of near synonyms for the sake of variety is not permitted), the problems described above are somewhat alleviated. Polysemy is not entirely avoidable, but if reduced to a bare minimum, and permitted only in specific and acknowledged circumstances, the problem becomes more easily manageable.
D. Interlingua
A significant dichotomy in MT is between the 'transfer' and 'interlingual' approaches. The former can be characterised by the use of bilingual transfer modules which convert the results of the analysis of the source language into a representation appropriate for a specific target language. This contrasts with the interlingual approach in which the result of analysis is passed directly to the appropriate synthesis module.
It is beyond the scope of the present paper to discuss in detail the relative merits of the two approaches (see Vaquoir, 1975:142ff; Huschins, 1978). We should however consider some of the major obstacles inherent in the interlingual approach.
The development of an Interlingua for various purposes (not only translation) has been the subject of philosophical debate for some years, and proposals for MT have included the use of formalized natural language (e.g. Mel'čuk, 1974; Andreew, 1967), artificial languages (like Esperanto), or various symbolic representations, whether linear (e.g. Bolting, 1961) or otherwise (e.g. Velka, 1973). Most of these approaches are problematic however (for a thorough discussion of the interlingua approach to MT, see Otten & Pacak (1971) and Barnes (1983)). Nevertheless, some interlingual-based MT systems have been developed to a considerable degree: for example, the French team's first attempts at MT took this approach (Weillon, 1968), while the TITUS system still in use at the Institut Textile de France (Ducrot, 1972; Zingel, 1978) is claimed to be interlingua-based.
It seems that it can be assumed a priori that an entirely language-independent theoretical representation of a given text is to all practical purposes impossible. A more realistic target seems to be a representation in which significant syntactic differences between the languages in question are neutralized so that the best one can aim for is a language-specific (sic) representation. This approach implies the definition of an Interlingua which takes advantage of anything the languages in the system have in common, while accommodating their idiosyncrasies. This means that for a system which involves several fairly closely related languages the interlingual approach is at least feasible. On the understanding that the introduction of a significantly different type of language may involve the complete redefinition of the Interlingua (Barnes, 1983). From the point of view of Bede, then, the common base of the languages involved can be used to good advantage. The notion of restricted syntax described above can be employed to filter out constructions that cause particular problems for the chosen Interlingua representation.
There remains however the problem of the representation of lexical items in the Interlingua. Theoretical approaches to this problem (e.g. Andreew, 1967) seem quite unsatisfactory. But the notion of controlled vocabulary seems to offer a solution. If a one-to-one equivalence of 'technical terms' can be achieved, this leaves only a relatively small area of vocabulary for which an interlingual representation must be devised. It seems reasonable, on a small scale, to treat general vocabulary in an analogous way to technical vocabulary, in particular creating lexical items in one language that are ambiguous with respect to any of the other languages as 'homographs'. Their 'disambiguation' must take place in Analysis as there is no bilingual 'Transfer' phase, and Synthesis is purely deterministic. While this approach would be quite unsuitable for a large-scale general purpose MT system, in the present context - where the problem can be minimised - it seems to be a reasonable approach.
Our own model for the Bede Interlingua has not yet been finalised. We believe this to be an area for research and experimentation once the system software has been more fully developed. Our current hypothesis is that the Interlingua will take the form of a canonical representation of the text in which valency-boundness and (deep) case will play a significant role. Sentential features such as tense and aspect will be captured by a 'universal' system of values for the languages involved. This conception of an Interlingua clearly falls short of the language-independent pivot representation typically envisaged (cf. Boitet & Nedobekine, 1980:2), but we hope to demonstrate that it is sufficient for the languages in our system, and that it could be adapted without significant difficulties to cater for the introduction of other (related) Western European languages. We feel that research in this area will, when the time comes, be a significant
II. DESCRIPTION OF THE SYSTEM DESIGN
In this second half of the paper we present a description of the translation process in Bede, as it is currently envisaged. The process is divided broadly into two parts, analysis and synthesis, the interface between the two being provided by the Interlingua. The analysis module follows a Chart-like structure (cf. Kaplan, 1973) and a series of grammars to produce from the source text the Interlingua tree structure which serves as input to synthesis, where it is rearranged into a valid surface structure for the target language. The 'translation unit' (TU) is taken to be the sentence, or equivalent (e.g. section heading, title, figure caption). Full details of the rule formalisms are given in Somers (1981).
A. String segmentation
The TU is first subjected to a two-stage string-segmentation and 'lemmatisation' analysis. In the first stage it is compared word by word with a 'stop-list' of frequently occurring words (mostly function words); words not found in this stop-list undergo string-segmentation analysis, again on a word by word basis. String-segmentation rules form a finite-state grammar of affix-stripping rules ('A-rules') which handle mostly inflectional morphology. The output is a Chart with labelled arcs indicating lexical unit (LU) and possible interpretation of the stripped affixes, this 'hypothesis' to be confirmed by dictionary look-up. By way of example, consider (1), a possible French rule, which takes any word ending in -isons (e.g. finissons or hârissons) and constructs an arc on the Chart recording the hypothesis that the word is an inflected form of an 'ir' verb (i.e. finir or hârir).
(1) \( \text{V} = \text{'-IONS'} \rightarrow \text{V} \rightarrow \text{'IR'} \)
\[
\text{[PERS=1 \& NUM=PLUR \& TENSE=PRES \& MOOD=INDIC]}
\]
At the end of dictionary look-up, a temporary 'sentence dictionary' is created, consisting of copies of the dictionary entries for (only) those LUs found in the current TU. This is purely an efficiency measure. The sentence dictionary may of course include entries for homographs which will later be rejected.
B. Structural analysis
1. 'P-rules'
The chart then undergoes a two-stage structural analysis. In the first stage, context-sensitive augmented phrase-structure rules ('P-rules') work towards creating a single arc spanning the entire TU. Arcs are labelled with appropriate syntactic class and syntactico-semantic feature information and a trace of the lower arcs which have been subsumed from which the parse tree can be simply extracted. The trivial P-rule (2) is provided as an example.
(2) \( \text{<NUM(DET)=NUM(N) \& GDR(DET).INT.GDR(N)>} \)
\[
\text{DET} \rightarrow \text{NP}
\]
\[
\text{GDR(NP)}; \rightarrow \text{GDR(N) \& NUM(NP)} \rightarrow \text{NUM(N)}
\]
P-rules consist of 'condition stipulations', a 'geometry', and 'assignment stipulations'. The nodes of the Chart are by default identified by the value of the associated variable CLASS, though it is also possible to refer to a node by a local variable name and test for or assign the value of CLASS in the stipulations. Our rule formalisms are quite deliberately designed to reflect the formalisms of traditional linguistics.
This formalism allows experimentation with a large number of different context-free parsing algorithms. We are in fact still experimenting in this area. For a similar investigation, though on a machine with significantly different time and space constraints, see Slocum (1981).
2. 'T-rules'
In the second stage of structural analysis, the arc structure implied by the labels and traces on these arcs is disjoined from the Chart and undergoes general tree-to-tree-transductions as described by 'T-rules', resulting in a single tree structure representing the canonical form of the TU.
'The formalism for the T-rules is similar to that for the P-rules, except in the geometry part, where tree structures rather than arc sequences are defined. Consider the necessarily more complex (though still simplified) example (3), which regularises a simple English passive.
(3) \( \text{\langle LU(AUX)="BE" \& PART(\text{V})=\text{PASTPART} \& \text{LH(PREP)="BY" \& CASE(NP(2))=AGENT} \rangle} \)
\[
\text{S(NP(1)-AUX+V+NP(2)(PREP+\text{VP(1)}))}\rightarrow \text{\langle DSF(NP(2))=DOBJ \& VOICE(V)=PASSV \& DSF(NP(1))=OBJ \rangle}
\]
Notice the necessity to 'disambiguate' the two NPs via curly-bracketted disambiguators; the possibility of defining a partial geometry via the 'dummy' symbol ($) and how the AUX and PREP are eliminated in the resulting tree structure. Labellings for nodes are copied over by default unless specifically suppressed.
With source-language LUs replaced by unique multilingual-dictionary addresses, this canonical representation is the Interlingua which is passed for synthesis into the target language(s).
C. Synthesis
Assuming the analysis has been correctly performed, synthesis is a relatively straightforward deterministic process. Synthesis commences with the application of the T-rules which assign new order and structure to the Interlingua as appropriate. The synthesis T-rules for a given language can be viewed as analogues of the T-rules that are used for analysis of that language, though it is unlikely that for synthesis
the analysis rules could be simply reversed.
Once the desired structure has been arrived at, the trees undergo a series of context-sensitive rules used to assign mainly syntactic features to the leaves ('L-rules'), for example for the purpose of assigning number and gender concord (etc.). The formalism for the L-rules is again similar to that for the P-rules and T-rules, the geometry here this defining a single tree structure with no structural modification implied. A simple example for German is provided here (4).
< SF(NP)=SUBJ>
< CASE(Det)=WNom & CASE(N)=WNOM &
NUM(Det)=NUM(N) & GDR(Det)=GDR(N)>
The list of labelled leaves resulting from the application of L-rules is passed to morphological synthesis (the superior branches are no longer needed), where a finite-state grammar of morphographic and affixation rules ('H-rules') is applied to produce the target string. The formalism for H-rules is much less complex than the A-rule formalism, the grammar being again straightforwardly deterministic. The only taxing requirement of the H-rule formalism (which at the time of writing, has not been finalised) is that it must permit a wide variety of string manipulations to be described, and that it must define a transparent interface with the dictionary. A typical rule for French for example might consist of stipulations concerning information found both on the leaf in question and in the dictionary, as in (5).
(5) leaf info.: CLASS=W; TENSE=PASS; NUM=SING;
PERS=3; MOOD=INDIC
dict. info.: CONJ(V)=IRREG
assign: Affix "-T" to STEM1(V)
D. General comments on system design
The general modularity of the system will have been quite evident. A key factor, as mentioned above, is that each of these grammars is just powerful enough for the task required of it; thus no computing power is wasted at any of the intermediate stages.
At each interface between grammars only a small part of the data structures used by the donating module is required by the receiving module. The 'unwanted' data structures are written to peripheral store to enable recovery of partial structures in the case of failure or mistranslation, though automatic backtracking to previous modules by the system as such is not envisaged as a major component.
The 'static' data used by the system consists of the different sets of linguistic rule packages, plus the dictionary. The system essentially has one large multilingual dictionary from which numerous software packages generate various subdictionaries as required either in the translation process itself, or for lexicographers working on the system. Alphabetical or other structured language-specific listings can be produced, while of course dictionary updating and editing packages are also provided.
The system as a whole can be viewed as a collection of Production Systems (PSs) (Newell, 1973; Davis & King, 1977; see also Ashman (1982) on the use of PSs in MT) in the way that the rule packages (which, incidentally, as an efficiency measure, undergo separate syntax verification and 'compilation' into interpretable 'code') operate on the data structure. The system differs from the classical PS setup in distributing its static data over two databases: the rule packages and the dictionary. The combination of the rule packages and the dictionary, the software interfacing these, and the rule interpreter can however be considered as analogous to the rule interpreter of a classical PS.
III. CONCLUSION
As an experimental research project, Bede provides us with an extremely varied range of computational linguistics problems, ranging from the principally linguistic task of rule-writing, to the essentially computational work of software implementation, with lexicography and terminology playing their part along the way.
But we hope too that Bede is more than an academic exercise, and that we are making a significant contribution to applied computational linguistics research.
IV. ACKNOWLEDGMENTS
I present this paper only as spokesman for a large group of people who have worked, are working, or will work on Bede. Therefore I would like to thank colleagues and students at C.C.L., past, present and future for their work on the project, and in particular Rod Johnson, Jack McNaught, Pete Whitelock, Kieran Kilby, Toni Barnes, Paul Bennett and Beverley Ashman for help with this write-up. I of course accept responsibility for any errors that slipped through that tight net.
V. REFERENCES
153
Barnes, Antonia M.N. An investigation into the syntactic structures of abstracts, and the definition of an 'interlingua' for their translation by machine. MSc thesis. Centre for Computational Linguistics, University of Manchester Institute of Science and Technology, 1983.
|
{"Source-Url": "http://www.mt-archive.info/70/ANLP-1983-Somers.pdf", "len_cl100k_base": 5660, "olmocr-version": "0.1.50", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 25462, "total-output-tokens": 8049, "length": "2e12", "weborganizer": {"__label__adult": 0.0009632110595703124, "__label__art_design": 0.00165557861328125, "__label__crime_law": 0.0007882118225097656, "__label__education_jobs": 0.006999969482421875, "__label__entertainment": 0.0007200241088867188, "__label__fashion_beauty": 0.0004191398620605469, "__label__finance_business": 0.0005173683166503906, "__label__food_dining": 0.0008673667907714844, "__label__games": 0.0016078948974609375, "__label__hardware": 0.00284576416015625, "__label__health": 0.0013704299926757812, "__label__history": 0.0011301040649414062, "__label__home_hobbies": 0.0001723766326904297, "__label__industrial": 0.0010662078857421875, "__label__literature": 0.0328369140625, "__label__politics": 0.0008382797241210938, "__label__religion": 0.0017576217651367188, "__label__science_tech": 0.387939453125, "__label__social_life": 0.00032782554626464844, "__label__software": 0.031219482421875, "__label__software_dev": 0.52197265625, "__label__sports_fitness": 0.00041794776916503906, "__label__transportation": 0.00146484375, "__label__travel": 0.00027871131896972656}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 32953, 0.0328]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 32953, 0.43518]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 32953, 0.88722]], "google_gemma-3-12b-it_contains_pii": [[0, 4661, false], [4661, 10694, null], [10694, 16672, null], [16672, 21967, null], [21967, 26977, null], [26977, 31557, null], [31557, 32953, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4661, true], [4661, 10694, null], [10694, 16672, null], [16672, 21967, null], [21967, 26977, null], [26977, 31557, null], [31557, 32953, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 32953, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 32953, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 32953, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 32953, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 32953, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 32953, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 32953, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 32953, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 32953, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 32953, null]], "pdf_page_numbers": [[0, 4661, 1], [4661, 10694, 2], [10694, 16672, 3], [16672, 21967, 4], [21967, 26977, 5], [26977, 31557, 6], [31557, 32953, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 32953, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-01
|
2024-12-01
|
1e48d88a3f3d46d81f8d8dc27698ffad94c362e0
|
DynNav: Toward Open and Interoperable Navigation Services
Original
Availability:
This version is available at: 11583/2594962 since: 2020-12-14T08:57:39Z
Publisher:
IEEE Computer Society, Los Alamitos, CA
Published
DOI:10.1109/MITP.2016.20
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
©2016 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)
DynNav: Toward Open and Interoperable Dynamic Navigation Services
Piergiuseppe Bettassa, Politecnico di Torino, piergiuseppe.bettassa@polito.it
Cecilia Corbi, Telecom Italia Lab, ceciliamaria.corbi@telecomitalia.it
Giorgio Ghinamo, Telecom Italia Lab, giorgio.ghinamo@telecomitalia.it
Pietro Leggero, Intelligent App, p.leggero@mytaxi.net
Fulvio Risso, Politecnico di Torino, fulvio.risso@polito.it
Riccardo Sisto, Politecnico di Torino, riccardo.sisto@polito.it
Francesco Vadalà, Telecom Italia Lab, francesco.vadala@telecomitalia.it
So far navigation devices, including navigation apps for smartphones, have been proprietary and closed. A new scenario is emerging with the Open Mobile Alliance Dynamic Navigation Enabler, which lets developers create novel navigation services characterized by openness and interoperability across different information providers.
1 Introduction
Navigation Devices (NDs), which are common tools for getting driving assistance, are increasingly integrating local information (e.g., maps, user position) with remote data such as real-time traffic information. However, the ND of one manufacturer is hardly capable to access data provided by a different service provider, as current systems are either proprietary, or even totally closed.
Google Navigation and Apple Maps are well-known examples of proprietary solutions. They define a set of APIs, exploitable by other parties, but they do not guarantee interoperability with other solutions; even more importantly, those APIs may have some technical/legal limitations. For instance, Google does not allow the use of its data in applications other than Google Navigation [1], [2]. In addition, Google APIs are subject to change at any time. Other solutions, such as TomTom or Garmin either rely on the old radio-based broadcast communication channel, or exploit a closed architecture (services, protocols), hence preventing users from switching to another provider. Moreover, previous solutions, having monolithic nature, do not allow the use of alternative components (e.g., better real-time traffic information sources), and offer only limited chances to customize them.
In order to overcome many of these limitations, recently the Open Mobile Alliance (OMA) standardized an open protocol for dynamic road navigation services. The OMA Dynamic Navigation Enabler [3], in short, DynNav, introduces a bidirectional communication channel and a modular approach, while reusing existing standards for some specific features. The bidirectional channel allows users to ask for or receive only the information they are interested in, by filtering data based on routes, geographic areas and time [4]. The standardized modular approach allows multiple services to be created on top of the defined components and it enables the same service to be provided by multiple operators (avoiding users lock-in), and to be implemented in multiple flavors. In this way, new actors can participate in the provisioning of navigation services, with the creation of valuable and/or specialized components, such as route computation algorithms optimized for vertical markets (e.g., goods delivery), precise traffic information, and more. Modularity and openness allow users not only to exploit multiple providers in their solution (e.g., one for route computation, the other one for traffic information), but also to seamlessly change provider.
Among the possible players, telecom mobile operators may have huge benefits from an open standard for navigation services. First, they are constantly looking for the possibility to provide new services to their customers, and dynamic navigation is an appealing option for many users. Second, mobile operators can obtain traffic information by exploiting their own assets, in particular by (anonymously) tracking the position of their mobile users, hence providing real-time traffic information and re-routing capabilities based on real-time data.
In this context, and in particular in the case of smart cities, where multiple sources of real-time data are available, such as traffic, parking lots availability, and more, DynNav-enabled solutions can not only provide navigation services, but also become aggregators of multiple information sources, helping users to find localized information such as restaurants or attractions, possibly matching user’s preferences and interests.
2 The DynNav solution
OMA, the leading industry forum for developing market-driven, interoperable mobile service enablers, completed the standardization process of DynNav in September 2012. This represents an additional step toward the full support of navigation applications by the OMA standardization framework [3].
2.1 Architecture
Figure 1 presents a possible architecture of a navigation service based on DynNav. The server is the middle block, while the left block represents a typical ND (e.g., a dedicated device or a smartphone). A DynNav client can also be an application residing on a server (right side in figure), such as a web-based journey planner.

DynNav specifies the interaction between a DynNav client and a DynNav server (the straight lines in Figure 1) while the interactions with the other components (the dashed lines) rely on protocols that are outside the scope of the DynNav specification. Additional elements, not depicted in Figure 1, can be introduced to optimize the bandwidth consumption, which is critical in mobile communications. For example, proxy servers can cache frequent responses.
2.2 Protocol
A server that implements DynNav provides the following main functions:
1. Analysis of client-defined trip parameters and proposal of a set of routes, based on real-time and forecast traffic data;
2. Provisioning of real-time and forecast traffic information related to a set of routes (or geographical areas), previously proposed by the DynNav server itself or by the ND;
3. Proposal of new routes when the quality indicators associated with the current route become unacceptable or the user deviates from the current route;
4. Provisioning of complementary information such as Points of Interest (POI) related to either a route or an area;
5. Possibility for the client to subscribe to a set of routes, and to be notified of available information about these routes only when the user is driving along one of them.
It is worth noting that a client could not be allowed to access all the functions listed above: the DynNav service provider can allow/deny access to some functions depending on the user contract or other criteria.
2.3 Data structures
The DynNav specification reuses, whenever possible, data structures already defined in previous standards, with the objective of speeding up the implementation and facilitating the integration of additional components/services into the framework. Particularly, it exploits the Transport Protocol Experts Group (TPEG) standards for road traffic messages and location, traffic events, road performance (e.g., travelling time) and location entity description [7]. Moreover, it exploits IETF RFC 4776 [8] for civic addresses and the W3C “Points of Interest Core” draft [9] for POI information. The drawback of this approach is the impossibility to obtain a fully optimized protocol, as data formats and protocol messages may be more verbose than necessary. As no public standards are currently available for encoding route information, a novel encoding schema has been proposed: a route is represented by a sequence of segments (i.e., road sections without intersections), each one including segment origin, destination, name, measured or forecast performance parameters (travelling time in regular conditions, delays, expected speed) and segment shape (sequence of points for its graphical representation on the map).
Figure 2 depicts a portion of the DynNav resource tree (the complete structure is shown in [4]) and a sample of request and response messages. The curly brackets identify parametric parts of the URIs. The trips resource contains a collection of trip resources, each one identified by its unique tripId. A trip resource includes information about the journey (e.g., source and destination) along with nested resources representing alternative routes to the destination. These resources, identified by their unique routeId, include routing information and may also include references to sets of events, grouped by categories. Users can obtain the details by sending a request to the server, containing the list of events to be retrieved. The selection of interesting events can either be done manually or automatically by the client application. This choice can reduce the amount of bytes transmitted over the network because only interesting events are retrieved, even if it introduces a small delay due to the additional request. If the same event is shared by multiple resources, such as different routes or areas, it is transmitted only once. Events can be stored in proxy servers, if present, reducing the number of requests to the main server.
2.4 Use case example
A typical application of the DynNav service refers to a ND without path computation capabilities, which may originate the message flow depicted in Figure 3 (a detailed description is available in [4]). In this scenario, the user first specifies the parameters of a trip by sending Message #1, which triggers the creation of a new trip resource in the server, including all the details about the trip as provided by the user. Trip creation also forces the server to calculate a set of routes that satisfy the constraints. Then the client retrieves and selects one of the possible routes proposed by the server by Messages #2 and #3. The route includes links to the occurred events (whose descriptions are stored on the server) and a field that specifies the category (e.g., traffic, weather) of each event. A client application may decide not to retrieve all those events from the server (Message #4), based on user preferences or other criteria (e.g., priorities). Message #5 creates a subscription to the notification service in order to receive real-time traffic information updates and the proposal of alternative routes. The DynNav server will use user-provided location data in order to update the user’s status and send notifications about traffic and other events specified in the user’s subscription. If the estimated travelling time becomes too high, e.g., because of road congestion, a new route can be suggested. Message #6 represents a notification from the server and it contains the references to related events, which can be retrieved as in Message #4.
2.5 Deployment scenarios
The flexibility of the DynNav standard enables the creation of rich navigation services without locking users with a specific service provider and/or using a fixed set of functions. This is possible because the same service (e.g., route computation) can be provided by different entities, and the basic set of DynNav messages can be combined in (almost) arbitrary ways to create complex applications. For example, DynNav supports both smart NDs, which have the capability to calculate routes and rely on central services only for real-time information (e.g., traffic), and lightweight NDs, which delegate everything but the user interaction (e.g., route display) to central services.
The possibility to exploit services provided by multiple entities also enables the creation of applications targeting very specific vertical markets. For example, a shipping goods company can opt for a lightweight ND for its employees, relying on an in-house service for route computation, with the ability to minimize delivery costs, and on a telecom operator to obtain real-time traffic information. Along the same line, a company can setup only a specialized service that suggests the best points of interest based on the user’s preferences or other parameters, relying on the fact that other providers can offer the other information required for building a whole navigation service.
3 Validation
We implemented the DynNav standard in a prototype that includes both the client and server portions of the specification. We used those components to carry out an extended set of tests aimed to validate the characteristics of the standard in a real world environment and to give an insight of the performance achievable by this solution. Particularly, we were interested in checking whether DynNav is suitable for delivering navigation services to real mobile devices. Although our prototype was not engineered to compete with commercially available solutions, we compared DynNav with the widely used Google Directions Web Services [1], which offers similar primitives and exploits a similar data structure.
3.1 Prototype
The DynNav server was developed in Java and installed on a GlassFish application server, while the ND hosting our application was a low-end Android 2.2 smartphone clocked at 768MHz with 512MB of memory.
Some specific functions of the server were set up by reusing existing external components: route calculation is delegated to an external web service (http://openrouteserver.org), while traffic data are simulated using a real data source to feed the simulator.
The DynNav prototype described here has been shown in an OMA demo session. Details (presentation and interview) can be found in [10], [11].
3.2 Tests
We focused on a common worst-case usage pattern in which a lightweight DynNav client asks for the entire information related to a trip, delegating route computation to the server. This implies that the client device is forced to request even the data necessary to display the chosen path on the map.
First, we measured the amount of data generated by the protocol, which, if excessive, could have a negative impact on performance in low-bandwidth environments. The overall results, computed by averaging several trips of different complexities, showed that DynNav messages are in average 40% bigger than Google messages. However, this overhead also includes information about real-time driving times and events (e.g., traffic jams, accidents) associated with the route, not reported by Google Directions. In order to limit this overhead, we enabled the HTTP compression that is supported by most HTTP implementations and reduces the total bytes transferred. In our experiments, we observed a compression rate of about 2.8:1 in route messages, with a 10% processing time increase (due to compression/decompression) in the ND. With compression enabled, DynNav messages are in average 35% bigger than (compressed) Google messages.
In the second test we measured the time elapsed between starting a route request and receiving the associated response. This time needs to be as short as possible as it represents the waiting time for the ND user. Tests showed that the average latency for obtaining the route is approximately 300ms, excluding the time required by the server to compute the route, calculated on 25 realistic trips of different complexity. While this number is three times the one experienced in Google Directions, this value is still reasonable as human beings will hardly notice the difference in terms of responsiveness between the two systems. The higher latency is due to the larger size and number of messages (i.e., HTTP GET requests) needed to complete the same operation. This is required in order to enable a greater extent of flexibility in the protocol and support different deployment scenarios with a limited set of primitives, such as NDs with/without route computation capabilities and/or navigation maps.
A third test evaluated the processing overhead of the protocol in the ND, with the final objective of assessing the possibility to execute DynNav services on low-end user terminals. Our measures showed that the average processing cost for a message transporting route information in the selected ND is about 2.5ms for each Km of the route, which represents an acceptable value even for long routes. This confirms that the choice of using rich XML messages, which are known to be more computationally demanding than binary encoded messages, does not represent an issue on modern user terminals at least in this use case.
Table 1 shows how the performance of the system changes when dealing with routes of increasing lengths, with HTTP compression. These data confirm that the DynNav performance figures remain acceptable within the typical route complexity range.
<table>
<thead>
<tr>
<th>Route length [kilometers]</th>
<th>Message size [KB]</th>
<th>Transmission Time [ms]</th>
<th>Processing time on client [ms]</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>Google Directions</td>
<td>DynNav</td>
<td>Google Directions</td>
</tr>
<tr>
<td>53.73</td>
<td>4.29</td>
<td>5.24</td>
<td>72.15</td>
</tr>
<tr>
<td>244.84</td>
<td>7.18</td>
<td>9.34</td>
<td>76.30</td>
</tr>
<tr>
<td>600.96</td>
<td>20.63</td>
<td>31.48</td>
<td>95.62</td>
</tr>
<tr>
<td>878.95</td>
<td>34.07</td>
<td>45.53</td>
<td>114.88</td>
</tr>
<tr>
<td>1034.00</td>
<td>29.40</td>
<td>39.43</td>
<td>108.19</td>
</tr>
</tbody>
</table>
Table 1: Tests results
4 Conclusions
Based on the new scenarios enabled by DynNav and on our experiments, we can conclude that DynNav has the potential to change the way navigation services are conceived, implemented and deployed, by making it more open and interoperable. Improvements are also possible and OMA is working on an enhanced version. Future work should be directed to optimize the definition of resources and to add new resources such as detailed parking information, public transportation, indoor navigation, weather conditions. In fact, the warm acceptance of this standard among different players (ND/smartphone manufacturers, telecom operators) is pushing for further evolutions, particularly with respect to value-added services (e.g., points of interest, support for vertical applications such as logistics). Additional studies, in collaboration with other mobile operators, are currently ongoing to define optimized mechanisms for reducing and compressing the amount of transferred data.
The prototype that has been developed to validate the DynNav solution shows excellent results, even on a non-optimized implementation. Although in some cases the performance looks inferior than in proprietary solutions (e.g., Google Directions) albeit hardly noticeably by final users, our DynNav prototype enables interoperability and greater flexibility thanks to its additional features, such as push-based notification services and customizable real-time information.
5 Biographies
Piergiuseppe Bettassa graduated in Computer Engineering from Politecnico di Torino in 2011 and he enrolled in the PhD program. His research interests are on formal methods applied to security protocols and security-aware applications, software engineering and model driven development. Contact him at piergiuseppe.bettassa@polito.it.
Fulvio Risso, PhD, is assistant professor with the Control and Computer Engineering Department of Politecnico di Torino, Italy. His current research activities focus on network protocols, traffic analysis, efficient packet processing and software-defined networks. Contact him at fulvio.risso@polito.it.
Riccardo Sisto, PhD in Computer Engineering, has been working at Politecnico di Torino, in the Control and Computer Engineering Department, first as a researcher, then as an associate professor and, since 2004, as a full professor of Computer Engineering. His main research interests are in the areas of formal methods and communication protocol engineering. Contact him at riccardo.sisto@polito.it.
Cecilia Corbi graduated in 1985 in Mathematics. With more than 25 years of experience in the telecommunications field, she has been working as Project Manager for cellular network operators in several areas of expertise in innovation and strategy. She is currently Application and Services Standards manager in Telecom Italia, and serving as Board Vice Chair of the Open Mobile Alliance. Contact her at ceciliamaria.corbi@telecomitalia.it.
Giorgio Ghinamo, graduated cum Laude in 1995 at Politecnico di Torino in Telecommunication Engineering. Researcher at Telecom Italia, his current interests refer to positioning technologies and related applications. He has been involved in navigation related standardization framework in OMA. Contact him at giorgio.ghinamo@telecomitalia.it.
Francesco Vadalà graduated cum Laude in 1996 from the Università di Messina in Electronic Engineering. Researcher at Telecom Italia, he has been working in different innovation/technical strategy and R&D areas. He analyses emerging technologies and coordinates standard activities in the areas of service layer. He is currently serving as Technical Plenary Chairman of the Open Mobile Alliance. Contact him at francesco.vadala@telecomitalia.it.
Pietro Leggero graduated in 2012 from Politecnico di Torino in Computer Engineering. Software architect and mobile application developer, specialist on Android, Java, RESTful WS, Geolocation, PAAS and NFC technologies, he develops and contributes to investigate on the new emergent mobile technologies. Head of Mobile development at SeekAnGoo. Contact him at p.leggero@mytaxi.net.
6 References
|
{"Source-Url": "https://iris.polito.it/retrieve/handle/11583/2594962/e384c42e-3b30-d4b2-e053-9f05fe0a1d67/IT_ITPro-2014-03-0027.R2_Bettassa.pdf", "len_cl100k_base": 4496, "olmocr-version": "0.1.53", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 29793, "total-output-tokens": 5740, "length": "2e12", "weborganizer": {"__label__adult": 0.001807212829589844, "__label__art_design": 0.0006957054138183594, "__label__crime_law": 0.0013475418090820312, "__label__education_jobs": 0.0010442733764648438, "__label__entertainment": 0.0004665851593017578, "__label__fashion_beauty": 0.0005345344543457031, "__label__finance_business": 0.0009293556213378906, "__label__food_dining": 0.0012922286987304688, "__label__games": 0.0025768280029296875, "__label__hardware": 0.0204010009765625, "__label__health": 0.001316070556640625, "__label__history": 0.002094268798828125, "__label__home_hobbies": 0.0001908540725708008, "__label__industrial": 0.002040863037109375, "__label__literature": 0.0009212493896484376, "__label__politics": 0.0011548995971679688, "__label__religion": 0.0014009475708007812, "__label__science_tech": 0.326171875, "__label__social_life": 0.0003154277801513672, "__label__software": 0.054931640625, "__label__software_dev": 0.456298828125, "__label__sports_fitness": 0.001262664794921875, "__label__transportation": 0.11883544921875, "__label__travel": 0.002017974853515625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24806, 0.04366]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24806, 0.13984]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24806, 0.89954]], "google_gemma-3-12b-it_contains_pii": [[0, 1122, false], [1122, 1658, null], [1658, 5833, null], [5833, 7674, null], [7674, 10374, null], [10374, 11964, null], [11964, 14084, null], [14084, 17815, null], [17815, 21742, null], [21742, 24731, null], [24731, 24806, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1122, true], [1122, 1658, null], [1658, 5833, null], [5833, 7674, null], [7674, 10374, null], [10374, 11964, null], [11964, 14084, null], [14084, 17815, null], [17815, 21742, null], [21742, 24731, null], [24731, 24806, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 24806, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24806, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24806, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24806, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24806, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24806, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24806, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24806, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24806, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24806, null]], "pdf_page_numbers": [[0, 1122, 1], [1122, 1658, 2], [1658, 5833, 3], [5833, 7674, 4], [7674, 10374, 5], [10374, 11964, 6], [11964, 14084, 7], [14084, 17815, 8], [17815, 21742, 9], [21742, 24731, 10], [24731, 24806, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24806, 0.08163]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
96cf0b40bf8f873c7e6352d0b929374a185a1180
|
SOFTWARE PATENTS—JUST MAKE A GOOD THING BETTER†
David R. Syrowik *
I. INTRODUCTION
In recent years, the number of software-related patents¹ sought from and issued by the United States Patent and Trademark Office (the Patent Office) has rapidly increased.² Furthermore, recent actions and decisions
† Originally submitted as a position paper for an online panel discussion.
* Mr. Syrowik holds a B.S. degree in electrical engineering from the University of Michigan and a J.D. degree from Wayne State Law School. Mr. Syrowik is an adjunct professor with the Intellectual Property Law Institute, a program including the law faculties of Wayne State University, University of Windsor, and University of Detroit.
¹ The term “software” is used somewhat differently by various authors. However, for purposes of this paper, software is defined to be computer programs. A program can be thought of as the intelligence or control logic communicated to a computer in order to enable the computer to perform a particular function. Typically, a computer program is prepared to solve a problem or to automate a mundane or complex task (i.e., to “teach” a general purpose machine to perform a particular desired function). Initially, specific methods for solving the problem are fashioned in a “logic” or “algorithm” stage. A block diagram “flowchart” may be prepared. The program is then written in a “coding” stage. This typically results in a sequence of instructions in a rigidly defined language which may have a resemblance to English. This is a “source program” which must be translated into an “object program” which is a sequence of “bits” (i.e., zeros and ones) that the computer understands. Consequently, a program is a set of instructions which embodies the logic or algorithm used to solve the initial problem.
The fact that there is a functional equivalence between hardware and software is important to an understanding of software-related patents. That is, technology has blurred the distinction between hardware (wired circuits) and software (program) solutions to the same problem such that there is generally a functional equivalence between a program executed by a computer and a wired electrical and/or electronic logic circuit. This fact was effectively brought out by one of the witnesses during the 1994 Software Patent Hearings. See infra note 5.
A software-related patent is defined herein as a patent that claims some feature, function, or process embodied in a program that is executed on a computer as a substantially significant portion of its invention. See, e.g., John P. Sumner & Steven W. Lundberg, The Versatility of Software Patent Protection: From Subroutines to Look and Feel, The Computer Lawyer, June 1986, at 1.
² Classes 364 and 395 are generally acknowledged to be those in which the Patent Office classifies most software-related patents. Class 395 was created in 1991 and replaced selected art areas of Class 364. The creation of Class 395 seems to at least partially remove one reason that the Supreme Court relied upon in denying patent protection for the software-
by the Patent Office and the Court of Appeals for the Federal Circuit
suggest a trend toward increasing the eligibility of software-based inno-
vations for protection under U.S. patent laws.\(^3\) At the same time, a
number of court decisions have cut back the scope of protection avail-
able for software under the copyright laws.\(^4\)
related invention it reviewed—the Patent Office’s lack of a reliable classification system. See Gottschalk v. Benson, 409 U.S. 63, 72 (1972). It is difficult to determine how many of the patents granted in these classes cover software inventions because the classes include other types of inventions as well. However, 3,270 and 1,174 patents were sought and issued, respectively, in class 364 in 1987. This is to be contrasted with 11,714 and 4,199 patents sought and issued, respectively, in combined Classes 364 and 395 in 1995. This data was obtained by the author on November 13, 1995 from Gerald Goldberg, a Group Art Unit Di-
rector at the Patent Office.
3. On June 1, 1995 the Patent Office released proposed new examination guidelines
for evaluating the patentability of computer-related inventions. Pat. Trademark & Copy-
are intended to assist examiners in their review of applications for software-related inven-
tions. Although the guidelines do not have the status of rules, they govern the Patent Office’s
internal examination policies. These come in the wake of the Patent Office’s recent decision
to reverse its own ruling in In re Beauregard, 53 F.3d 1583 (Fed. Cir. 1995), on the patent-
ability of software embodied on a floppy disk. Moreover, the proposed guidelines and the
Federal Circuit’s en banc decision at 60 F.3d 807 (Fed. Cir. 1995), to vacate its prior panel
decision in In re Trovato, 42 F.3d 1376 (Fed. Cir. 1995), and reconsider the case in light of
In re Alappat, 33 F.3d 1526 (Fed. Cir. 1994) (en banc), indicate that court’s willingness to
extend patent coverage to software-related inventions.
(unprotectable elements of a copyrighted computer program were not sufficiently filtered out
by the district court in its finding of infringement). In Gates, the court adopted the abstrac-
tion-filtration-comparison test under Computer Associate International v. Altai, Inc., 982
F.2d 693 (2d Cir. 1992). This test is more restricted in determining “substantial similarity” in
copyright infringement controversies than the “one idea” approach of Whelan Associates v.
Jaslow Dental Laboratories, Inc., 797 F.2d 1222 (3d Cir. 1986). Two federal appellate courts
recently stated that intermediate copying of computer software for reverse engineering may
be “fair use” as long as the copying is not more than necessary to understand the unprotected
ideas of the work. Sega Enters. v. Accolade, Inc., 977 F.2d 1510 (9th Cir. 1992); Atari
Games Corp. v. Nintendo of Am., Inc., 975 F.2d 832 (Fed. Cir. 1992). In addition, the First
Circuit recently overturned Judge Keeton’s decision of infringement in Lotus Development
Corp. v. Borland International, 49 F.3d 807 (1st Cir. 1995). The court ruled that Borland’s
Quattro Pro spreadsheet could not infringe Lotus’ copyright on its popular 1-2-3 spreadsheet
by copying its menu command hierarchy because Lotus’s menu tree was a “method of op-
eration” and, as such, was “uncopyrightable subject matter.” Lotus, now a unit of IBM, had
argued that the order of menu commands represented a creative decision by a programmer
that was copyrightable. As reported in the January 17, 1996 issue of The Wall Street Journal,
the Supreme Court, on January 16, 1996, split 4-4 with Justice Stevens abstaining, thereby
affirming the appellate decision.
The “virtual identity standard” was the standard adopted by the Ninth Circuit with re-
spect to Apple Computer’s graphical interface. The court refused to view the work as a
whole and apply the “total concept and feel” standard. Apple Computer, Inc. v. Microsoft
Corp., 35 F.3d 1435 (9th Cir. 1994). The court held that Apple was entitled to “thin” protec-
tion only in view of the large proportion of the interface that was licensed and the limited
number of ways that the interface could be expressed.
These developments have raised concerns of many in the software business, especially small and medium sized businesses, who have relied upon copyright and trade secret protection to the exclusion of patents for their software products. Some have stated that software is somehow “different” from other technologies and must be treated differently. Others have gone so far as to advocate the abolition of patents for software-related technologies.
I disagree with both propositions. I believe a heavy burden rests on those who advocate that a particular field of technology should be exempted from the patent system absent a statutory prohibition. Software-related technology should be treated under the U.S. patent laws as any other technology would be treated. Otherwise, investment in the software industry will be negatively impacted. The current patent system is
6. Until 1981, the Patent Office routinely fought the issuance of such patents. Until that time, Supreme Court decisions cast considerable doubt over the statutory authority for the patentability of software. Gottschalk v. Benson, 409 U.S. 63 (1972); Parker v. Flook, 437 U.S. 584 (1978). Consequently, the public and even most patent attorneys held the view that software was not patentable. Trade secret and, later, copyright protection were generally recognized as tried and true forms for protecting one’s software. Com-Share, Inc. v. Computer Complex, Inc., 338 F. Supp. 1229 (E.D. Mich. 1971), aff’d, 458 F.2d 1341 (6th Cir. 1972) (“Unique engineering, logic and coherence” of the computer program protected); Telex Corp. v. IBM Corp., 510 F.2d 894, 911 (10th Cir. 1975); Computer Software Copyright Act of 1980, amending 17 U.S.C. §§ 101, 117; Apple Computer, Inc. v. Franklin Computer Corp., 714 F.2d 1240 (3d Cir. 1983) (computer programs protectable under the copyright laws whether in source or object form, whether an application or operating system program, or whether stored in ROM or other media). The U.S. Supreme Court’s 1981 opinion, Diamond v. Diehr, 450 U.S. 175 (1981), opened the gates for patent protection for computer software. Because so many previously relied on trade secret law to protect their software technology, there is a lack of a comprehensive patent database for examiners to search. This has been one of the primary criticisms against the patentability of software-related inventions. It is believed that this will change as the software industry becomes more aware of the value and applicability of patents and the patent database continues to expand.
9. Professor Chisum has argued that the case Diamond v. Chakrabarty, 447 U.S. 303 (1980), wherein the Court refused to speculate as to the policy implications of the patent system to cover new technologies, supports the position that the burden of proof on the exclusability of algorithms such as software algorithms in a judicial or administrative forum should rest with the side seeking such exclusion. Donald S. Chisum, The Patentability of Algorithms, 47 U. Pitt. L. Rev. 959, 1011 (1986).
vital to the protection of software-related technology and, consequently, to United States industrial competitiveness. Criticism of software-related patents is being addressed by those seeking to improve the patenting process and, over time, will be moot.
II. DIFFERENT OR UNUSUAL ASPECTS OF A COMPUTER PROGRAM
One reason why computer programs are unusual is that they are so pervasive in our lives, in our jobs, and in all types of technology. Computer programs include not only individual software products, such as word processors and spreadsheets, but also software that controls relatively complex manufacturing systems, telephone networks, CAT scanners, and space shuttles, in addition to embedded software that controls engines, antilock braking and traction control systems, and microwave ovens. Indeed, any place a microprocessor can go (almost anywhere), software follows. Advances in microprocessor technology continue to weave computers into the fabric of daily life to the point where they are indistinguishable from it. Consequently, software-related technology is included in most consumer and industrial products amenable to electronic control.
III. THE ECONOMICS OF SOFTWARE AND SOFTWARE PATENTS
The software industry is one of the fastest growing industries in the United States economy today.10 A representative from the Intellectual Property Owners, Inc. (IPO) testified during the 1994 Software Patent Hearings that the revenue for computer-related devices, or the software component of these devices, and systems controlled by software “well exceeds a hundred billion dollars a year.”11 Furthermore, most software research and development is very expensive. Among the top one hun-
10. The Patent Office reports that over the past decade, the computer software industry has evolved into a critical component of the U.S. economy. It is presently the fastest growing industry in the United States, with 1992 sales in the three core elements of the software industry—programming services, prepackaged software, and computer integrated design—accounting for over $36.7 billion of our gross domestic product. The software industry also has created jobs at a remarkable rate. Since 1987, employment in the software industry has risen at an annual rate of 6.6 percent, and today, the industry employs about 4 percent of the American work force. Notice of Hearings on Software Patent Issues, 58 Fed. Reg. 66,347 (1993).
dred packaged software companies, it is estimated that an average of 17% of revenue supports continued R&D.\textsuperscript{12} The importance of protecting this investment in software was underscored later in the IPO representative’s testimony: “[I]nvestors seeking to sponsor a start-up organization or a new enterprise within a larger company would like to have some certitude about what it is that they can hope to have some protection for and how their investments can be protected.”\textsuperscript{13}
Investors typically prefer patents over trade secrets because trade secret protection is lost after disclosure of the secret to the public.\textsuperscript{14} Increasingly, many businesses cannot keep their trade secrets secret because of weakened bonds of loyalty between employees and employers and because of the ability of computer technology to widely disseminate data.\textsuperscript{15}
Because of the increasingly global market for software products, U.S. software developers have a significant and growing interest in protecting the fruits of their intellectual efforts and monetary investments both at home and abroad. Foreign software patents are particularly important due to the inherent limitations of the protection afforded computer software by foreign copyright and trade secret law.\textsuperscript{16}
\textsuperscript{12} Id.
\textsuperscript{13} Id.
\textsuperscript{14} Sheets v. Yamaha Motors Corp., 849 F.2d 179, 183–84 (5th Cir. 1988) (disclosure of a trade secret to persons who have no obligation of confidentiality “extinguishes the property right in the trade secret”).
\textsuperscript{15} Milo Geyelin, \textit{Why Many Businesses Can’t Keep Their Secrets}, WALL ST. J., Nov. 20, 1995, at B1 (companies are increasingly putting their information on computer databases that can be tapped by unauthorized access from within and without the company).
\textsuperscript{16} While most of the major industrial countries and many of the developing countries have amended their copyright laws and regulations to protect software, such laws and regulations follow the traditional copyright law principles of the U.S. which do not protect functional aspects of technology but rather only the original expression of ideas like other literary works. The 1976 Copyright Act states that, “In no case does copyright protection for an original work of authorship extend to any idea, procedure, process, system, method of operation, concept, principle, or discovery, regardless of the form in which it is described, explained, illustrated, or embodied in such work.” Pub. L. No. 94-553, 90 Stat. 2544 (codified as amended at 17 U.S.C. § 102(b) (1995)). Most of the major industrial countries do not have a homogeneous body of trade secret law such as that which exists in the United States. Consequently, trade secret or similar protection is not as predictable in those countries as patent law or even copyright law. Both copyright and patent protection are primarily a matter of national law; neither an “international copyright” nor an “international patent” exists. However, a long history of treaties and conventions have bound a substantial number of countries together—including the major industrial nations—to create an internationally recognized regime of international copyright and patent protection. No such treaties exist with respect to trade secrets. These treaties and conventions do not create protection themselves, but rather accord the same protection for foreigners as that provided by each nation’s domestic laws. In other words, if
In testimony at the 1994 Software Patent Hearings, Microsoft put its money where its mouth was by supporting software patents despite the fact that it was engaged in software patent infringement litigation that resulted in a multi-million dollar jury verdict against it.¹⁷
IV. PATENTS AND THE U.S. PATENT SYSTEM—AN OVERVIEW
A patent is a grant formalized by an official document issued by the U.S. Government.¹⁸ By law, a patent has the attributes of personal property.¹⁹ The patent system has constitutional roots and is intended to promote the advancement of science and the useful arts.²⁰ This ad-
the domestic law of a nation does not provide a software developer adequate protection, a treaty will not remedy the situation.
With respect to copyright, the United States is a member of the Berne Convention and the Universal Copyright Convention. The Berne Convention protects “literary and artistic works” and does not specifically protect computer programs and databases. However, as the United States protects computer programs as literary works in its copyright law, computer programs are granted protection under the Berne Convention in the United States.
The most important international treaty affecting patent rights is the Paris Convention for the Protection of Industrial Property (Paris Convention), which originally came into being as a result of a treaty signed in Paris in 1883. More than one hundred nations are signatories to the Paris Convention, which provides that all participating nations must grant citizens of other signatories to the Convention the same patent protection granted to their own citizens. David R. Syrowik, International Software Protection, 70 Mich. B.J. 656, 656–57 (1991).
17. Stac Elecs. v. Microsoft Corp., No. 93-00413 (C.D. Cal., Jan. 23, 1994). A federal jury in Los Angeles awarded Stac Electronics $120 million dollars when it found that Microsoft had infringed Stac’s data compression software patents. At the hearings, the Microsoft representative stated:
The U.S. software industry has experienced quite remarkable growth. Measured over the past ten years, it is the fastest growing industry in this country by any rational measurement: it is now larger than all but four or five industries in this country’s economy. The growth has been fueled by strong export performance by U.S. companies: 75% of the world’s sales of pre-packaged [sic] software come from U.S. software companies, and the 100 largest American software companies earn more than 50% of their revenues from offshore sales.
The key to much of this is strong intellectual property protection, which we and our colleagues and competitors in the industry view as essential for the U.S. software industry to continue to compete globally and continue to play a leadership role in this nation’s economy.
20. U.S. Const. art. I, § 8, cl. 2 ("The Congress shall have power . . . To promote the progress of science and useful arts, by securing for limited times to authors and inventors the exclusive right to their respective writings and discoveries."); Kewanee Oil Co. v. Bicron Corp., 416 U.S. 470, 480 (1974).
vancement is promoted by granting limited exclusive rights to inventors in return for public disclosure of inventions.
As noted at the 1994 Software Patent Hearings, many companies and universities would not be willing to publish technical articles if they could not concurrently file patent applications to ensure that publication of such articles does not compromise the value of any invention described therein. Moreover, public disclosure through issued patents and published technical articles encourages scientific and technological advancement.21
Patents are granted for processes, machines, articles of manufacture, compositions of matter, and improvements thereof.23 Mathematical algorithms and formulae as such cannot be patented because they are expressions of laws of nature or science which the Patent Act excludes.24 For example, Einstein could not have patented \( E=mc^2 \).
Patents are granted for a twenty-year term from the date a patent application is filed with the Patent Office,25 during which time the patented invention may be licensed,26 publicly disclosed, or distributed without jeopardizing its legal protection. The owner of a patent has the right to exclude others from making, using, offering to sell, or selling the patented invention in the U.S., its possessions, and territories.27 This
---
23. 35 U.S.C. § 101 (1984) (“Whoever invents or discovers any new and useful process, machine, manufacture, or composition of matter, or any new and useful improvement thereof, may obtain a patent therefor, subject to the conditions and requirements of this title.”). Inventions may be patented only if they fall within one of the four statutory classes of subject matter of 35 U.S.C. § 101: “[P]rocess, machine, manufacture, or composition of matter . . . .” See Kewanee Oil, 416 U.S. at 483. See also 35 U.S.C. § 100(b) (1984) (further defining the “process” statutory class as meaning “[p]rocess, art or method . . . includ[ing] a new use of a known process, machine, manufacture, composition of matter, or material[s]”). Legislative history indicates that Congress contemplated that the subject matter provisions be given a broad construction and were intended to “include anything under the sun that is made by man.” Diamond v. Chakrabarty, 447 U.S. 303, 309 (1980).
right is enforceable against those who reverse engineer\textsuperscript{28} or independently develop the patented invention.\textsuperscript{29} Unlike a copyright owner, the patent owner need not show that an invention was “copied” or acquired through some improper access or means in order to prove infringement.
The patented invention is defined by the “claims” (i.e., the numbered paragraphs) appearing at the end of the patent document.\textsuperscript{30} A claim defines the boundaries of an invention much like the description of property in a deed defines the boundaries of real estate. To determine precisely the “metes and bounds” of a patented invention, however, the patent specification, drawings, file history, and “prior art” must also be reviewed and analyzed.\textsuperscript{31} This distinctive claiming feature of patents, as opposed to copyrights, provides an indication to others of what they can do to avoid infringing the patent while, at the same time, producing an improved product. Too often, antipatent comments are improperly based on the title or, at best, the abstract of an issued patent and not the claims of the patent which actually define the invention.
The prerequisites to the grant of a patent by the U.S. Government Patent Office include:
1. Novelty;\textsuperscript{32}
2. Utility;\textsuperscript{33}
3. Non-obviousness;\textsuperscript{34} and
4. Proper “disclosure”\textsuperscript{35} of the invention.
An application for a patent should be rejected if the invention is already known or would have been obvious to a person having ordinary skill in the field of the invention at the time the invention was made in view of the relevant “prior art.”\textsuperscript{36} In general, prior art is the existing
\textsuperscript{29} Atari Games Corp. v. Nintendo of Am., Inc., 975 F.2d 832, 844 (Fed. Cir. 1992).
\textsuperscript{31} A.B. Dick Co. v. Burroughs Corp., 713 F.2d 700, 702 (Fed. Cir. 1983).
\textsuperscript{33} Id. § 101 (1988).
\textsuperscript{34} Id. § 103 (1988).
\textsuperscript{35} Id. § 112 (1988); 2 Donald S. Chisum, A Treatise on the Law of Patentability, Validity and Infringement § 7.01 (rev. 1995).
body of knowledge or technical information, including printed publications, that are available at a given time to the person of ordinary skill in the art. No patent should restrict anyone from using technology that is already in the public domain. Thus, assuming it has perfect information, the Patent Office will not issue a patent for an invention whose purported advancements are already found in, or are obvious from, the prior art.
An inventor is required to disclose his or her invention sufficiently to enable those skilled in the field to make and use it. The inventor must also set forth the “best mode” for carrying out the invention.
Patent Office examiners determine whether an invention is new and non-obvious by comparing the claims contained in patent applications with prior art contained in the Patent Office “search files” or otherwise available to the Patent Office. The patent examiners also consider items other than those found in the search files. For example, many of the more recently issued U.S. patents are contained in a computer database. Examiners also have access to the Scientific and Technical Information Center which contains technical literature in the form of books and periodicals, foreign patent documents and references, and online search services. Examiners also consider prior art documents supplied by patent applicants (who are under a duty to disclose relevant documents) of which they are aware.
40. DeGeorge v. Bernier, 768 F.2d 1318, 1324 (Fed. Cir. 1985) (“The purpose of the best mode requirement is to restrain inventors from applying for patents while at the same time concealing from the public preferred embodiments of their inventions . . . .”)
42. Automated Patent System (APS) is an online system of the Patent Office which allows access to the full text of U.S. patents granted since 1970. In addition, APS provides access to current classification information for all U.S. patents. PATENT AND TRADEMARK OFFICE, U.S. DEPARTMENT OF COMMERCE, MANUAL OF PATENT EXAMINING PROCEDURE § 902. 03(e), AUTOMATED PATENT SYSTEM (rev. 1995).
The Patent Office is currently required by statute to hold pending U.S. patent applications in confidence. Consequently, pending applications are not contained in the search files, and the examiner cannot discuss the contents of a patent application with anyone other than the patent applicant or representative.
V. IMPROVING THE QUALITY OF SOFTWARE PATENTS
The U.S. patent system and how it handles software-related patent applications and patents is obviously not perfect. After the 1994 Software Patent Hearings, Patent Office Commissioner Bruce Lehman said he favored publishing patent applications which, as previously noted, are currently reviewed by the government in strict secrecy. Mr. Lehman further blamed the government for failing to stay abreast of the field of computer programs and stated that the Patent Office was counting on more information from the software industry to produce more durable patent awards.
After creation by the Secretary of Commerce in 1990, an Advisory Commission on Patent Law Reform issued a report which included a number of recommendations with respect to software-related inventions. The Advisory Commission included representatives from U.S. businesses, both large and small, in addition to universities, the patent bar, the antitrust bar, and the public. The report recommended that the current framework of laws protecting computer program-related inventions be maintained and that no special test for interpretation of the patent law should be applied to computer program-related patent applications.
Recommendations XI-E through XI-H were directed to the United States Patent Office (U.S. PTO) and relate to the improvement of the patent examination and reexamination processes:
48. Id.
50. Id. at 148–56 (recommendations XI-A, XI-B).
Recommendation XI-E. The U.S. PTO should assemble a larger, more complete, non-patent prior art collection and provide its examiners better access to the non-patent prior art in the computer program-related technologies.
Recommendation XI-F. The U.S. PTO should make further efforts to classify the patent and non-patent computer program-related art to maximize the ability to search inventions in this field.
Recommendation XI-G(i). The U.S. PTO should train patent examiners in the computer program-related technologies to raise and maintain their level of expertise.
Recommendation XI-G(ii). The U.S. PTO should recruit as examiners individuals who are experienced in this technology and should take special action to retain experienced examiners.
Recommendation XI-H(iii). The Commissioner should implement a study and/or program under 37 U.S.C. § 6 which expands the citation of prior art under 35 U.S.C. § 301 and 37 C.F.R. § 1.501 (the reexamination provisions) to include the citation of not only patents or printed publications but also other material evidencing a verifiable date of prior public use or sale which is shown to be pertinent to an issued patent.
Recommendation XI-H(vi). The U.S. PTO should encourage private efforts directed toward assimilating and organizing information with respect to prior public use or sale of technological advances.51
The Advisory Commission also added the following legislation recommendation:
Recommendation XI-I. Encourage implementation of a system allowing for early publication of pending applications which would be particularly beneficial for fast-moving technologies in accordance with any harmonization efforts that may be undertaken.52
With respect to recommendations XI-E and XI-H(vi), Professor Bernard A. Galler, working with the Industrial Technology Institute of Ann Arbor, Michigan, formed the Software Patent Institute (SPI), a
51. Id. at 159–67.
52. Id. at 167–68.
nonprofit project, to create and make available to the Patent Office and the public a database of software techniques, particularly nonpatented techniques. The database is a useful resource currently being used by the Patent Office. On October 2, 1995, the SPI Database of Software Technologies opened to the public.
With respect to Recommendation XI-G(i), the SPI has already given a number of courses to the examiners concerning computer program-related technologies.
With respect to Recommendation XI-G(ii), the Patent Office now hires computer scientists as patent examiners.
With respect to Recommendation XI-I, a bill\textsuperscript{53} was introduced in the spring of 1995 to require publication of patent applications eighteen months from the earliest filing date. This would allow third parties the opportunity to bring prior art to the attention of the Patent Office. Also, this would allow others to learn about the existence of relevant patent applications so that they can avoid significant investment of resources into technology which may infringe a patent resulting from such an application.
With respect to Recommendation XI-H(iii), a bill\textsuperscript{54} was introduced in the spring of 1995 to expand patent reexamination proceedings to allow greater participation by third parties. This should prove to be a significantly less expensive way of challenging an issued patent than through litigation.
Consequently, improvements have been and continue to be made to the patent system to counter the criticisms of those who have argued against the patentability of software-related inventions.
VI. UNWANTED “IMPROVEMENT” TO CURRENT STATUTORY SCHEME OF PROTECTING SOFTWARE-RELATED TECHNOLOGY
Many witnesses at the 1994 Software Patent Hearings stated that a \textit{sui generis} scheme for protecting software by somehow merging patent and copyright protection would have the following disadvantages:
(1) Many of the now resolved uncertainties with respect to patent and copyright protection for software would need to be addressed by new judicial precedent in the U.S.; and
(2) Japan and Europe, which now provide software patent and copyright protection comparable to the U.S., would have to
\textsuperscript{54} HR 1732, 104th Cong., 1st Sess. (1995).
change over to this new form of protection, and there is no cer-
tainty that they would.\textsuperscript{55}
Professor Galler of the SPI has remarked that, “[T]he suggestion
that somehow copyright and patent protection should be merged into a
single form of protection does not appear to be useful.”\textsuperscript{56}
There has been, and continues to be, a legal distinction between the
idea (that is, the algorithm) and its expression. In the software field,
there has been such a distinction since the early history of the field.
Computer scientists and practitioners have long talked about the algo-
rithm, or the abstract process by which a problem can be solved, and a
specific expression of that algorithm in the form of a computer program.
That distinction has been useful. The terms and the ideas that they ex-
press have been in use for almost fifty years, even as the computer field
has changed dramatically. It would seem that these two levels of ab-
straction deserve different kinds of protection, and that copyright and
patent protection are just about right.\textsuperscript{57}
\section*{VII. \textsc{Conclusion}}
Overall, the patent system is working and should be improved rather
than abandoned. There is no need to abolish patent protection for soft-
ware-related inventions simply because some invalid patents may have
been issued. Current and contemplated improvements to the patent sys-
tem, as well as the checks and balances imposed by the federal courts,
provide mechanisms to minimize the frequency of such occurrences and
will remove many of these patents if they are granted in the future.
\begin{footnotes}
ware-Related Inventions} (San Jose, Cal. Jan. 26–27, 1994 and Arlington, Va. Feb. 10–11,
1994). Furthermore, the treaties currently in force would have to be changed to treat software
differently. Also, a new treaty would be needed for such a \textit{sui generis} scheme. See \textit{supra}
note 16.}
\footnote{56. Bernard A. Galler, \textit{Software and Intellectual Property Protection: Copyright and
\footnote{57. \textit{Id.}}
\end{footnotes}
|
{"Source-Url": "http://www.mttlr.org/wp-content/journal/voltwo/syrowik.pdf", "len_cl100k_base": 7402, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 33104, "total-output-tokens": 10373, "length": "2e12", "weborganizer": {"__label__adult": 0.0019683837890625, "__label__art_design": 0.0018815994262695312, "__label__crime_law": 0.299072265625, "__label__education_jobs": 0.006317138671875, "__label__entertainment": 0.00052642822265625, "__label__fashion_beauty": 0.0007376670837402344, "__label__finance_business": 0.01885986328125, "__label__food_dining": 0.0009608268737792968, "__label__games": 0.005279541015625, "__label__hardware": 0.00298309326171875, "__label__health": 0.0019216537475585935, "__label__history": 0.0010557174682617188, "__label__home_hobbies": 0.00030541419982910156, "__label__industrial": 0.0014219284057617188, "__label__literature": 0.001995086669921875, "__label__politics": 0.006130218505859375, "__label__religion": 0.00107574462890625, "__label__science_tech": 0.0270538330078125, "__label__social_life": 0.00023543834686279297, "__label__software": 0.080810546875, "__label__software_dev": 0.537109375, "__label__sports_fitness": 0.0006489753723144531, "__label__transportation": 0.0012359619140625, "__label__travel": 0.0004711151123046875}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 39345, 0.05565]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 39345, 0.50737]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 39345, 0.91608]], "google_gemma-3-12b-it_contains_pii": [[0, 3282, false], [3282, 7601, null], [7601, 11439, null], [11439, 14055, null], [14055, 17638, null], [17638, 20893, null], [20893, 24484, null], [24484, 26972, null], [26972, 30257, null], [30257, 32802, null], [32802, 34744, null], [34744, 37089, null], [37089, 39345, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3282, true], [3282, 7601, null], [7601, 11439, null], [11439, 14055, null], [14055, 17638, null], [17638, 20893, null], [20893, 24484, null], [24484, 26972, null], [26972, 30257, null], [30257, 32802, null], [32802, 34744, null], [34744, 37089, null], [37089, 39345, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 39345, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 39345, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 39345, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 39345, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 39345, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 39345, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 39345, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 39345, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 39345, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 39345, null]], "pdf_page_numbers": [[0, 3282, 1], [3282, 7601, 2], [7601, 11439, 3], [11439, 14055, 4], [14055, 17638, 5], [17638, 20893, 6], [20893, 24484, 7], [24484, 26972, 8], [26972, 30257, 9], [30257, 32802, 10], [32802, 34744, 11], [34744, 37089, 12], [37089, 39345, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 39345, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
390c13d6279090bcf09b8522f5a997a5c3c5acc1
|
Use Cases
This is the responsibility of the Configuration Profiles Team and Communications Team.
This is an attempt to make a grid of major use cases and major user types. Ex.: Enterprise Collaboration, Publishing for non-profits, etc.
Also related: Tiki Suite use cases
This page is still in draft. Once it stabilizes, it will probably be split into smaller chunks. When it is ready, it will be publicized. Please help improve. Perhaps it should be moved to http://profiles.tiki.org?
This list needs to be split in what Tiki is used for and by whom
• Introduction
• Who is reading?
○ I am not a techy
▪ 1.1.1. Writer / Content manager / Translator / Marketing
▪ 1.1.2. Graphic artist / theme designer
▪ 1.1.3. Power-user / Information architect
▪ 1.1.4. Entrepreneur / Management / Lawyer
○ I am techy
▪ 1.1.1. Programmer / coder
▪ 1.1.2. Sysadmin / Web host
▪ 1.1.3. IT manager
• What type of organization?
○ Small and medium-sized business (SMB)
○ Enterprise / Corporate
○ Government
○ Education / Research
○ Association / Non-Profit / Co-ops / NGO / Special Interest Group / Club / Foundation
○ Personal / Family / Freelancer
○ Web agency / Designer / Consultant
○ Hosting company / Tech services
○ International / Multilingual / Geo CMS
• How will the system be used / what is the project?
○ Web Publishing / News / Blog / Personal site / family site / Portal / news site
○ E-commerce / Shopping cart / Finance / Membership
○ Collaboration / Project Management / Intranet / Team project / Entreprise Wiki / B2B or internal
○ E-learning / Learning Management System (LMS) / classroom / course management system (CMS) / Coaching communities
○ Social Networking / Community / Fan Site / E-democracy
Tiki is the FLOSS Web Application with the most built-in features and is in general one of the most diverse / feature-full piece of software in the World. This is great when you need it (of course!), but it makes it difficult for
- marketing -> "How do you market something that does everything"
- the User/Admin experience -> "It does everything, nice but I just want X. How do I do it?"
Tiki is a Wiki / Content Management System (CMS) / Groupware.
These are broad and vague terms.
- Wikis can be used for so many things. A public encyclopedia is very different than a corporate wiki.
- Groupware can be defined as "software designed to help people involved in a common task achieve their goals". This is very vague.
- Content Management System (CMS) is especially a vague term: A "system to manage content". Just about anything can fit that definition! A computer and a filing a cabinet are a CMS
Tiki enthusiasts will tell you that Tiki is a jack-of-all-trades, everything-but-the-kitchen-sink, all-in-one tool which lets you do just about "anything". It could power probably over 90% of the websites in the World (Let's face it, most sites are pretty simple!). But of course, you don't want to do "anything". You have a specific objective/community/project in mind. This page will define a bit more the different ways to use Tiki.
With Tiki, you can pick & choose which features are turned on. Chances are, your project will be a combination of a few 'Use Cases'. So you can use the combined features of all appropriate use cases.
Why cater to so many use cases? A bit like speaking many languages from the same root (French, Spanish,
Portuguese, Spanish, Italian, Catalan, etc.), once you know 3 or 4, the 5th and 6th are easier to learn because you already have many bases. Some words are the same, or similar enough that you can get by. So each Use Case is easier & easier.
Similar to the list of features, rating (A, B, C, D, E) are to compare Tiki as an overall solution for these use cases, compared to "industry standards" in the Open Source World. So "A" means that Tiki is, for this Use Case, just as good as any other Open Source project. "A" does not mean "Perfect" or that it has all the features. Some features may be weak but compensated by other strong features. The ratings are based on the latest stable version of Tiki. If you disagree with a rating, please change it and edit the Strengths/Weaknesses sections accordingly.
**ToDo**
- Review every feature of Tiki and put the most relevant ones below in the top 1 (or max 2) relevant use cases.
1. These ratings needs to be split, like in features:
- Setup/admin UI: How easy / intuitive is to set up this feature?
- UI end user : Once setup, how easy / intuitive is it for the end-user? (was it worth it?)
- Stability: How many bugs left?
- Feature-set / power: How does this feature compare to other Open Source apps?
2. Move to a **SWOT** format
**Please do add links to your Tiki-powered sites which fit a profile.**
Each Use Case will eventually need an installation profile to make it easy for people to get going when they install Tiki.
Format:
```
-Use Case=
Description of Use case, which will eventually be a profile (who/what/etc)
* Description of type of user / user case (clarify what we are talking about)
-Key features=
Including links to the proper documentation page. This will make it easier to evaluate/understand.
-Strengths=
* Specific benefits/strength of adopting Tiki (why is Tiki great for them?)
-Weaknesses=
Weaknesses of Tiki / what needs to be improved
-Potential to contribute to Tiki=
* Potential to contribute to Tiki (to help the Tiki community prioritize efforts)
** Examples of low potential to contribute to Tiki: microsites, or one-shot projects that will be shut down after a short period. Ex.: Event organization web site, that won't be re-used the following year
```
Who is reading?
So info.tiki.org should start out with
I am not a techy
- I am a manager
- I am a designer / Graphic artist
- I am a Power-user (this one is in both sections because some power-users consider themselves techy, some not)
- I am Writer / Tech Writer / Content manager
1.1.1. Writer / Content manager / Translator / Marketing
Me: Content is king! I have info to get out and don't want to wait for a webmaster.
Strengths: Tiki has a full range of features to make a great publishing & collaboration platform, with plenty of Interaction tools. Please also see: SEO
Weaknesses:
Potential to contribute to Tiki: Can help with *.tiki.org content and can also help with bug reports, testing, documentation, feature requirements, etc.
1.1.2. Graphic artist / theme designer
Me: I am really good with CSS & HTML but I am allergic to PHP
Strengths: Tiki has a very flexible template system. You can do an amazing quantity of thing without ever changing a single line of PHP code. Thanks to the theme control center, you can assign a different theme to different parts of your site. The whole theme system was recently re-organized. Please see: themes.tiki.org
Weaknesses:
Potential to contribute to Tiki: Theme designers often make very specific theme for customers. These themes often cover only a small number of features. Result: their work is most often not contributable.
1.1.3. Power-user / Information architect
Me: I am really good at testing, configuring, finding bugs, etc. and I want a powerful system to organize things efficiently
Strengths: Tiki has arguably more features out of the box than any other web application. Configure your Tiki to your liking through a point & click GUI.
Tiki has a ton of goodies for you. With categories, you can create a basic document workflow. With structures, you can create a book from a collection of wiki pages. Semantic links and Mind Mapping.
Weaknesses:
**Potential to contribute to Tiki**: Can help with bug reports, testing, documentation, feature requirements, etc.
### 1.1.4. Entrepreneur / Management / Lawyer
Give me the executive summary
**Strengths**:
- **LGPL**: Tiki is free as in free speech and free beer.
- Tiki has 200+ different permissions you can set to any group. Groups can be included in groups (and inherit permissions). Just about any item in Tiki can have individual permissions which override global permissions. And, to make management easier, Tiki also offers category permissions.
**Weaknesses**:
**Potential to contribute to Tiki**: Can help find new uses and business models for Tiki, which at least indirectly, lead to more resources working on Tiki (ex.: a SAAS project or web community (with Tiki as a back-end))
### I am techy
If the person clicks techy
- I am a sysadmin
- I am a coder
- I am a front-end developer
- I am a Power-user (this one is in both sections because some power-users consider themselves techy, some not)
### 1.1.1. Programmer / coder
**Me**: I want to code as little as possible and I want to be able to contribute my code or use APIs so I don’t have to manage a local fork.
**Strengths**: Tiki is a full-fledged Wiki/ CMS / Groupware. But it can also be used as a framework to build additional functionality. Tiki has a very open development philosophy. You can add features as long as you make them optional.
**Strengths**:
**Weaknesses**:
**Potential to contribute to Tiki**: New features, bug fixes, improve release process, etc.
1.1.2. Sysadmin / Web host
**Me:** I am worried about complex updates and security issues. Apt-get is my friend
**Strengths:** Why install 2, 3 or 4 Web apps when Tiki can handle these needs? One application to manage instead of inconsistent logins & permissions throughout different systems. Tiki offers TRIM, MultiTiki & InterTiki. Many authentication options (LDAP, CAS, etc). Tiki runs on standard PHP/MySQL. You can easily export & reuse data if need be. See: [Hosting Company](#)
**Weaknesses:**
**Potential to contribute to Tiki:** Stability, Security, Uptime, Performance, Deployability, etc.
1.1.3. IT manager
**Me:** I am looking for a good overall solution for a web app. I am planning ahead because now, my staff is asking for a wiki, but I know that later, they are are gonna want more. I don't want to be limited down the road.
**Strengths:** Tiki is a very active project. Hundreds of people have contributed. On one side, it is mature and stable in version LTS versions, a lot of exciting new features are in development
**Weaknesses:**
**Potential to contribute to Tiki:** Can help with funding / planning of enhancements and stability/upkeep of LTS versions.
**What type of organization?**
**Small and medium-sized business (SMB)**
**Strengths:** The big feature-set and tight integration reduce the number of apps to deploy
**Weaknesses:**
**Potential to contribute to Tiki:** suite.tiki.org
**Enterprise / Corporate**
- Enterprises has different needs in terms of support and release cycles. **Tiki** has evolved over the years to a large number of benefits for the **Enterprise**
- Enterprises tend to use Tiki for fewer features, but more intensely.
**Strengths:**
Tiki is an excellent tool for a corporate wiki, with all the tools built-in: LDAP, fine-grained permissions, trackers, etc
Tiki is licensed LGPL (while most projects of this type are GPL) so you can freely integrate with your commercial applications.
Weaknesses:
Potential to contribute to Tiki: They save money, thus, can contribute. Typically long term commitment.
Related links:
- enterprise
Government
Strengths:
Weaknesses:
Potential to contribute to Tiki: Large deployments and long-term projects. Could prefer to invest public money in FOSS solutions, which are thus available to all.
Education / Research
For teachers & school administration
For student
Strengths:
Weaknesses:
Potential to contribute to Tiki: Translation Student Program
Association / Non-Profit / Co-ops / NGO / Special Interest Group / Club / Foundation
Can be an association of professionals
Strengths:
Weaknesses:
Potential to contribute to Tiki: Have a culture of volunteers and good causes. Can help with fundraising and volunteer testers.
If you a philanthropist and want to help, you can put your resources to good use, with a fantastic multiplying effect. Tiki is free as in free beer. Tiki got this far with a budget of 0, but money would help to cover travel expenses for contributors for TikiFests and increase overall quality.
Personal / Family / Freelancer
Strengths:
Weaknesses:
Potential to contribute to Tiki:
Web agency / Designer / Consultant
Us: We do all kinds of web projects. Mostly web sites but sometimes some Intranets
Strengths: With Tiki, you can manage several different types of projects, all with the same back-end. And it's easy to share back so you don't have to maintain your customizations.
- Tiki for Web agencies
- FLOSS Web Application with the most built-in features
Weaknesses:
Potential to contribute to Tiki: These agencies are the ones picking the tool, and can both increase the install base, and contribute back enhancements.
Hosting company / Tech services
Us: We want applications which add value to our hosting services. And it has to be easy to maintain.
Strengths: Tiki is ideal! Please see: Hosting Company
Weaknesses:
Potential to contribute to Tiki:
Links:
International / Multilingual / Geo CMS
Features: i18n, maps
Strengths: Tiki interface is at least partially translation in 40+ languages
Good back-end architecture & storage
Weaknesses:
Potential to contribute to Tiki: Translations
Links:
- http://wiki-translation.com
- http://profiles.tiki.org/Cartograf
How will the system be used / what is the project?
Web Publishing / News / Blog / Personal site / family site / Portal / news site
"One to Many" web communication
Features: Menu, Newsletter, Articles, Article Generator, Blog, Banners, Themes, Kaltura videos, Comments, Spam protection, WYSIWYG, Search engine optimization, Clean URLs, RSS, Categories, etc.
Strengths: Themable, Smarty, Can natively handle multiple blogs
Weaknesses: Spam prevention, not enough nice built-in themes.
Potential to contribute to Tiki: Web shops that do brochure-ware websites typically take Tiki as-is, have very little to develop, and most often can't re contribute the custom theme. Since sites are pretty simple, and version history / collaboration is not important, they more often change technologies after a few years. Because of a custom theme, site upgrades are likely to be 2-4 years apart, along with design refresh. LTS is useful for them.
Links:
- http://profiles.tiki.org/Personal_Blog_and_Profile_9x
- http://info.tiki.org
- http://www.cunningham-lee.com
- http://www.amette.eu
- Featured Tikis
- http://tiki.org/TikiProfilesSmallBiz
E-commerce / Shopping cart / Finance / Membership
Managing transactions
Features: Shopping Cart, Payment, Accounting, Credit, Membership, PluginTrade, Spreadsheet
Strengths:
Weaknesses:
- Various features are not integrated, No Shopping Cart profile
- Still quite basic. Suitable if your main site needs other Tiki features and you also need basic e-commerce.
- No tax handling
Potential to contribute to Tiki: These projects have an incentive to focus on security. Their business model may bring additional features and a better UI.
Links:
- PayPalSubscription
- shopping cart -> in the works!
Collaboration / Project Management / Intranet / Team project / Entreprise Wiki / B2B or internal
One or many defined teams focusing on goals.
Features: Workspaces, Wiki, Bug/task Tracker, Calendar, Chat, Watch, Permissions, Share, Categories, Search, LDAP authentication, File Gallery
Strengths:
- Very customizable and powerful
- Very promising in the wiki-based project management field
Weaknesses:
- Missing profile for typical use case
Potential to contribute to Tiki: These are typically long term commitment projects, thus, they are interested in being around for a smooth upgrade.
Links:
- http://profiles.tiki.org/Company_Intranet_9x
- http://dev.tiki.org
- http://en.wikipedia.org/wiki/Project_management_software
- http://en.wikipedia.org/wiki/Project_management_2.0
- http://projectmanagementwiki.org
- project management
- Wikis evolve as collaboration tools
- Wiki Tools: Who's In The Game
- Wikis At Work
- What makes an enterprise wiki?
- Intranet wikis, by Michel Buffa
E-learning / Learning Management System (LMS) / classroom / course management system (CMS) / Coaching communities
One to many teaching, or many to many learning
Support coaching activities and education communities.
**Features:** Quizzes, BigBlueButton webinars, Slideshow and Screencast
**Strengths:**
**Weaknesses:**
- Not yet suitable for classrooms (as a Moodle alternative)
- Grading only available trough mods
**Potential to contribute to Tiki:**
**Links:**
- Enterprise E-learning roadmap
- http://profiles.tiki.org/Learning_Center
Social Networking / Community / Fan Site / E-democracy
Many to many, organic groups
Examples: Job board / Dating site / hospitality exchange / Car Pooling
People are connected around a topic.
**Features:** Forums, Inter-User Messages, Maps, Friendship Network, Spam Protection, Workspace UI, User profiles, Organic Groups, Wiki user pages, Calendar of events, polls
**Strengths:**
Tiki eats its own DogFood
**Weaknesses:**
- "transactions" between users
- Reputation / karma system
- Tiki is missing a few things to be efficient for this use case. Tiki friends are very basic. It would be possible but clunky to get by with trackers and forums.
**Potential to contribute to Tiki:**
I am doing my PhD and I would like some people to review my work.
**Features:** Wiki, Screencast, Search, Structure, i18n (for translation), Flagged Revision, Tag, Spam Protection, Zotero, References, WebHelp, categories, category permissions, Watch, category watch, category transition, File galleries with check-in/checkout, WebDAV
**Strengths:** Excellent tracking of edits (wiki history)
**Weaknesses:** Printing, Offline, PDF, Doesn't handle non-Web things (OCR, etc)
**Potential to contribute to Tiki:**
**Customer/Contact/Constituent relationship management (CRM) / Support / Help Desk / Issue Tracker / Bug Tracker / Customer extranet**
- Supporting a product or service or sales
- Typically with one to one support of a product and a public bug/issue tracker
- This includes software-forge type sites
• There is overlap with "Knowledgebase / Documentation" use case with respect to the product documentation
• There is overlap with "Community" use case because we want customers to help each other
**Features:** Issue Tracker, File Gallery, Surveys, Polls, Live Support, User profiles, Newsletter, comments, forum
**Strengths:**
Lots of interest: CRM
**Weaknesses:**
Tiki can do some of this. It would need quite a bit of configuration. Too much work for a new admin. A profile would be very useful here
**Potential to contribute to Tiki:** Typically Long Term commitment as they want to have a stable platform for their customers
**Links:**
- http://dev.tiki.org/CRM
- http://crm.tiki.org/
- Issue Tracker
- http://freshmeat.net/browse/1017/
- http://en.wikipedia.org/wiki/Membership_software
**Office Suite**
Online office productivity tools, to collaborate on various document types (all web-based)
**Features:** Wiki, Docs, Screencast, Spreadsheet, Slideshow, Drawings, Database builder. For regular files, you can use the File Gallery and WebDAV
**Strengths:**
**Weaknesses:**
**Potential to contribute to Tiki:**
**Links:**
Productivity / Personal Information Management (PIM) / Personal knowledge base
Makes users more efficient
Features: Webmail, Bookmarks, Notepad, Task, User Files, Calendar, Contact
Strengths:
Wiki is very strong for this.
Weaknesses:
No sync with PDA, weak webmail
Potential to contribute to Tiki:
Related links:
- http://en.wikipedia.org/wiki/Personal_information_manager
Framework / App builder / Activity Workflow / Online service / Database, forms & reports / Specialized web Application
Tiki has all these features, and you use as Framework to build even more!
Most online services like Basecamp, Freshbooks, etc. are not using FOSS software (although they are very likely using components).
Contact some of the developers to see if/how your project could fit in so you can focus on your content and community and reduce the risk/cost of feature development.
I have legacy data | I want to reuse content from another DB http://tiki.org/PluginSql, Webservices, etc.
Features: tracker, Category Transitions can be used as a Workflow engine
Strengths:
Super powerful and nicely integrated with wiki
Includes Zend Framework, Smarty and jQuery
- When you'll need a generic feature (forum, etc), it's just a click away.
Weaknesses:
Potential to contribute to Tiki:
Production / ERP
This can be built with trackers, but Tiki is not yet good here.
**Features:** Trackers, Category Transitions engine to code custom processes
**Strengths:**
**Weaknesses:**
**Potential to contribute to Tiki:**
**Related links**
- http://ck-erp.net/
- http://www.dolibarr.org/
- http://www.web-erp.org/
- https://www.ohloh.net/tags/erp
Event Management, Conference Management & planning
This is a mix of Project Management for the organizers, CRM for the attendees and publishing to promote the event. Yet, since it's a fairly clear / common use case, we'll make add a section
**Features:** Trackers (for user registration), Wiki, Calendar
**Strengths:**
Wikis in Plain English / Planning a camping trip
"Email is not good at coordinating and organizing a group's input. This is the old way. The important information is scattered across everyone's inbox. (...) There is a better way"
Weaknesses:
- Needs a better way to track submissions
- Need a profile
Potential to contribute to Tiki:
Related links
- [http://americana.org/](http://americana.org/)
- [http://phpbeer.com](http://phpbeer.com) (project)
- [http://freshmeat.net/projects/ocs/](http://freshmeat.net/projects/ocs/)
- See Citadel Rock Online Communities's EventSoup project
What is your infrastructure?
Shared hosting
V-server or dedicated server
Local computer or USB key
Related links
- User type
- Major Features Missing In Tiki
- Why Wiki Syntax Is Important
- Model
- Wikis Are Now Serious Business: 10 more use cases
- tiki-slideshow.php?page=Presentation+Comm506#s2
- Good to update [https://profiles.tiki.org/Small_Organization_Web_Presence_products_include](https://profiles.tiki.org/Small_Organization_Web_Presence_products_include)
- The Word Processor being the wiki, Tiki has everything else on this top-10 list. Webmail is poor though.
- [http://bestengagingcommunities.com/2012/11/27/how-to-b2b-is-morphing-into-b2a-b2d-b2m/](http://bestengagingcommunities.com/2012/11/27/how-to-b2b-is-morphing-into-b2a-b2d-b2m/)
Alias
- Use case
- Who uses Tiki
• User Type
• Major Use cases
• User Types
• Types of Users
• Top-10 uses
|
{"Source-Url": "https://tiki.org/tiki-print.php?display=pdf&page=Use+Cases", "len_cl100k_base": 5445, "olmocr-version": "0.1.53", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 31384, "total-output-tokens": 6679, "length": "2e12", "weborganizer": {"__label__adult": 0.00031757354736328125, "__label__art_design": 0.0007939338684082031, "__label__crime_law": 0.00036835670471191406, "__label__education_jobs": 0.006153106689453125, "__label__entertainment": 0.00023376941680908203, "__label__fashion_beauty": 0.00015544891357421875, "__label__finance_business": 0.002902984619140625, "__label__food_dining": 0.0002932548522949219, "__label__games": 0.000789642333984375, "__label__hardware": 0.0004887580871582031, "__label__health": 0.00016450881958007812, "__label__history": 0.0002465248107910156, "__label__home_hobbies": 0.00024580955505371094, "__label__industrial": 0.0002067089080810547, "__label__literature": 0.00034880638122558594, "__label__politics": 0.0002455711364746094, "__label__religion": 0.00034880638122558594, "__label__science_tech": 0.0021800994873046875, "__label__social_life": 0.0004930496215820312, "__label__software": 0.162109375, "__label__software_dev": 0.8203125, "__label__sports_fitness": 0.0001633167266845703, "__label__transportation": 0.0002168416976928711, "__label__travel": 0.00024580955505371094}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24097, 0.00607]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24097, 0.00484]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24097, 0.86961]], "google_gemma-3-12b-it_contains_pii": [[0, 1767, false], [1767, 3420, null], [3420, 5685, null], [5685, 7403, null], [7403, 9168, null], [9168, 11125, null], [11125, 12240, null], [12240, 13474, null], [13474, 15253, null], [15253, 16556, null], [16556, 17853, null], [17853, 18669, null], [18669, 20127, null], [20127, 21446, null], [21446, 22419, null], [22419, 24024, null], [24024, 24097, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1767, true], [1767, 3420, null], [3420, 5685, null], [5685, 7403, null], [7403, 9168, null], [9168, 11125, null], [11125, 12240, null], [12240, 13474, null], [13474, 15253, null], [15253, 16556, null], [16556, 17853, null], [17853, 18669, null], [18669, 20127, null], [20127, 21446, null], [21446, 22419, null], [22419, 24024, null], [24024, 24097, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 24097, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24097, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24097, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24097, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24097, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24097, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24097, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24097, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24097, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24097, null]], "pdf_page_numbers": [[0, 1767, 1], [1767, 3420, 2], [3420, 5685, 3], [5685, 7403, 4], [7403, 9168, 5], [9168, 11125, 6], [11125, 12240, 7], [12240, 13474, 8], [13474, 15253, 9], [15253, 16556, 10], [16556, 17853, 11], [17853, 18669, 12], [18669, 20127, 13], [20127, 21446, 14], [21446, 22419, 15], [22419, 24024, 16], [24024, 24097, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24097, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
5f67679d6afbd6cb0ae8aae6c1c26a69387446a7
|
Adaptive Supersampling for Deferred Anti-Aliasing
Matthias Holländer\textsuperscript{1} Tamy Boubekeur\textsuperscript{1} Elmar Eisemann\textsuperscript{2}
\textsuperscript{1}Telecom ParisTech - CNRS/LTCI \textsuperscript{2}Delft University of Technology
Abstract
We present a novel approach to perform anti-aliasing in a deferred-rendering context. Our approach is based on supersampling; the scene is rasterized into an enlarged geometry buffer, i.e., each pixel of the final image corresponds to a window of attributes within this buffer. For the final image, we sample this window adaptively based on different metrics accounting for geometry and appearance to derive the pixel shading. Further, we use anisotropic filtering to avoid texturing artifacts. Our approach concentrates the workload where needed and allows faster shading in various supersampling scenarios, especially when the shading cost per pixel is high.
Figure 1. Left: Brute-force $4 \times 4$ supersampling result. Right: Comparable quality result produced using fewer operations by our adaptive shading of a $4 \times 4$ supersampled G-Buffer.
1. Introduction
The process of applying lighting effects to the surface of an object is commonly called shading. Shading in real-time applications can be performed using a forward-rendering approach, which sends the scene’s geometry to the GPU and performs lighting calculations for each rasterized pixel. During this process, the scene’s information resides only temporarily in GPU memory. Consequently, shading has to be computed right away, even for pixels that might end up hidden. Performance falls when shading dominates the rendering cost. For complex scenes it is unavoidable that shading dominates, since, even under a simple shading algorithm, forward-rendering shading is necessarily linear in the number of light sources. It thus becomes arbitrarily expensive as the number of lights grows. To avoid shading hidden fragments, we populate the z-buffer with depth values by rendering the scene once without shading (i.e., an early-depth pass). In a subsequent pass, the geometry is transformed and rendered again, but only fragments surviving the depth test are shaded. Nonetheless, even then, the computations do not map perfectly to the GPU when triangles are pixel-sized or very small and an overhead is added.
Deferred shading is an alternative and better approach. Instead of lighting each fragment directly, a deferred-shading renderer writes each fragment’s attributes to a geometry buffer (G-buffer). The attributes commonly include normals, positions, depth values, and material properties. Pixels of the final image are then shaded by making one pass per light over the regions of the screen affected by the light. Each pass makes use of the captured data in the G-buffer. This results in higher shading performance (provided the overhead of reading the values multiple times is significantly smaller than the cost of shading; a variation called tiled deferred shading addresses this).
Because a single G-buffer pixel will result in a single pixel in the final output, aliasing can become a severe problem under deferred shading. One can address this issue by supersampling. However, supersampling is expensive, because it shades substantially more samples than either forward shading with analytic or multisample anti-aliasing would, even in regions where no anti-aliasing would have been required.
In this paper, we propose a solution that is faster than brute-force supersampling and delivers high-quality results. Our method makes use of an adaptive sampling algorithm and a supersampled G-buffer, leading to an anti-aliasing solution for a deferred rendering context. This paper describes the key contributing elements of this method:
• adaptive sampling for deferred shading,
• two orthogonal metrics for driving that adaptation, and
• efficient anisotropic filtering for deferred shading.
2. Previous Work
For anti-aliasing (AA), multiple samples per pixels are needed. This implies many shading evaluations in forward rendering, e.g., MSAA (multi-sample AA) is a very common approach. Here, coverage (visibility) is sampled finely, while shading is evaluated coarsely. Thibieroz [2009] showed that MSAA can be combined with deferred shading using a customized resolve operation to achieve plausible results. However, the stored samples are derived from MSAA samples, i.e., not all samples correspond to actual surface samples. Further, a fixed shading rate is used for edges instead of a variable one. Surface-based anti-aliasing (SBAA) [Salvi and Vidimček 2012] can be used to reduce storage costs in these scenarios by limiting the amount of per-pixel surface information considered for shading. This involves discarding primitives with small coverage to trade accuracy for a smaller memory footprint. A large body of work on real-time post-process anti-aliasing seeks to ameliorate image quality by adjusting the values in the color buffer after shading a low-resolution buffer. See Jimenez et al. [2011] for a survey of these methods. In contrast, we aim at providing an adaptive strategy for deferred shading to add samples where needed. Here, we will review the most recent methods that we believe are all currently in production use.
Fast approximate anti-aliasing (FXAA) [Lottes 2009], morphological anti-aliasing (MLAA) [Reshetov 2009], and directionally localized anti-aliasing (DLAA) [Andreev 2011] are purely RGB-based post-process filters and can be used to get rid of some type of aliasing artifacts. They resample the input texture with a slight offset for edge regions, thus effectively blurring the edges. Although this can remove some of the deficiencies, it can lead to an overall blur. Further, false positives for non-edge regions can appear, and the approach is not temporally coherent. Some of those filters are known to work in supersampling modes, but an academic description and the way samples are selected are, however, not available.
Subpixel reconstruction anti-aliasing (SRAA) [Chajdas et al. 2011] is similar to MLAA but relies on a super-resolution depth (and optional normal) buffer. Subpixel shading values are reconstructed using bilateral upsampling involving weights defined from neighboring pixels based on depth/normal information. In contrast to our method, they use a fixed subset of normal and depth values that is chosen blindly.
Valient’s [2007] multi-sample anti-aliasing (MSAA) x2 averages the result of two samples. This leads to shading artifacts at boundaries of objects with different materials. Coverage-sampled anti-aliasing (CSAA) [Young 2007] cannot be combined with deferred shading at all.
Low-resolution rendering and careful upsampling can help to increase rendering speed. Yang et al. [2008], the authors render the image in low resolution and use bilateral upsampling for the final pass based on normal and depth information. A
similar idea is known from the demo scene [Swoboda 2009] for multi-sample anti-
aliasing.
For inferred lighting [Engel 2009], an additional attribute combining a normal-
group-id and an object-id is added to a low-resolution G-buffer. The unique id and
depth are used to efficiently reject pixels from different objects and thus, non-edge-
regions can be shaded with fewer samples. Nonetheless, aliasing artifacts can occur
where brightly lit and dark surfaces meet due to the upsampling strategy. Additionally,
the z-prepass optimization described above cannot be used because the initial depth
buffer (first pass) is rendered at a lower resolution.
Finally, Lauritzen [2010] uses a tile-based deferred shading approach combined
with quad-based light culling. Indeed, they offer an adaptive shading rate using nor-
mal and depth information with additional G-buffer storage cost for depth derivatives.
However, this metric neglects shading discontinuities and does not offer anisotropic
texture filtering.
3. Our Method
The idea of our algorithm is to produce a high-resolution G-buffer, but to perform
shading only on a selected subset of these pixels. This subset is chosen via our metric
that predicts where more samples are required.
At first, the scene’s information is rendered into an enlarged G-buffer of size
$(m \cdot w) \times (m \cdot h)$, where $w$ and $h$ are the width and height of the window, and $m \in \mathbb{N}$. Each pixel of the final image corresponds to a sampling window of size $m \times m$ in the
large G-buffer.
Then, we shade one sample for each pixel and store the result in a separate
buffer $S$, which has, therefore, a resolution of $w \times h$.
Finally, we will derive the number of additional samples $k$ that should be involved
in shading a given pixel via two metrics. The first metric analyzes the contents of the
G-buffer within a sampling window, and the second one looks at the actual shading
values in $S$.
3.1. Determining the Required Sample Number
For a sampling window of size $m \times m$, a maximum of $n = m^2$ samples per pixel is
possible. Each metric has a user-defined constant $c$ to scale the resulting value that
should be adapted according to the scene. As aliasing occurs either at geometric dis-
continuities or discontinuities caused by shading, we propose the following metrics:
Geometry based metric. First, we compute the variance of the depth values in the
sampling window for the corresponding pixel to deduce a first estimate of the required
number of samples; a higher variance results in more samples:
\[ k_d = c \times \left( \frac{\sum d_i^2}{n} - \left( \frac{\sum d_i}{n} \right)^2 \right). \]
Next, we investigate the normals and compute the cone spanned by them in the sampling window. We compute the average normal \( \bar{n} \) from the sampling window and compare all other normals \( \bar{n}_{ij} \) against it, effectively computing the conservative cone centered around the mean normal. The resulting number of samples is given by
\[ k_n = c \times \sqrt{1.0 - \left( \min_{ij} \left( \text{abs}(\bar{n} \cdot \bar{n}_{ij})) \right) \right)}. \]
The total sample count is
\[ k = \max(k_d, k_n). \]
**Shading-based metric.** The second metric is based on the shading texture \( S \). For each pixel the range \( r \) of luminance values is computed by looking at the four direct
---
**Figure 2.** Overview of our method. Our deferred shading pass renders to an enlarged G-buffer, i.e., each pixel of the final image corresponds to a window of this buffer. Then, the G-buffer is evaluated using our geometric metric. The first sample for each pixel is shaded and our shading metric is applied. For the final image, we shade each pixel adaptively based on the result of our metrics and the previously rendered image with one sample per pixel.
neighboring pixels, resulting in $r = l_{\text{max}} - l_{\text{min}}$. The final sample count is
\[
k_s = \begin{cases}
0 & \text{if } r < \max(t_{\text{minThreshold}}, l_{\text{max}} \times t_{\text{edgeThreshold}}), \\
c \times r, & \text{otherwise}.
\end{cases}
\]
This is similar to metrics found in RGB-filter-based AA methods such as FXAA [Lottes 2009].
The presented metrics are orthogonal to each other as they rely on different attributes of the scene. The result of the geometric metric and the shading metric are combined using a max filter. Notwithstanding, depending on the usage scenario (e.g., pure geometric aliasing), one could omit the shading metric. Furthermore, even other sampling methods based on the BRDF [Bagher et al. 2012] could be integrated, but the above solution is faster to compute and sufficed in all experiments.
### 3.2. Sampling the Window
Once the required sample count has been computed, we use $k$ samples from the G-buffer of the pixel’s corresponding sampling window to compute the final shading. We distribute the $k$ samples according to an index matrix known from ordered dithering [Bayer 1973] (see Figure 3). These matrices are constructed such that the average distance between two consecutive numbers is maximized. Thus, we can ensure a good distribution of the samples that are taken from the supersampled G-buffer.
\[
\begin{pmatrix}
0 & 2 \\
3 & 1
\end{pmatrix}
\begin{pmatrix}
2 & 6 & 3 \\
5 & 0 & 8 \\
1 & 7 & 4
\end{pmatrix}
\begin{pmatrix}
1 & 8 & 2 & 10 \\
12 & 4 & 14 & 6 \\
3 & 11 & 0 & 9 \\
15 & 7 & 13 & 5
\end{pmatrix}
\]
**Figure 3.** Index matrices for sizes $m = 2, 3, 4$ that are used to sample the large G-buffer.
### 4. Implementation
For our implementation, we chose a G-buffer format (Figure 4) that is similar to those found in games [Valient 2007]. Additionally, we store all textures of the scene in a 3D-array. This allows us to delay the albedo lookup until the final shading pass where texture aliasing artifacts can be removed by using anisotropic filtering.
We implemented our algorithm using multiple passes (see Listing 1). The first pass is a deferred shading pass where the destination G-buffer is $m^2$ times larger. One important element is that it will not store albedo-texture values but rather the corresponding texture-layer indices and texture coordinates.
The next pass computes the required number of samples per pixel by evaluating the sampling window with our metric. The final pass combines the result of the shade-first texture $S$ and performs adaptive shading using the rest of the G-buffer; samples
are picked from the sampling window for each pixel according to the sample count and following the dither matrices (Figure 3).
4.1. Shading a Sample
Each sample that contributes to the final pixel is shaded by evaluating the BRDF and performing a texture lookup into the scene’s array texture. Although our metric does incorporate shading, we have to avoid texture artifacts. By computing the derivatives of the texture coordinates in the G-buffer and taking into account the number of used samples in the window, we can use anisotropic texture lookups to better approximate the underlying texture footprint of the sample. The derivative computation is available through the \( \frac{\partial f}{\partial x} / \frac{\partial f}{\partial y} \) functions in GLSL. The anisotropic texture lookup is then performed using the \texttt{textureGrad} function.
Such a filtering would fail at the boundary of two different materials. Fortunately, we can detect these discontinuities because they usually appear at a high-order derivative in the texture layer/coordinates. The influence of the anisotropic texture lookups on the result are shown in Figure 5.
4.2. Evaluating Several Samples
There are several possibilities to evaluate multiple samples for a given pixel and our approach can employ several alternatives—the choice depends on the hardware spec-
---
### Listing 1. Pseudocode for our algorithm.
```c
GBuffer g = RenderToGBuffer();
Tex oneSample = ShadeFirstSample();
// evaluation using our two metrics
Tex samplecount = Evaluate( g, oneSample );
ShadeRestAdaptively( samplecount, oneSample, g );
```
The easiest solution is to read out the number of needed samples and use a loop in
a shader to evaluate and accumulate the result of the samples taken from the window.
In practice, this often proved most efficient, despite potential divergence between the
different threads.
Another solution is to write out the required number of needed samples per pixel
into a stencil target. For the final shading pass, the stencil test is enabled and a full-
screen quad is drawn for each possible sample count \( k \in 2, \ldots, m^2 \) where the stencil
test discards all fragments different from \( k \). This effectively groups all pixels with the
same sample count during shading but requires the stencil mask to hold the correct
number of samples and, thus, stencil-write capabilities from within a shader. At the
time of writing, this extension has not been integrated into the OpenGL standard
(GL_ARB_shader_stencil_export). Similarly, the sample count can be written
to the depth buffer using \texttt{gl\_FragDepth} followed by an evaluation using multiple
screen-sized quads which are set to the corresponding depth and a depth comparison
\begin{figure}[h]
\centering
\includegraphics[width=\textwidth]{figures/figure5.png}
\caption{Figure 5. Left: Reference using full 3 \times 3 supersampling with anisotropic filtering; Middle: our approach with anisotropic filtering; Right: our approach without anisotropic filtering.}
\end{figure}
\begin{figure}[h]
\centering
\includegraphics[width=\textwidth]{figures/figure6.png}
\caption{Figure 6. (a) Sample count per pixel as heatmap; (b) sorted sample counts (mostly zero); (c) low-resolution sample count using a max filter on a 6 \times 6 window}
\end{figure}
with \texttt{GL_EQUAL}. However, this resulted in roughly 20% slower performance in all of our tests. The sample count values can benefit from \textit{bucketing} by dynamically computing a histogram of the values and reducing the co-domain. Such a strategy, however, involves further investigation to avoid compromising quality and is left for future work.
We also experimented (see Figure 6(b)) with sorting the pixels according to their computed sample count, inspired by Hoberock et al. [2009]. Unfortunately, a group of pixels with the same sample count (e.g., all pixels with \(k = 4\)) does not necessarily have a high image-space coherence (see Figure 6(a) and Figure 7), so that texture accesses within this group are usually incoherent, thereby, limiting performance. Sorting samples was three times slower than our presented solution.
Also, we tried using a low-resolution sample count texture by applying a max-filter to the original sample count texture. This filter preserves high sample counts on edges that require AA. Now, each texel of this low-resolution sample count texture corresponds to a group of pixels in the image. Unfortunately, this increases the total number of samples drastically because high sample counts “leak” into regions that would only require a low number of samples (Figure 6(c)). Again, sorting the low-resolution sample count values did not improve performance (also roughly three times slower).
5. Results
In this section, we present the results of our algorithm. We compare our method to a reference solution that evaluates all \(n\) samples for all pixels with anisotropic filtering enabled. The reference solution and our algorithm are based on an ordered-grid su-
<table>
<thead>
<tr>
<th>Supersampling</th>
<th>Method</th>
<th>ms/frame</th>
<th>stalled</th>
<th>MSE ((\times 10^{-5}))</th>
<th>PSNR dB</th>
<th>Samples %</th>
</tr>
</thead>
<tbody>
<tr>
<td>1×1</td>
<td>Default</td>
<td>12.91</td>
<td>28.91</td>
<td>–</td>
<td>–</td>
<td>–</td>
</tr>
<tr>
<td></td>
<td>FXAA</td>
<td>13.28</td>
<td>29.24</td>
<td>–</td>
<td>–</td>
<td>–</td>
</tr>
<tr>
<td>2×2</td>
<td>Reference</td>
<td>26.0</td>
<td>78.7</td>
<td>–</td>
<td>–</td>
<td>100</td>
</tr>
<tr>
<td></td>
<td>Ours</td>
<td>22.9</td>
<td>72.2</td>
<td>5.0</td>
<td>91.14</td>
<td>57.8</td>
</tr>
<tr>
<td>3×3</td>
<td>Reference</td>
<td>34.9</td>
<td>158.36</td>
<td>–</td>
<td>–</td>
<td>100</td>
</tr>
<tr>
<td></td>
<td>Ours</td>
<td>30.69</td>
<td>143.77</td>
<td>3.08</td>
<td>93.24</td>
<td>53.40</td>
</tr>
<tr>
<td>4×4</td>
<td>Reference</td>
<td>57.48</td>
<td>317.76</td>
<td>–</td>
<td>–</td>
<td>100</td>
</tr>
<tr>
<td></td>
<td>Ours</td>
<td>51.68</td>
<td>268.35</td>
<td>3.79</td>
<td>92.34</td>
<td>53.14</td>
</tr>
</tbody>
</table>
\textbf{Table 1.} Performance of our algorithm for the Sponza scene. The reference solution evaluates all samples for each pixel. PSNR (peak signal-to-noise ratio) and MSE (mean-squared error) given regarding the reference, similarly the percentage of samples shaded in contrast to the full evaluation is given. All timings are given in ms.
Figure 7. Our method at different supersampling rates. The third column shows the difference to the reference image at the same sampling rate whereas the last column compares to a 1×1 casual deferred shading. Both display the absolute error encoded as a heatmap. The difference from the \( n \times n \) solution is nearly zero everywhere because although faster to produce than the reference solution, our results are nearly identical. Zoom into the figure to see the single-pixel differences.
Our method also reduces the artifacts when small geometric details cannot be captured by our shading texture \( S \). Our adaptive sampling algorithm outperforms the reference solution in all cases while keeping the quality at a similar level. Even for real-time shading scenarios, with low-cost fragment shaders, we can observe a gain in performance. Our metrics reduce roughly by half the required number of samples to shade. However, when shading...
only half of the samples, a performance boost of a factor of two is not possible due to the divergence of threads on the GPU and some incoherent texture accesses between neighboring pixels.
Our metric gives only a small error (see Figure 7) as it is sensitive to changes in depth and normal as well as shading discontinuities.
Overall, our algorithm proves to be particularly useful for supersampling scenarios, especially, when the shading cost per pixel is high (see Table 1 (stalled versions)).
6. Discussion and Conclusion
We presented a method to increase performance of supersampling anti-aliasing scenarios in the context of deferred shading. Our results are usually close to the reference but involve much less computation time. The proposed metrics provide a good trade-off between performance and accuracy with a controllable error.
In the future, we would like to design light-source aware metrics in order to improve shading near specular highlights, e.g., one could already combine our solution with a light pre-pass [Engel 2008]. Further, we would like to address thread divergence by using a tile-based approach similar to Lauritzen’s work [2010]. Also, as is common for antialiasing methods, temporal coherence is an interesting problem, and we would like to try to compensate for such artifacts by averaging the sample count over several frames, in the spirit of Herzog et al. [2010].
7. Acknowledgements
This work has been partially funded by the French National Research Agency MediaGPU project, the REVERIE E.U. project, the 3D Life European Network of Excellence and the Intel Visual Computing Institute (IVCI) at Saarland University.
References
Figure 8. The importance of both the geometric and shading term; all difference images were computed with respect to the $3 \times 3$ supersampling reference solution. Top row left to right: $3 \times 3$ supersampling reference, deferred shading with a single sample, deferred shading with a single sample and FXAA post-processing (high quality settings). Middle row: our adaptive version, (final) sample density of our algorithm, difference image with respect to the $3 \times 3$ supersampling reference solution. Bottom row: sample density and difference for our geometric and shading term. Geometric features below the Nyquist frequency are not captured well by our shading term but are reduced using our geometric term. This is even more apparent when the camera is moving.
ENGEL, W. 2009. Designing a Renderer for Multiple Lights: The Light Pre-Pass Renderer. In
http://jcgt.org/published/0001/02/01/
Received: 2012-09-05
Recommended: 2012-11-20 Corresponding Editor: John Hable
Published: 2013-03-02 Editor-in-Chief: Morgan McGuire
© 2013 M. Holländer, T. Boubekeur, and E. Eisemann (the Authors).
The Authors provide this document (the Work) under the Creative Commons CC BY-ND 3.0 license available online at http://creativecommons.org/licenses/by-nd/3.0/. The Authors further grant permission reuse of images and text from the first page of the Work, provided that the reuse is for the purpose of promoting and/or summarizing the Work in scholarly venues and that any reuse is accompanied by a scientific citation to the Work.
|
{"Source-Url": "https://graphics.tudelft.nl/Publications-new/2013/HBE13/HBE13.pdf", "len_cl100k_base": 5583, "olmocr-version": "0.1.48", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 33050, "total-output-tokens": 7257, "length": "2e12", "weborganizer": {"__label__adult": 0.0010824203491210938, "__label__art_design": 0.0096588134765625, "__label__crime_law": 0.0008373260498046875, "__label__education_jobs": 0.0009937286376953125, "__label__entertainment": 0.0007805824279785156, "__label__fashion_beauty": 0.0006284713745117188, "__label__finance_business": 0.00031375885009765625, "__label__food_dining": 0.0007715225219726562, "__label__games": 0.007183074951171875, "__label__hardware": 0.00650787353515625, "__label__health": 0.0010890960693359375, "__label__history": 0.001415252685546875, "__label__home_hobbies": 0.00020241737365722656, "__label__industrial": 0.0012121200561523438, "__label__literature": 0.0008869171142578125, "__label__politics": 0.0005755424499511719, "__label__religion": 0.0015316009521484375, "__label__science_tech": 0.461669921875, "__label__social_life": 0.0001437664031982422, "__label__software": 0.01593017578125, "__label__software_dev": 0.48388671875, "__label__sports_fitness": 0.0007495880126953125, "__label__transportation": 0.00131988525390625, "__label__travel": 0.0005350112915039062}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27103, 0.04014]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27103, 0.28352]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27103, 0.85796]], "google_gemma-3-12b-it_contains_pii": [[0, 1122, false], [1122, 3943, null], [3943, 6949, null], [6949, 9470, null], [9470, 10790, null], [10790, 13400, null], [13400, 15013, null], [15013, 16722, null], [16722, 19791, null], [19791, 20740, null], [20740, 23145, null], [23145, 24173, null], [24173, 26262, null], [26262, 27103, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1122, true], [1122, 3943, null], [3943, 6949, null], [6949, 9470, null], [9470, 10790, null], [10790, 13400, null], [13400, 15013, null], [15013, 16722, null], [16722, 19791, null], [19791, 20740, null], [20740, 23145, null], [23145, 24173, null], [24173, 26262, null], [26262, 27103, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27103, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27103, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27103, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27103, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27103, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27103, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27103, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27103, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27103, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27103, null]], "pdf_page_numbers": [[0, 1122, 1], [1122, 3943, 2], [3943, 6949, 3], [6949, 9470, 4], [9470, 10790, 5], [10790, 13400, 6], [13400, 15013, 7], [15013, 16722, 8], [16722, 19791, 9], [19791, 20740, 10], [20740, 23145, 11], [23145, 24173, 12], [24173, 26262, 13], [26262, 27103, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27103, 0.05291]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
d50a86bd5c4c96e23bb82cd381dd57ed7a832523
|
Teaching Prolog and CLP
Ulrich Neumerkel
Institut für Computersprachen
Technische Universität Wien
www.complang.tuwien.ac.at/ulrich/
I The “magic” of Prolog — Common obstacles
II Reading of programs
III Course implementation
Part I
Common obstacles
• The “magic” of Prolog
– puzzling procedural behaviour
– voracious systems
• Previous skills and habits
• Prolog’s syntax
• Naming of predicates and variables
• List differences
Syllabus
- Training (project oriented) vs. teaching (concept oriented)
- Larger projects do not work well
- full Prolog vs. pure Prolog
- pure Prolog + CLP(FD)
Basics:
- Basic reading skills for understanding Prolog programs
- Avoiding common mistakes, develop coding style
Previous skills to build on
- Programming skills
- Mathematical skills
- Language skills
Previous programming skills
- Bad programming habits — the self-taught programmer
Severe handicap: Edit-Compile-Run-Dump-Debug
“Let the debugger explain what the program is doing”
- assertions? invariants? test cases before coding?
(Eiffel, but also C `<assert.h>`).
Mathematical skills
- mathematical logic as prerequisite
- calculational skills (e.g. manipulating formulæ)
- syntactic unification (equational, Martelli/Montanari)
Language skills
• Many difficulties of Prolog are clarified reading programs in plain English.
• E.g. quantification problems in negation:
female(Female) ←
¬ male(Female).
*Everything/everyone, really everything/everyone that/who is not male is female. Therefore: Since a chair/hammer/the summer isn’t male it’s female*
• Detect defaultry data structure definitions
is_tree(_Element). \% Everything is a tree.
is_tree(node(L, R)) ←
is_tree(L),
is_tree(R).
Prolog’s Syntax, Difficulties
Minor typos make a student resort to bad habits
Prolog’s syntax is not robust: “male(john).” is a goal or fact.
\[
\text{father}\_\text{of}(\text{Father, Child}) \leftarrow \\
\text{child}\_\text{of}(\text{Child, Father}), \\
\text{male}(\text{Father}), \% ! \\
\text{male}(\text{john}).
\]
1. Redesign Prolog’s syntax. (Prolog II)
2. Subset of existing syntax. Spacing and indentation significant (GUPU).
(a) Each head, goal in a single line.
(b) Goals are indented. Heads are not indented.
(c) Only comma can separate goals (i.e. \textit{no} disjunction)
(d) Different predicates are separated by blank lines.
\[ \Rightarrow \text{more helpful error messages possible} \]
Names of predicates
key to understanding — assignments for finding good names
Misnomers
- action/command oriented prescriptive names: append/3, reverse/2, sort/2
quick fix: use past participle, sometimes noun
- leave the argument order open: child/2, length/2
- pretend too general or too specific relation: reverse/2, length/2
- tell the obvious: body_list//1
Finding predicate names
1. Start with intended types: type1_type2_type_3(Arg1, Arg2, Arg3)
“child of a person” : person_person/2
2. If name too general, refine
person_person ⇒ child_person/2
list_list/2 ⇒ list_reversedlist/2
3. Emphasize relation *between* arguments
- shortcuts like prepositions: child_of/2
- past participles alone: list_reversed/2
“length of a list”: list_number/2 ⇒ list_length/2
“append”: list_list_list/3 ⇒ list_list_appended/3 ⇒ list_listdiff(X,Z,Y) ⇒ list//1
“sorting”: list_list/2 ⇒ list_sortedlist/2 ⇒ list_sorted/2 ⇒ listAscending/2
Problem: High arities yield long names
- try to avoid high arities: DCGs, group arguments in meaningful structures, e.g. Latitude, Longitude ⇒ Position
- omit less important arguments at the end, name ends with underscore: country_(Country, Region, Population, ...)
- put the less important arguments at the end
Type definitions
Convention: is_type(Type) or type(Type)
- documentation purpose
- serve as template for predicates defined over data structures
O’Keefe-rules
- unsuitable (for beginners)
- deal with procedural aspects
- inputs and outputs: atom_chars vs. atom_to_chars
Variable names
Lack of type system makes consistent naming essential
• for lists: [Singularform|Pluralform], e.g. [X|Xs]
• naming void variables in the head: member(X,[X|_]) _Xs instead of _
• state numbering (e.g. list differences) instead of Xin, Xout, Xmiddle
Understanding differences
− misleading name: “difference list”
instead : difference, list difference, difference of lists
− differences too early
+ use grammars first: less error-prone, powerful, compact (string notation)
− differences presented as incomplete data structures — “holes”
+ motivate differences with ground lists
+ differences are not specific to lists, describe state
Part II
Reading of programs
Algorithm = Logic + Control
Family of related reading techniques
Focus on distinct (abstract) parts/properties of the program
- informal reading in English
- declarative reading
- (almost) procedural reading
- termination reading
- resource consumption
Informal reading
use English to
• focus the student’s attention on the meaning of program
• avoid operational details
• clarify notions
• clarify language ambiguities
• clarify confusion of “and” and “or”
\[ \text{ancestor_of}(\text{Ancestor}, \text{Person}) \leftarrow \text{child_of}(\text{Person}, \text{Ancestor}). \]
_Someone is an ancestor of a person if he is the parent of that person._ Alternatively: _Parents are ancestors._
ancestor_of(Ancestor, Descendant) ←
child_of(Person, Ancestor),
ancestor_of(Person, Descendant).
Someone is an ancestor of a descendant if he is the parent of another ancestor of the descendant.
Alternatively: *Parents of ancestors are ancestors*
Reading complete predicates is often too clumsy:
Someone is an ancestor of a descendant, (either) if he is the parent of that descendant, *or* if he is the parent of another ancestor of the descendant. (unspeakable)
Alternatively: *Parents and their ancestors are ancestors.* (too terse)
Informal reading is intuitive but limited to small programs.
⇒ Extend informal reading to read larger programs
Declarative reading of programs
- consider only parts of program at a time
- cover the uninteresting/difficult parts (like this)
- shortens sentences to be read aloud
Conclusion reading
Read clause in the direction of the rule-arrow (body to head).
Analysis of clauses
Read single clause at a time. Add remark: But there may be something else.
\[
\text{ancestor_of}(\text{Ancestor}, \text{Person}) \leftarrow \\
\quad \text{child_of}(\text{Person}, \text{Ancestor}).
\]
\[
\text{ancestor_of}(\text{Ancestor}, \text{Descendant}) \leftarrow \\
\quad \text{child_of}(\text{Person}, \text{Ancestor}), \\
\quad \text{ancestor_of}(\text{Person}, \text{Descendant}).
\]
Someone is an ancestor of a person if he is the parent of that person. (But there may be other ancestors as well).
Alternatively: *At least parents are ancestors.*
\[
\text{ancestor_of}((\text{Ancestor}, \text{Person}) \leftarrow \text{child_of}((\text{Person}, \text{Ancestor})).
\]
\[
\text{ancestor_of}((\text{Ancestor}, \text{Descendant}) \leftarrow \text{child_of}((\text{Person}, \text{Ancestor}),
\text{ancestor_of}((\text{Person}, \text{Descendant}).
\]
*Someone is an ancestor of a descendant if he’s the parent of another person being an ancestor of the descendant. But …*
*At least parents of ancestors are ancestors.*
**Erroneous clauses**
For error location it is not necessary to see the whole program
\[
\text{ancestor_of\_too\_general}((\text{Ancestor, Person}) \leftarrow \text{child_of\_too\_general}((\text{Ancestor, Person}).
\]
\[
\text{ancestor_of\_too\_general}((\text{Ancestor, Descendant}) \leftarrow \text{child_of\_too\_general}((\text{Person, Ancestor}),
\text{ancestor_of\_too\_general}((\text{Person, Descendant}).
\]
Analysis of the rule body
- goals restrict set of solution
- cover goals to see generalized definitions
\[
\text{father}(\text{Father}) \leftarrow \\
\quad \text{male}(\text{Father}), \\
\quad \text{child_of}(\_\text{Child}, \text{Father}).
\]
*Fathers are at least male. (But not all males are necessarily fathers)*
\[
\text{father\_toorestricted}(\text{franz}) \leftarrow \\
\quad \text{male}(\text{franz}), \ % \text{Body is irrelevant to see that definition is too restricted.} \\
\quad \text{child_of}(\_\text{Child}, \text{franz}).
\]
Searching for errors
If erroneous definition is
1. too general. Use: Analysis of clauses to search too general clause
2. too restricted. Use: Analysis of the rule body
Reading method leads to analgous writing style.
Procedural reading of programs
- special case of the declarative reading
- uncover goals in strict order
- look at variable dependence
- first occurrence of variable — variable will always be free
- further occurrence — connected to goal/head
1. ancestor_of(Ancestor, Descendant) ← % ← head never fails
count_of(Person, Ancestor),
ancestor_of(Person, Descendant).
2. ancestor_of(Ancestor, Descendant) ←
count_of(Person, Ancestor), % ←
ancestor_of(Person, Descendant).
⇒ Ancestor can influence count_of/2. Descendant doesn’t.
Person will be always free. Descendant only influences ancestor_of/2.
Termination
- often considered weak point of Prolog
- nontermination is a property of a general purpose programming language
- only simpler computational models guarantee termination
- floundering is also difficult to reason about
- pretext to stop declarative thinking, usage of debuggers etc.
- difficult to understand by looking at Prolog’s precise execution (tracing)
Notions of Termination
T1: ← Goal1. terminates
T2: ← Goal2. terminates
T3: ← Goal1, Goal2. terminates
Existential termination: ← Goal. finds an answer substitution
Difficult to use / analyze:
• clause order significant
• T1 and T2 \(\not\Rightarrow\) T3 (loops “on backtracking”)
• T3 \(\Rightarrow\) T1
Universal termination: ← Goal. terminates iff ← Goal, false. finitely fails
Easier to analyze:
• clause order not significant
• T1 and T2 \(\Rightarrow\) T3 (no surprise on backtracking)
• T3 \(\Rightarrow\) T1
Properties of universal termination
1. Adding clause does not affect nonterminating goals.
\[ \leftarrow \text{Goal. nonterm. for P} \Rightarrow \leftarrow \text{Goal. nonterm. for P} \cup \{C\} \]
2. For many interesting programs \( P \) (e.g. binary clauses and facts):
\[ \leftarrow \text{Goal. nonterm. for P} \Leftrightarrow \leftarrow \text{Goal. nonterm. for P} \cup \{C\}, C \text{ is a fact} \]
Methods for termination reading
• reading a predicate:
hide clauses, if simpler predicate does not terminate, also the original predicate does not terminate (by 1)
• reading single clause:
\( H \leftarrow G_1, \ldots, G_i, \text{false. nonterm.} \Rightarrow H \leftarrow G_1, \ldots, G_i, \ldots, G_n. \text{ nonterm.} \)
Termination reading is very fast in location possibilities for nontermination. Unfortunately (in most cases) no replacement for termination proof.
Example termination reading: append/3
- cover some (irrelevant) clauses: esp. facts, non recursive parts
\[\text{append([], Xs, Xs).} \]
\[\text{append([X|Xs], Ys, [X|Zs]) ← append(Xs, Ys, Zs).} \]
- reduced predicates terminates iff original terminates
- The misunderstanding of append/3
rôle of fact append([], Xs, Xs)
often called “end/termination condition”
But: append([], Xs, Xs) has no influence on termination!
- cover variables handed through (Ys):
\[\text{append([], Xs, Xs).} \]
\[\text{append([X|Xs], Ys, [X|Zs]) ← append(Xs, Ys, Zs).} \]
• cover head variables (approximation):
\[
\text{append}([], Xs, Xs).
\]
\[
\text{append}([\_ | Xs], Ys, [\_ | Zs]) \leftarrow \text{append}(Xs, Ys, Zs).
\]
Resulting predicate:
\[
\text{appendtorso}([\_ | Xs], [\_ | Zs]) \leftarrow \text{appendtorso}(Xs, Zs).
\]
• if appendtorso/2 terminates, append/3 will terminate
• appendtorso/2 never succeeds
• only a safe approximation
\[
\leftarrow \text{append}([1|\_], \_, [2|\_]).
\]
\[
\leftarrow \text{appendtorso}([1|\_], [2|\_]).
\]
appendtorso/2 does not terminate while append/3 does
Example termination reading: append3/4
\[
\begin{align*}
\text{append3A}(As, Bs, Cs, Ds) & \leftarrow \text{append3B}(As, Bs, Cs, Ds) \\
& \leftarrow \text{append}(As, Bs, ABs), \text{append}(ABs, Cs, Ds), \text{append}(ABs, Cs, Ds).
\end{align*}
\]
\[
\begin{align*}
\text{append3A}(As, Bs, Cs, Ds) & \leftarrow \\
& \leftarrow \text{append}(As, Bs, ABs), \% \leftarrow \text{terminates only if As is known} \\
& \text{append}(ABs, Cs, Ds).
\end{align*}
\]
similarly append3B/4: terminates only if Ds is known
- only a part of predicate was read — second goal was not read
- it was not necessary to imagine Prolog’s precise execution
- no “magic” of backtracking, unifying etc.
- a tracer/debugger would show irrelevant inferences of second goal
- solution:
Fair enumeration of infinite sequences
- termination reading is about termination/non-termination only
- in case of non-termination, fair enumeration still possible
- much more complex in general
- order of clauses significant
- e.g. unfair if two independent infinite sequences
\[
\text{list_list}(Xs, Ys) \leftarrow \\
\text{length}(Xs, \_), \\
\text{length}(Ys, \_).
\]
- explicit reasoning about alternatives (backtracking)
- use *one* simple fair predicate (e.g. *one* length/2) instead
- learn the limits, but don’t go to them
Resource consumption
- analytical vs. empirical
- *Do not try to understand precise execution!*
- prefer measuring over tracing
- abstract measures often sufficient
- inference counting: similar to termination reading
\[
\text{list} \_ \text{double}(Xs, XsXs) \leftarrow \\
\text{append}(Xs, Xs, XsXs).
\]
\[
\leftarrow \text{length}(XsXs, N), \text{list} \_ \text{double}(Xs, XsXs).
\]
\[
\text{list} \_ \text{double}(Xs, XsXs) \leftarrow \\
\text{append}(Xs, Ys, XsXs),
\]
\[
Xs = Ys.
\]
\[
\leftarrow \text{list} \_ \text{double}(Xs, XsXs).
\]
- size of data structures: approx. proportional to execution speed
Reading of definite clause grammars
nounphrase $\rightarrow$ % A noun phrase consists of
determiner, % a determiner followed by
noun, % a noun followed by
optrel. % an optional relative clause.
Declarative reading of grammars
determiner, noun, % a noun (at least)
optrel. % an optional relative clause
Procedural reading of grammars
Take implicit argument (list) into account
list([]) $\rightarrow$ list(Xs, Ys, Zs) $\rightarrow$ append3(As, Bs, Cs, Ds) $\leftarrow$
[[], list(Xs), list(Ys), list(Zs).]
Writing of programs
1. find types (is-predicates)
2. find relations and good names
3. write down example goals that should succeed/fail/terminate
4. define the actual predicate
CLP(FD)
- map problem into integers
- difficult to test
Structure of CLP(FD) programs
1. domains with domain zs(Min..Max,Zs)
2. relations
3. additional constraints (redundant, reducing symmetries)
4. labeling labeling zs(Labelingmethods,Zs)
- define a *single* predicate for 1-3 e.g. krel_vars(Desc, Vars)
- always separate labeling completely
rel(Desc) ←
krel_vars(Desc, Zs),
labeling_zs([ff], Zs).
• frequent error: early labeling
\[
\text{list_sum([E|Es],S0) ←}
\]
\[
S0 \# = S1 + E,
\]
\[
E \text{ in 1..10, } \%
\]
\[
\text{labeling_zs([], [E]), } \%
\]
\[
\text{list_sum(Es,S1).}
\]
• frequent error: not all variables are labelled, display constraint store
**Termination in CLP programs**
• complex programs are difficult to test: labeling takes a lot of time
\[
\not \leftarrow \text{rel(Desc), false. } \%
\]
\[
\not \leftarrow \text{krel_vars(Desc, ), false. } \%
\]
• goal reordering: \text{n_factorial(0,1)}.
\[
\text{n_factorial(N0, F0) ←}
\]
\[
N0 \# \geq 1, N0 \# = N1 + 1, \text{n_factorial(N1, F1)},
\]
\[
F0 \# = N0 * F1. \%
\]
Part III
Course implementation
• 2nd year one semester course, 2hrs/week (effectively: 9 × 5hrs work)
• nine weeks (example groups) about 80 small assignments
Course contents
• Basic elements (queries, facts, rules) and declarative reading
• Procedural reading, termination reading
• Terms, term arithmetic, lists
• Grammars
• CLP(FD)
• List differences (after grammars), general differences
Cursory at end: meta-logical & control (error/1, var/1, nonvar/1, cut), negation, term analysis, is/2-arithmetic
Topics not covered
(*): covered in an advanced course (3hrs)
1. setof(Template, Goal, Solutions) (*)
“answer substitutions” vs. “list of solutions” confusing — quantification tricky
2. meta interpreters (*) — program = data too confusing, defaultyness of vanilla
instead use pure meta interpreters “in disguise” (e.g. regular expressions)
3. meta call (*)
4. explicit disjunction (*) — meaning of alternative clauses must be understood first
5. if then else (*) — leads to defaultry programming style
if used, restrict condition to var/nonvar and arithmetical comparison
6. data base manipulation (*) — difficult to test — if used, focus on setof/3-like usage
7. advanced control (*) — reasoning about floundering difficult
8. extra logical predicates
9. debuggers, tracers — reason for heavy usage of cuts
GUPU Programming Environment
Gesprächsunterstützende Programmierübungsraumgebung
conversation supporting programming course environment
• specialized for Prolog courses
• uses clean subset of Prolog, no side effects
• comfortable querying and testing
• viewers for graphical display of answer substitutions
Further information
• Guided tour: http://www.complang.tuwien.ac.at/ulrich/gupu/
• Demo Friday 9h00 at the
8th Workshop on Logic Programming Environments
|
{"Source-Url": "https://www.complang.tuwien.ac.at/ulrich/papers/PDF/tutorial.pdf", "len_cl100k_base": 4955, "olmocr-version": "0.1.50", "pdf-total-pages": 32, "total-fallback-pages": 0, "total-input-tokens": 45499, "total-output-tokens": 6398, "length": "2e12", "weborganizer": {"__label__adult": 0.0005402565002441406, "__label__art_design": 0.0007638931274414062, "__label__crime_law": 0.000583648681640625, "__label__education_jobs": 0.03076171875, "__label__entertainment": 0.00012946128845214844, "__label__fashion_beauty": 0.0002582073211669922, "__label__finance_business": 0.0002987384796142578, "__label__food_dining": 0.0006551742553710938, "__label__games": 0.0012197494506835938, "__label__hardware": 0.0008578300476074219, "__label__health": 0.0005979537963867188, "__label__history": 0.0004317760467529297, "__label__home_hobbies": 0.00028204917907714844, "__label__industrial": 0.000720977783203125, "__label__literature": 0.0008029937744140625, "__label__politics": 0.0004940032958984375, "__label__religion": 0.0010385513305664062, "__label__science_tech": 0.0141448974609375, "__label__social_life": 0.00032973289489746094, "__label__software": 0.00836181640625, "__label__software_dev": 0.93505859375, "__label__sports_fitness": 0.000579833984375, "__label__transportation": 0.0008344650268554688, "__label__travel": 0.00030303001403808594}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 17575, 0.0075]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 17575, 0.8583]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 17575, 0.7379]], "google_gemma-3-12b-it_contains_pii": [[0, 228, false], [228, 440, null], [440, 813, null], [813, 1255, null], [1255, 1733, null], [1733, 2455, null], [2455, 2820, null], [2820, 3400, null], [3400, 3988, null], [3988, 4640, null], [4640, 4926, null], [4926, 5365, null], [5365, 6021, null], [6021, 6807, null], [6807, 7748, null], [7748, 8513, null], [8513, 9124, null], [9124, 9497, null], [9497, 10017, null], [10017, 10906, null], [10906, 11486, null], [11486, 12030, null], [12030, 12793, null], [12793, 13329, null], [13329, 13969, null], [13969, 14479, null], [14479, 14657, null], [14657, 15066, null], [15066, 15776, null], [15776, 16285, null], [16285, 17110, null], [17110, 17575, null]], "google_gemma-3-12b-it_is_public_document": [[0, 228, true], [228, 440, null], [440, 813, null], [813, 1255, null], [1255, 1733, null], [1733, 2455, null], [2455, 2820, null], [2820, 3400, null], [3400, 3988, null], [3988, 4640, null], [4640, 4926, null], [4926, 5365, null], [5365, 6021, null], [6021, 6807, null], [6807, 7748, null], [7748, 8513, null], [8513, 9124, null], [9124, 9497, null], [9497, 10017, null], [10017, 10906, null], [10906, 11486, null], [11486, 12030, null], [12030, 12793, null], [12793, 13329, null], [13329, 13969, null], [13969, 14479, null], [14479, 14657, null], [14657, 15066, null], [15066, 15776, null], [15776, 16285, null], [16285, 17110, null], [17110, 17575, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 17575, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, true], [5000, 17575, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 17575, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 17575, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 17575, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 17575, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 17575, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 17575, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 17575, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 17575, null]], "pdf_page_numbers": [[0, 228, 1], [228, 440, 2], [440, 813, 3], [813, 1255, 4], [1255, 1733, 5], [1733, 2455, 6], [2455, 2820, 7], [2820, 3400, 8], [3400, 3988, 9], [3988, 4640, 10], [4640, 4926, 11], [4926, 5365, 12], [5365, 6021, 13], [6021, 6807, 14], [6807, 7748, 15], [7748, 8513, 16], [8513, 9124, 17], [9124, 9497, 18], [9497, 10017, 19], [10017, 10906, 20], [10906, 11486, 21], [11486, 12030, 22], [12030, 12793, 23], [12793, 13329, 24], [13329, 13969, 25], [13969, 14479, 26], [14479, 14657, 27], [14657, 15066, 28], [15066, 15776, 29], [15776, 16285, 30], [16285, 17110, 31], [17110, 17575, 32]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 17575, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-29
|
2024-11-29
|
4bd352e8a85678d1c1cc4caa4d88dc948df960c4
|
Citation for published version
DOI
https://doi.org/10.1109/SANER.2017.7884661
Link to record in KAR
http://kar.kent.ac.uk/63700/
Document Version
Author's Accepted Manuscript
Abstract—dynStruct is an open source structure recovery tool for x86 binaries. It uses dynamic binary instrumentation to record information about memory accesses, which is then processed off-line to recover structures created and used by the binary. It provides a powerful web interface which not only displays the raw data and the recovered structures but also allows this information to be explored and manually edited. dynStruct is an effective tool for analyzing programs as complex as Emacs. A demonstration video is available at: http://bit.ly/2gQu26e
I. INTRODUCTION
Reverse engineering is the process of understanding the behaviour and logic of a program without access to its source code. Reverse engineers are routinely employed by government and commercial organisations to ensure programs are compliant with software licensing, security policies and to identify exploitable vulnerabilities and backdoors [1]. The key goal of reverse engineering is to extract enough information from a program to understand its behaviour: such information can include memory usage, data structures created and manipulated, network usage and interaction with the host operating system via system calls. A typical task for a reverse engineer is to understand the control flow and memory usage of an application and thus identify how the program behaves. However, much of the work undertaken by a reverse engineer is manual and time consuming. Reverse engineers routinely use tools such as debuggers, disassemblers and profiling tools.
dynStruct is an open source tool that helps recover data structures created and used by an executable binary. Identifying data structures is a key task undertaken by many reverse engineers. However, structure recovery is challenging for a number of reasons: compilation can remove useful information such as unexported symbol information, type and size information of variables and structures. In addition to the problems of recovering structures, the control flow of a program is difficult to determine through static analysis. Data structures are commonly used in different ways in different parts of the program, hence understanding control flow is crucial to correctly identifying the data structures manipulated during program execution.
dynStruct uses dynamic analysis and thus avoids the need to recover the control flow of a program before performing useful analyses: this is in contrast to static analysis which requires the computation of control flow information prior to further analysis. By using dynamic analysis, dynStruct can also attempt to analyse obfuscated programs which is a major hurdle for static analysis based tools [2]. Since dynStruct is focused on data structure recovery, it uses dynamic binary instrumentation (DBI) to gather information about memory allocation and accesses. DBI generates vast amounts of data, making manual inspection infeasible. Thus our tool processes information offline before presenting it to the user. Offline analysis reconstructs C-like structures and arrays, and determines where they are allocated and accessed. Engineers can use dynStruct’s powerful web-based interface to explore recovered data structures to discover how structures and their fields are accessed.
Our goal is to support real world reverse engineering, e.g. in capture-the-flag security contests (ctftime.org/ctf-wtf), where both speed and accuracy of structure recovery are important. Full details of dynStruct can be found in Mercier’s thesis [3].
II. RELATED WORK
We highlight notable work on recovering data structures from binaries. Laika [4] is a Bayesian unsupervised learning system that recovers structures from memory dumps. It is sufficiently accurate for use in malware analysis but dynStruct requires greater accuracy to aid program understanding.
Rewards [5] instruments memory allocations with type attributes which it propagates during analysis. Information from standard library and system calls helps determine the types used by the program. Rewards fails to recover data structures if there is no interaction with known libraries or system calls.
Howard [6] identifies root pointers of data structures from memory allocation routines and statically allocated data. Arrays and structure member types are detected at run-time by searching for specific memory access patterns. Howard claims around 90% accuracy for heap structures and 80% for stack structures. In contrast, dynStruct does not use access patterns but instead records the size of each memory access for offline processing. This allows dynStruct to recover structures accurate sized from only one run of the program. In contrast, Howard needs multiple runs to obtain good accuracy, and its use of the KLEE execution engine [7] leads to a heavy overhead.
TIE [8] uses both static analysis to recover functions and function boundaries, and dynamic analysis of memory accesses to determine the positions of structure members. Its constraint solver recovers the types of structures and their fields. dynStruct does not need to recover function boundaries and records
contextual information for every memory access allowing more accurate type recovery.
Robbins [9] shows how to mathematically characterise the correctness of types recovered from a binary executable, using constraint solving to decompile a binary to a semantically equivalent type-safe C-like ‘witness’ program, thereby giving confidence that the recovered types are both correct and meaningful. The work has been applied to an idealised x86 language.
Grammatech [10] use a sophisticated static type constraint system to recover types from stripped binaries built on-top of their proprietary CodeSurfer analysis tool.
Unlike dynStruct, none of these tools are publicly available.
III. DATA GATHERING
dynStruct consists of a data gatherer phase followed by an offline structure recovery phase and presents the results to the user via a web interface (Fig. 1). The data gatherer, written in C, uses the DynamoRIO [11] DBI framework to record every dynamic memory allocation and every access to these allocations, along with some contextual information, and saves this to a JSON file (Fig. 2). DynamoRIO was chosen because of its portability (multi-OS and multi-architecture) and because it is an open source project.
A. Allocation Monitoring
The data gatherer records information about dynamically allocated memory: each call to malloc, realloc, calloc or free is wrapped by pre- and post-call instrumentation. Pre-call instrumentation records parameters used for each allocation and deallocation. Post-call instrumentation records return values. dynStruct can support other memory allocation routines but the names must be the same as those provided by libc; we intend to address this in future work. For performance, dynStruct ignores allocations in library routines by default, but the user can provide a list of libraries to be instrumented.
dynStruct terms an allocated region of memory a block. A block is active until it is deallocated. When a block becomes inactive it is moved from an AVL tree of active blocks to a linked list which stores only inactive blocks. This handles multiple allocations of the same memory region natively, without time-stamps. Block information includes start and end addresses, size, whether the block was freed, the location of the wrapped call, etc.
B. Access Monitoring
Every memory access executed by the program is instrumented. First, we check whether the address accessed is within an active block. If so, the access is recorded and linked to this block. The record includes the size of the load/store, the number of times this access occurred, its offset within the block, and information about the accessing instruction such as the opcode and the opcode(s) of the context instruction (see III-D).
C. Function Calls
For every interaction with memory, dynStruct records the current function being executed, which DynamoRIO does not provide. To overcome this, dynStruct records function addresses in a stack. Function names are recovered via a hashmap of every loaded symbol. To identify addresses of external functions, dynStruct identifies the address of the target function by reading the corresponding GOT section, which is detected at runtime to handle position independent code.
D. Context
For each memory access two instructions are recorded: the accessing instruction and a context instruction. The intention is to assist type recovery in the structure recovery phase. For a write, the previous instruction may provide information
about how the data was generated. For a read, the following instruction may provide information on how the data is used. Contextual information is important for self-modifying code, which may generate instructions dynamically. Recording these two instructions avoids complex analysis in the structure recovery phase. Instrumentation is performed at the granularity of basic blocks. Consequently, context instructions are not available for writes at the start of a basic block or for reads at the end. Nevertheless, because a member is typically read and written many times, context instructions are usually available for all structure members.
E. Data Recording and Output
dynStruct uses the memory management functions provided by DynamoRIO to separate its data from the instrumented program’s. By using a chunked, linked list of 4 KiB pages, allocated on demand, dynStruct can run complex programs under the data gatherer with feasible time and memory overhead. Data is output every time the inactive blocks list reaches 100 blocks long. This keeps memory overhead low even for long running programs. When program execution terminates any remaining blocks, active or inactive, are written to the output file. For example, without this optimization dynStruct was unable to start an Emacs process with than 45K lines of Lisp (configuration files and modules): after 15 minutes the data gatherer stopped because it used more than 2 GiB of RAM. With the optimization, the same Emacs process and configuration started in 6 minutes and used a maximum of only 400 MiB.
IV. Structure Recovery
Initially, every memory block is considered a structure but, over five steps (Fig. 3), anything that does not look like a structure is removed.
A. Step 1: Recover Member Types and Sizes
The first step is to analyse the raw data from the JSON file to find the type of every member of every structure. This step is split in two sub-steps: get the size of the access, then recover the type.
a) Recovering Member Sizes: A member may be accessed with multiple sizes, often because of initialization with memset or compiler optimizations, so recovering the real size of each member is the most important step of structure recovery. dynStruct uses the heuristic that a member’s size is the size most commonly used to access it. If this distribution of sizes is multi-modal, the smallest size is used. This mainly happens because of string manipulation with XMM registers.
b) Recovering the Type: The type of a member is determined from the accessing and context instructions. The opcodes recorded by the data gatherer are disassembled using Capstone [12], a universal disassembly framework. Every access is typed, and the most frequent type is retained as the type of the member. The analysis for a write/read is based on checking whether the previous/next instruction respectively provides information that can be exploited to detect its type.
c) Block Comparison: Usually multiple instances of a structure are allocated during the execution of a program. To avoid repeating the recovery process on every instance of the same structure, dynStruct compares the types and sizes of members, block by block. If one of the two blocks has a “hole” instead of a member, the two blocks are still considered as instances of the same structure (because some instances can have unaccessed members). There are only two cases where types can be different but two blocks are still considered as instances of the same structure: if one block has a default type of a pointer size and the other has a pointer or a pointer to function, or if one block has a simple pointer and the other a pointer to function. If two blocks are deemed to be instances of the same structure, they are merged. The merge fills holes with members of the second block when available, and replaces less meaningful types (default type of pointer size and simple pointer) by more meaningful ones (pointer or pointer to function).
B. Step 2: Fill with Padding
At this stage there may be “holes” in recovered structures. Because the accesses are retrieved from only one execution of the program, some access paths may not have been used: without accesses, dynStruct cannot recover members. The compiler may also add padding to satisfy alignment
requirements. dynStruct fills these holes with padding, arrays of \texttt{uint8_t}.
C. Step 3: Array Detection
So far, only individual members have been recovered, but merging consecutive members which have the same type into an array can increase readability. dynStruct simply replaces a sufficiently long sequence of members of the same type with an array of the same size; the type of the array is that of its members. As it is common for a structure to have a few members of the same type — for example, a coordinate may be a pair of integers — dynStruct assumes that arrays have at least 5 members. Even if this assumption is wrong, the structure’s layout will still be correct. It would be possible to remove this restriction by examining access patterns in the data gatherer to reveal inner structures.
D. Step 4: Detecting Arrays of Structures
Similarly, consecutive structures are replaced by an array of structures. Detecting this pattern requires multiple passes until no new array is detected. This allows the discovery of arrays of structures where the inner structure contains another array of structures, etc.
E. Step 5: Fusing Array-like Structures
This last step removes every structure considered to be an array. A structure is considered to be an array if all its members are of the same recovered type or padding. This step can be disabled with a run-time option, as necessary. For structure recovery, showing (typically, many) arrays can obscure important structures in the flow of information. But, for memory use analysis, retaining arrays provides important information about how memory is used.
F. Output
The recovered structures can be written to a file or on the console with a C header style. It is also possible to serialize the recovered structures, loaded blocks and accesses. This allows starting the web interface later directly by loading this serialized file without having to re-run the recovery process.
V. WEB INTERFACE
dynStruct’s web interface provides a powerful and easy to use tool, linking the raw data and structures recovered to allow a reverser to explore memory usage. A web interface has the advantage of portability and allows collaborative exploration. Data can be obtained either directly from the data gatherer (via the JSON file) and analyser or, more quickly, load from a serialized file.
To help the reverser find data quickly, it is presented in tables, which can be sorted using any column as the key (for example, access size, or the name of a function that called malloc). Fig. \ref{fig:example} shows an example. Rows can be filtered using search boxes in each column. As well as displaying the data in an effective way, the web interface needs to be reactive, even with hundreds of thousands or more recorded accesses. Processing that amount of data in the browser (in JavaScript) is clumsy; for 700,000 entries any sorting or filtering action would take more than twenty seconds. To avoid that, all the sorting and filtering is done in Python before sending the data to the web interface.
The web interface allows structures to be edited easily, e.g. if a reverser wants to rename a structure member or change its type to improve readability or capture some semantic knowledge. The reverser can also add or remove members, or modify their size. The size of a complete structure cannot be changed, but new ones can be created and existing ones removed. This can be useful where structure recovery considered two similar blocks to be instances of the same structure, but the reverser wants to separate them as they are semantically different. The only condition for adding a block as instance of a structure is that it is the same size as the structure’s other instances. All the modifications made in the web interface are automatically saved in the serialized file.
VI. RESULTS
We measured dynStruct’s accuracy using a suite of small and large programs. Small programs present a tougher test for structure recovery since its accuracy depends on how many times and in how many places a structure is used. ‘Real’ programs were used to measure performance and memory overhead. All the tests were performed on a freshly setup VMware virtual machine running 64-bit Ubuntu 16.04 (kernel 4.4), with 4GiB RAM and 2 processors. The only packages installed were those needed by dynStruct and the test program.
dynStruct’s overheads are not related simply to the size of the instrumented program but to the number of allocations made and how these are accessed. The data gatherer’s memory overhead varied between 4$\times$ for emacs (Tab. \ref{tab:emacs}) and 20$\times$ for small programs, much of which is due to DynamoRIO’s and dynStruct’s libraries. The performance overhead varies between 20$\times$ and 50$\times$ that of the original program. The cost of structure recovery depends on the size of the JSON file but dynStruct’s performance certainly makes it a useful tool for small and medium sized programs — one of the authors has used it successfully in real time in capture-the-flag contests. Obviously, the cost of data gathering and structure recovery may be expensive for long running programs, especially if a specific action has to be taken to trigger the behaviour to analyse.
We examined the accuracy of structure recovery against the suite of programs use by Robbins \cite{robbins2016sharing}, excluding those that did not allocate structures. dynStruct’s accuracy is good but not perfect, correctly recovering 20/22 structures. It matched 48/61 members exactly and the remaining 13 partially, i.e. with the correct size but not the wrong type. In one example, an array of pointers was recovered as a mixture of \texttt{int64_t} and pointer types because not every element had the same context. In another, two semantically distinct but similar structures were recognised as instances of the same structure. dynStruct also misrecovered a structure consisting of a sequence of identical types as an array.
Table I
OVERHEAD RESULTS FOR THE DATA GATHERER AND THE RECOVERY PROCESS (ARITHMETIC MEAN AND 95% CONFIDENCE INTERVALS). MEMORY INCLUDES LIBRARY USAGE FOR THE PROGRAM, DYNAMORIO AND DYNSTRUCT. PERFORMANCE OVERHEAD INCLUDES THE TIME TO LOAD AND INITIALISE DYNAMORIO, ABOUT 0.05s
<table>
<thead>
<tr>
<th>program</th>
<th>Data gatherer</th>
<th>Structure recovery</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>memory usage</td>
<td>time</td>
</tr>
<tr>
<td></td>
<td>original</td>
<td>dynStruct</td>
</tr>
<tr>
<td>ls</td>
<td>2.4MiB</td>
<td>42MiB</td>
</tr>
<tr>
<td>netstat</td>
<td>2.6MiB</td>
<td>42MiB</td>
</tr>
<tr>
<td>emacs -q</td>
<td>27MiB</td>
<td>103.7MiB</td>
</tr>
<tr>
<td>xterm -e ’exit’</td>
<td>11MiB</td>
<td>68MiB</td>
</tr>
</tbody>
</table>
VII. CONCLUSION
dynStruct is a reverse engineering tool which can successfully recover structures used by a program. Its powerful web interface allows a reverse engineer to explore the raw data gathered and the structures recovered. It has been included in WeakerThan Linux 7, a custom security oriented Linux distribution (http://www.weaknetlabs.com/2016/07/wt7-updater-stable.html). dynStruct is available at https://github.com/ampotos/dynStruct.
REFERENCES
|
{"Source-Url": "https://kar.kent.ac.uk/63700/1/IEEE.pdf", "len_cl100k_base": 4116, "olmocr-version": "0.1.49", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 17078, "total-output-tokens": 5406, "length": "2e12", "weborganizer": {"__label__adult": 0.00031495094299316406, "__label__art_design": 0.00022923946380615232, "__label__crime_law": 0.00037169456481933594, "__label__education_jobs": 0.00023353099822998047, "__label__entertainment": 5.561113357543945e-05, "__label__fashion_beauty": 0.00012695789337158203, "__label__finance_business": 0.00012505054473876953, "__label__food_dining": 0.0002713203430175781, "__label__games": 0.0004355907440185547, "__label__hardware": 0.00136566162109375, "__label__health": 0.0003170967102050781, "__label__history": 0.0001684427261352539, "__label__home_hobbies": 7.94529914855957e-05, "__label__industrial": 0.000347137451171875, "__label__literature": 0.0001958608627319336, "__label__politics": 0.00019168853759765625, "__label__religion": 0.0003485679626464844, "__label__science_tech": 0.0214080810546875, "__label__social_life": 7.873773574829102e-05, "__label__software": 0.009246826171875, "__label__software_dev": 0.96337890625, "__label__sports_fitness": 0.0002646446228027344, "__label__transportation": 0.0003654956817626953, "__label__travel": 0.0001569986343383789}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 23198, 0.02739]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 23198, 0.7401]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 23198, 0.90625]], "google_gemma-3-12b-it_contains_pii": [[0, 531, false], [531, 5640, null], [5640, 9133, null], [9133, 13425, null], [13425, 19417, null], [19417, 23198, null]], "google_gemma-3-12b-it_is_public_document": [[0, 531, true], [531, 5640, null], [5640, 9133, null], [9133, 13425, null], [13425, 19417, null], [19417, 23198, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 23198, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 23198, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 23198, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 23198, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 23198, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 23198, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 23198, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 23198, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 23198, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 23198, null]], "pdf_page_numbers": [[0, 531, 1], [531, 5640, 2], [5640, 9133, 3], [9133, 13425, 4], [13425, 19417, 5], [19417, 23198, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 23198, 0.09091]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
ac110eec608769b6424906baa9e1bcd7eb478867
|
Qudi: a modular python suite for experiment control and data processing
Binder, Jan M.; Stark, Alexander; Tomek, Nikolas; Scheuer, Jochen; Frank, Florian; Jahnke, Kay D.; Müller, Christoph; Schmitt, Simon; Metsch, Mathias H.; Unden, Thomas
Total number of authors:
15
Published in:
SoftwareX
Publication date:
2017
Document Version
Publisher's PDF, also known as Version of record
Citation (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
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.
Qudi: A modular python suite for experiment control and data processing
Jan M. Binder\textsuperscript{a}, Alexander Stark\textsuperscript{a,b}, Nikolas Tomek\textsuperscript{a}, Jochen Scheuer\textsuperscript{a}, Florian Frank\textsuperscript{a}, Kay D. Jahnke\textsuperscript{a}, Christoph Müller\textsuperscript{a}, Simon Schmitt\textsuperscript{a}, Mathias H. Metsch\textsuperscript{a}, Thomas Unden\textsuperscript{a}, Tobias Gehring\textsuperscript{b}, Alexander Huck\textsuperscript{b}, Ulrik L. Andersen\textsuperscript{b}, Lachlan J. Rogers\textsuperscript{a,*}, Fedor Jelezko\textsuperscript{a,c}
\textsuperscript{a} Institute for Quantum Optics, Ulm University, Albert-Einstein-Allee 11, Ulm 89081, Germany
\textsuperscript{b} Department of Physics, Technical University of Denmark, Fysikvej, Kongens Lyngby 2800, Denmark
\textsuperscript{c} Center for Integrated Quantum Science and Technology (IQst), Ulm University, 89081, Germany
\textbf{A R T I C L E I N F O}
Article history:
Received 25 November 2016
Received in revised form
30 January 2017
Accepted 2 February 2017
Keywords:
Python 3
Qt
Experiment control
Automation
Measurement software
Framework
Modular
\textbf{A B S T R A C T}
Qudi is a general, modular, multi-operating system suite written in Python 3 for controlling laboratory experiments. It provides a structured environment by separating functionality into hardware abstraction, experiment logic and user interface layers. The core feature set comprises a graphical user interface, live data visualization, distributed execution over networks, rapid prototyping via Jupyter notebooks, configuration management, and data recording. Currently, the included modules are focused on confocal microscopy, quantum optics and quantum information experiments, but an expansion into other fields is possible and encouraged.
© 2017 The Authors. Published by Elsevier B.V. This is an open access article under the CC BY license (http://creativecommons.org/licenses/by/4.0/).
\textbf{C o d e m e t a d a t a}
Current code version
0.6
Permanent link to code/repository used for this code version
https://github.com/ElsevierSoftwareX/SOFTX-D-16-00092
Legal Code License
GNU General Public License v3
Code versioning system used
git
Software code languages, tools, and services used
Python3
Compilation requirements, operating environments & dependencies
Environment: Anaconda, Python 3.4+, Python packages: comtypes (Windows only), cyclery, fysom, gitpython, influxdb, IPython, jedi, jupyter-client, jemalloc, manhole, matplotlib, numpypy, PyDAQmx, pycallgraph, pytqgraph, PyQt4, qconsole, qtpy, RPi.GPIO(Raspberry Pi only), rpci, ruamel.yaml, scipy, spidev (Linux only), statsmodels, traitlets, visa, pywin32 (Windows only), zmq
If available Link to developer documentation/manual
Support email for questions
qudi@uni-ulm.de
* Corresponding author.
E-mail address: lachlan.j.rogers@quantum.diamonds (L.J. Rogers).
http://dx.doi.org/10.1016/j.softx.2017.02.001
2352-7110/© 2017 The Authors. Published by Elsevier B.V. This is an open access article under the CC BY license (http://creativecommons.org/licenses/by/4.0/).
Software metadata
<table>
<thead>
<tr>
<th>Current software version</th>
<th>0.6</th>
</tr>
</thead>
<tbody>
<tr>
<td>Permanent link to executables of this version</td>
<td><a href="https://github.com/Ulm-IQO/qudi/releases/tag/v0.6">https://github.com/Ulm-IQO/qudi/releases/tag/v0.6</a></td>
</tr>
<tr>
<td>Legal Software License</td>
<td>GNU General Public License v3</td>
</tr>
<tr>
<td>Computing platforms/Operating Systems</td>
<td>Linux, OS X, Microsoft Windows</td>
</tr>
<tr>
<td>Installation requirements & dependencies</td>
<td>Environment: Anaconda, Python 3.4+, Python packages: comtypes (Windows only), cycler, fysom, gitpython, influxdb, lpython, jedi, jupyter-client, lmfit, lxml, manhole, matplotlib, numpys, PyDaQmx, pycallbackgraph, gyctigraph, PyQt4, qtc, qtconsole, qtpy, RPi.GPIO (Raspberry Pi only), rpyc, ruamel.yaml, scapy, spidev (Linux only), statsmodels, traitlets, visa, pywin32 (Windows only), zmq</td>
</tr>
</tbody>
</table>
If available, link to user manual — if formally published include a reference to the publication in the reference list
Support email for questions qudi@uni-ulm.de
1. Motivation and significance
Modern scientific experiments typically rely on multiple hardware devices working together in a coordinated fashion. In many instances, the hardware devices are commercial products with programming interfaces for direct control via custom software. The unique combination of such devices is then specific to a given experiment. Efficient control of such experiments requires software that is capable of coordinating the operation of multiple devices. In addition, data interpretation is facilitated by rapid data processing and visualization.
These challenges are exemplified when studying color centers in diamond as solid state quantum emitters for sensing, spin manipulation and quantum information technologies. It is typical for such experiments to be performed on a "home-built confocal microscope" [1–5]. As evidenced by the 2014 Nobel Prize in Chemistry, these techniques have expanded beyond the context of physics and now this kind of microscope is pushing advances in biology [6–8] and nanotechnology [9,10]. A wide range of hardware is used for such experiments, but there is a paucity of mature and flexible lab control software to operate the apparatus.
Here, we present Qudi, a Python software suite for controlling complex experiments and managing the acquisition and processing of measurement data. Despite being developed in the context of quantum optics laboratories, the core Qudi framework is broadly applicable to many scenarios involving coordinated operation of multiple experiment devices. The free and open-source nature of Qudi makes it possible for anyone to use and modify the software to fit their research needs, and the modular code design simplifies this task. Qudi continues to be actively developed, but it is already mature enough for reliable laboratory use [11].
2. Software description
2.1. Why Python?
Python was chosen as the programming language for Qudi because of its conceptual synergy with the goals of the project. As a dynamic, strongly typed, scripting language, Python has become a popular choice for scientific programming [12,13] as the importance of scientific software increases [14]. Python’s high level of abstraction makes it human-readable and concise, providing a direct advantage for laboratory programming typically performed by scientists rather than dedicated software developers. Source code availability under an open-source license, the built-in modular structure of Python and good community support lower the initial hurdle to learn the language. Additionally, most laboratory hardware has at least an application programming interface (API) specified for the C programming language, which can be accessed by Python.
Scripting languages cannot replace established compiled programming languages for tasks where processing performance or memory efficiency is required but they are very useful to glue together different components in order to benefit from the advantages each of them can offer [15]. This is closely aligned with the concept of Qudi “gluing” together various devices and control methods for specific complex experiments.
2.2. Qudi design
The Qudi suite consists of a collection of modules that are loaded and connected together by a manager component according to settings given in a configuration file as shown in Fig. 1(a). The program startup code and manager were initially derived from similar elements contained within the neurophysiology software ACQ4 [16]. Startup is initiated by a single executable python file, and the manager component provides core functions for logging, error handling, configuration reading, and remote access. Additionally, the manager also administers the other modules by providing functionality for module loading, module dependency resolution and connection, concurrent execution and network access to modules running on other computers. This core infrastructure makes it easier to rapidly develop modules for new experiments by providing structure and starting points.
A typical Qudi session will proceed as follows. On startup, the supervisor process, for example an IDE, creates a Qudi process. In this Qudi process, the manager component reads the configuration file, sets up the log file and loads the modules designated in the startup section of the configuration file. Typically, the startup section will – but does not have to – contain at least the Manager GUI and the tray icon module. Laboratory operation and experiment control are performed by science modules, which are specified in the configuration file along with any hardware-specific parameters. Science modules can be loaded for the desired measurement from the Manager GUI or a Jupyter notebook. Some of the science modules in Qudi were inspired by the pi3diamond software [3–5, 17–19].
The science modules are divided into three categories: hardware interaction, experiment “logic”, and user interface. These categories and the relationships between them are illustrated in Fig. 1(b). The division into hardware, logic, and interface represents a clear separation of tasks that improves reliability and flexibility of the Qudi code. It also simplifies the implementation of new experiment modules. The fundamental three-fold distinction is at the basis of Qudi’s adaptability, and makes Qudi an experiment control software in contrast to a general software framework.
2.2.1. Logic modules
Logic modules control and synchronize a given experiment. They pass input parameters from the user interface to the respective hardware modules, and process measurement data in the desired way. These modules control the information exchange
between different hardware modules and perform all necessary computations and conversions.
Logic modules are the only type of modules that are allowed to interact with each other. They are also the only type of module that has its own thread and event loop. Therefore they are the place where concurrent execution of tasks and synchronization of different devices is handled. All steps from the start of a measurement to its end, including data evaluation and storage are performed by the logic. This goes as far as producing “publication ready” plots of data that are saved together with the raw data and which provide a good overview or can be sent to collaborators without post-processing.
2.2.2. Hardware abstraction via interfaces
Today it is possible and even necessary to control most experiment hardware remotely. Unfortunately, the command structure, grammar, measurement units and connection methods differ widely between device models or devices from different suppliers of experiment hardware. To get the most re-usability out of logic modules, it must be possible to interchange hardware modules for measurement devices that provide similar functionality, but work and communicate differently. It is the task of the hardware modules to overcome these problems by translating the commands given by the logic into the “language” of the specific hardware.
The problem is solved by defining an interface, a set of functions that a hardware module of a given type must implement, in order to make a certain measurement work. This set of functions is defined in a class (named …Interface in a file in the interface folder) where the default implementation of each function raises an exception, if it is not replaced in the device-specific implementation. This class is then inherited by the actual implementing hardware module and all inherited functions must be overwritten.
Hardware modules can represent virtual dummy or mock hardware, which emulates the functionality of a device. Those dummies could load recorded measurement files, create arbitrary data or may perform real physical simulations of measurements, where the result is prepared according to the interface commands which the logic can access. One of the most significant uses of dummy hardware modules is to test the experiment logic without being connected to any actual hardware.
2.2.2.3. Advanced abstraction via “interfuses”
Building on the abstraction of interfaces, Qudi introduces an additional concept to facilitate the reuse of modules. This ability is provided by interfuse modules which interconnect (or fuse) different hardware or logic modules to modify their interface behavior or to achieve a task for which these modules were not originally designed.
An interfuse is a logic module that implements a hardware interface. In doing so, it pretends to be hardware that can connect to an experiment logic module. This allows the core experiment functions to remain in the logic module, while altering the kind of data that is measured. A tangible example helps clarify this concept. A confocal image (2D array) can represent single fluorescence values from a photon counter for each position \( (x, y) \). An interfuse makes it possible to replace the counter data with spectrometer measurements at each pixel, allowing fluorescence to be imaged with arbitrary spectral filtering. This practice improves maintainability and prevents code duplication.
The other reason to use interfuses is where a desired feature would require altering an existing interface definition. For example, an interfuse can perform the coordinate transform to correct for a tilted sample in a confocal scan. As a result, the tilted surface appears flat in the confocal image and can then be imaged at a consistent depth.
2.2.4. GUI
Qudi GUI modules create windows on the screen that a user can interact with, allowing experiment control and data visualization. Their purpose is to offer a convenient way for the user to interact with logic modules, however Qudi is fully functional without the GUI modules. The logic can also be controlled by the integrated IPython console or from a Jupyter notebook. For this reason, GUI modules are not allowed to interact with each other or the hardware directly and they do no data processing.
The Qudi graphical user interface (GUI) is built with Qt [20], offering users a familiar appearance. Qt is suitable due to its multi-platform GUI toolkit that provides good Python bindings [21,22] and makes it possible to separate the GUI design from the implemented functionality. Also, Qt’s multi-thread ability ensures good scalability and parallel processing, which are essential requirements for complex experiments. Furthermore, Qt implements a signal-slot mechanism [23] that is very useful for
concurrency, modular design, and interaction between GUI modules and logic modules. On top of this, the Python library PyQt-Graph [24] makes it easy to create interactive, frequently updated 2- and 3-dimensional plots.
The user interface can be edited graphically in Qt Designer and is stored as an XML file. For rapid prototyping, this file can be (re)loaded by running a Python program. The GUI design strives to adhere to the KDE Human Interface Guidelines [25], as these stress the importance of interface familiarity and they work well with the default set of Qt user interface elements.
2.2.5. Interactive scripting
Interactive scripting provides a powerful additional user-interface for a flexible software suite. Qudi contains a built-in console with a fully integrated IPython interpreter. In addition, Qudi can be controlled from a Jupyter Notebook. This makes it possible to write a scripted document with incremental execution as well as inline visualization and analysis. Both the console and the Jupyter notebook can control all of the internal states of the Qudi software. These features enable rapid experiment prototyping, since a developer can test different approaches before committing to changes in hardware or logic modules.
3. Impact and reuse potential
The Qudi suite is useful for any small to medium-size computer-controlled laboratory experiment. Its modular design combined with the use of interface definitions makes it easy to integrate new hardware into an existing experiment. Moreover, this design offers the capability to easily reuse existing modules in new experiments. The Qudi core infrastructure is broadly applicable, even beyond the context of confocal microscopy or physics experiments in general.
Qudi is of more tangible impact to the quantum optics community in particular. The existing modules already offer control over confocal microscopes, electromagnets, motorized stages, lasers, (arbitrary) signal generators, and other devices used in this field of research. Table 1 lists the science modules currently included in the Qudi suite. Furthermore, typical measurement protocols and data analysis functions are already implemented. These existing modules make Qudi a ready-to-use Python-based software suite for quantum optics labs, independent from the individual hardware and measurement schemes used by different groups.
4. Illustrative example
The measurement of optically detected magnetic resonance (ODMR) on single color centers in diamond [26,27] requires the coordinated operation of a scanning confocal microscope and a microwave source. This section describes how such a measurement is performed with Qudi, illustrating the convenience arising from the software design outlined in this paper. The interested reader can perform this process using the default config distributed with Qudi that loads dummy hardware modules to provide representative data. This experiment makes use of the “confocal” and “ODMR” science modules.
The first step is to find a single color center inside the diamond. The Qudi confocal GUI and logic modules are used to move a diffraction-limited focal spot through the diamond sample in three dimensions [28–31]. This is achieved by scanning hardware that is controlled by the confocal logic. A photon counter records the fluorescence measured by the confocal microscope, and this hardware device sends the data to the confocal logic. The confocal logic produces an image of fluorescence as a function of position, and the GUI presents this image to the user. Fig. 2 shows the confocal GUI with an x–y image on the left and an x–z image on the right.
In order to focus on a single center, the user places the confocal carousel near a promising spot. An optimizer module performs a series of close-range scans around the cursor, and the optimal position of maximum fluorescence is found via a fitting module built on the lmfit package [32]. A 2D gaussian fit is performed on the x–y plane scan and for the third dimension a 1D gaussian fit on the z line scan. These are shown in Fig. 2 on the lower right of the Confocal GUI. Finally, the optimizer module moves the scanning hardware to the optimal position focused on the desired single color center.
In addition to spatial alignment, a microwave resonance condition has to be matched in order to detect the desired change in optical signal [26,27,33–35]. The ODMR logic module controls the frequency of a microwave source while recording the fluorescence level. The design of Qudi means that the ODMR logic is easily capable of driving a variety of microwave source hardware, increasing flexibility in the laboratory.
An ODMR experiment is performed by sweeping the microwave frequency and recording the fluorescence. Recorded data are shown live on screen in the ODMR GUI as both the fluorescence sum of all frequency sweeps and as a matrix plot containing each sweep (Fig. 2, lower right). ODMR scans of several spots can be measured automatically by saving the color center positions and then using a script to move from spot to spot, optimizing the position on each site and recording an ODMR spectrum.
5. Conclusions and future directions
Qudi is a generally applicable experiment control software suite, with infrastructure to support modular design of experiments, significantly reducing the effort involved in constructing new experiments. Qudi already offers a developed quantum-optics tool set capable of reliable laboratory operation, and a modern user interface.
There is continuing effort to expand the library of available science modules. One priority for the future is to simplify the setup of Qudi by providing a graphical configuration editor. Furthermore, it would be convenient to make Qudi installable from the Python
<table>
<thead>
<tr>
<th>Name</th>
<th>Purpose</th>
</tr>
</thead>
<tbody>
<tr>
<td>Confocal (GUI + logic)</td>
<td>Confocal microscope interface for imaging and positioning scanner.</td>
</tr>
<tr>
<td>Optimizer (logic)</td>
<td>Automatically center image scanner on a local signal maximum.</td>
</tr>
<tr>
<td>odrm (GUI + logic)</td>
<td>Microwave resonance experiments.</td>
</tr>
<tr>
<td>Pulsed (GUI + logic)</td>
<td>Pulse sequence measurements (pulsed laser and/or microwave).</td>
</tr>
<tr>
<td>Poimanager (GUI + logic)</td>
<td>Point-of-interest manager for keeping track of multiple measurement spots.</td>
</tr>
<tr>
<td>Magnet (GUI + logic)</td>
<td>Driving physical magnet on motorized stages to vary applied magnetic field.</td>
</tr>
<tr>
<td>Fit (logic)</td>
<td>Obtain fits for data in various common models (Gaussian, Lorenzian, sinusoidal, etc.).</td>
</tr>
<tr>
<td>Counter (GUI + logic)</td>
<td>Perform and display counting tasks of binary events either in continuous or gated way.</td>
</tr>
<tr>
<td>Wavemeter logger (GUI + logic)</td>
<td>Record and process data as a function of laser wavelength as measured by a wavemeter.</td>
</tr>
<tr>
<td>Spectrometer (GUI + logic)</td>
<td>Record and display spectrometer data.</td>
</tr>
</tbody>
</table>
References
Independent Research (DIMS project no. 4181-00505B, Individual no. 1311-00006B and Qubiz) and the Danish Research Council for Foundation, the Innovation Foundation Denmark (EXMAD project (FOR1493 and SFBTR21), BMBF (Project Q-Com), the Volkswagen Grants 667192, 611143) projects (SIQS, DIADEMS, EQUAM), DFG software, testing and reporting bugs.
Wolff, Samuel Müller and Andrea Filipovskifor contributionsto the software. Furthermore, we would liketothank Ou Wang, Gerhard Optics institute and for maintaining the predecessor to this software platform that can be used by the whole Quantum Package Index. In the context of experiment operation, enhanced automation capabilities are desired to allow a user to rearrange the existing functionality without programming.
Acknowledgments
We would like to thank Boris Naydenov for advocating the use of a software platform that can be used by the whole Quantum Optics institute and for maintaining the predecessor to this software. Furthermore, we would like to thank Ou Wang, Gerhard Wolff, Samuel Müller and Andrea Filipovski for contributions to the software, testing and reporting bugs.
This work was supported by the ERC (ERC-2013-SyG), EU (FP7 Grants 667192, 611143) projects (SIQS, DIADEMS, EQUAM), DFG (FOR 1493 and SFBTR 21), BMBF (Project Q-Com), the Volkswagen foundation, the Innovation Foundation Denmark (EXMAD project no. 1311-00006B and Qubiz) and the Danish Research Council for Independent Research (DIMS project no. 4181-00505B, Individual Postdoc and Sapere Aude, 4184-00338B).
References
|
{"Source-Url": "https://backend.orbit.dtu.dk/ws/portalfiles/portal/131440021/Untitled.pdf", "len_cl100k_base": 5226, "olmocr-version": "0.1.50", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 21656, "total-output-tokens": 8340, "length": "2e12", "weborganizer": {"__label__adult": 0.0003006458282470703, "__label__art_design": 0.0005578994750976562, "__label__crime_law": 0.00026869773864746094, "__label__education_jobs": 0.001018524169921875, "__label__entertainment": 0.0001475811004638672, "__label__fashion_beauty": 0.00018870830535888672, "__label__finance_business": 0.0002868175506591797, "__label__food_dining": 0.0004851818084716797, "__label__games": 0.00064849853515625, "__label__hardware": 0.003475189208984375, "__label__health": 0.0007424354553222656, "__label__history": 0.00031113624572753906, "__label__home_hobbies": 0.00019216537475585935, "__label__industrial": 0.0009760856628417968, "__label__literature": 0.00019299983978271484, "__label__politics": 0.0002532005310058594, "__label__religion": 0.0005269050598144531, "__label__science_tech": 0.276611328125, "__label__social_life": 0.0001348257064819336, "__label__software": 0.0428466796875, "__label__software_dev": 0.6689453125, "__label__sports_fitness": 0.00032639503479003906, "__label__transportation": 0.000408172607421875, "__label__travel": 0.0002081394195556641}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 31336, 0.06028]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 31336, 0.50114]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 31336, 0.80464]], "google_gemma-3-12b-it_contains_pii": [[0, 1484, false], [1484, 4692, null], [4692, 11285, null], [11285, 16093, null], [16093, 23194, null], [23194, 27933, null], [27933, 31336, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1484, true], [1484, 4692, null], [4692, 11285, null], [11285, 16093, null], [16093, 23194, null], [23194, 27933, null], [27933, 31336, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 31336, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 31336, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 31336, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 31336, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 31336, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 31336, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 31336, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 31336, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 31336, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 31336, null]], "pdf_page_numbers": [[0, 1484, 1], [1484, 4692, 2], [4692, 11285, 3], [11285, 16093, 4], [16093, 23194, 5], [23194, 27933, 6], [27933, 31336, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 31336, 0.10909]]}
|
olmocr_science_pdfs
|
2024-11-28
|
2024-11-28
|
38b8c8405267e915e18dbeaf5e11d2e2bd2049fb
|
Teaching software systems thinking at The Open University
How to cite:
For guidance on citations see FAQs.
© 2015 The Institute of Electrical and Electronics Engineers, Inc
Version: Version of Record
Link(s) to article on publisher’s website:
http://dx.doi.org/doi:10.1109/ICSE.2015.161
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.
Teaching Software Systems Thinking at The Open University
Michel Wermelinger, Jon G. Hall, Lucia Rapanotti, Leonor Barroca, Magnus Ramage, Arosha Bandara
Computing and Communications Department, The Open University
Walton Hall, Milton Keynes MK7 6AA, UK
Abstract—The Open University is a distance-based higher education institution. Most of our students are in employment and study from home, contacting their tutor and fellow students via e-mail and discussion forums. In this paper, we describe our undergraduate and postgraduate modules in the software systems area, how we teach them at a distance, and our focus on shifting our students’ minds into a reflective, critical, holistic socio-technical view of software systems that is relevant to their particular professional contexts.
I. INTRODUCTION
The Open University (OU) is the UK’s largest university, with ca. 200,000 students. Apart for our on-campus PhD students, study with the OU is at a distance: students are assigned a tutor and provided with printed and online learning materials which they study at their leisure, towards fixed-date assessment points, in their own social and professional context. Most of the students on our computing programmes are employed, with most of our postgraduate students already working in the IT industry. Tutors mark their students’ assignments, answer their queries, and organise tutorials, mostly online. Tutors in the computing programmes are largely practicing or retired IT professionals or academics at other universities.
The 2010 Independent Review of Higher Education Funding and Student Finance (aka Browne Review) increased indirect pressure on UK universities to consider their output differently: with course fees increasing substantially, students now see degrees as commercial products and have expectations concomitant with that status. To pay fees, most students ask for government loans, which are only available to students registering for a degree. This had a major impact on the OU: our modules, whilst embedded in degrees, were designed to be as much as possible self-contained so that students could pick and mix modules to suit their personal interests or professional needs, without necessarily taking a full degree.
These, and other drivers, have caused a re-evaluation of the whole OU computing curriculum at both undergraduate and postgraduate levels. The results of that re-evaluation—new modules in new structures—are now being offered to students.
A. The undergraduate context
In 2011, we carried out a major review of the level 3 (final year) computing curriculum, against a background of a changing landscape, where desktop computing is being overtaken by ubiquitous computing, with the web becoming a universal utility, and where outsourcing and globalisation mean that technical skills need to be at a higher level.
The main outcome of that review was that our graduates would need to understand the issues surrounding:
- people and systems everywhere – from how different groups of people will work and use software systems to how people develop, design and maintain these systems;
- information services everywhere – from modelling and storing information to accessing services on mobile platforms and the cloud;
- devices everywhere – from fixed and mobile networks to the experience of living with and building for the Internet of Things.
Three clusters of modules were planned to address those three issues, with the people and systems cluster being the first developed, and the other two currently in production.
The focus of the people and systems cluster goes beyond the initial design of the system to its use and maintenance, for which issues of organisational context and change are crucial. It is principally rooted in software engineering and information systems, but it also draws upon systems thinking, management (including project management), and science and technology studies. This cluster was divided in two modules, further described in Section II.
B. The postgraduate context
Our previous postgraduate curriculum [1] was based on 15-credit modules and a 60-credit dissertation (research project). This range of small modules allowed students to configure their study to suit their interests and needs. However, it led to many assignments and exams to get a Diploma or MSc qualification, making them less attractive. This, and the OU’s move to a qualification-focused curriculum, led to a new postgraduate curriculum with 30-credit modules and explicit specialisations in:
- Information Security and Forensics, with compulsory modules Information Security (M811) and Digital Forensics (M812);
- Software Engineering, with compulsory modules Software Development (M813) and Software Engineering (M814), which together span the body of knowledge specified in the SWEBOK [2].
The MSc research project must be aligned with the specialisation. Section III describes the new modules except M812, which is outside the scope of this paper.
1http://en.wikipedia.org/wiki/Browne_Review
II. THE UNDERGRADUATE MODULES
A. TM353 — IT Systems: Planning for Success
This module draws heavily on previous postgraduate teaching in information systems. It starts from the observation that, however well designed technically, IT systems in practice fail very frequently. The premise of TM353 is that this is due to the socio-technical nature of IT systems in use: that they are a complex mixture of technology (including hardware, software and networking), organisations, and people.
The goal of TM353 is to equip students with skills to enable them to plan, design and implement IT systems which are successful in use. The concept of socio-technical systems design is not new — it goes back to the work of the Tavistock Institute on industrial systems such as coal mining and manufacturing in the 1950s, and has been applied to information technology since at least the 1970s [3]. In recent years, it has been explicitly linked in some literature to software engineering [4][5], the latter calling for a new field of “socio-technical systems engineering”. However, a concept of socio-technical systems is frequently absent from computing curricula.
This module is strongly based within systems thinking. The OU has a 40 year history of teaching systems thinking, making considerable use of diagrams as a form of qualitative modelling as this has proved accessible to distance education [6]. A particularly relevant form of systems thinking that has arisen at the OU is the systems failure method, which identifies the systemic causes of failures and enables organisations to learn from them for the future [7]. The OU systems traditions are enhanced by techniques from socio-technical systems design, especially the work of Mumford [3]; and also the considerable recent work on complexity theory and the complex interactions between components in a large-scale IT system.
In addition to the systems framework that forms the basis of the module, a series of concepts and techniques are drawn in as appropriate from other areas related to IT systems. These are concerned either with initial design to ensure systems success (including issues of power and stakeholder analysis, information systems methodologies, security and privacy, reliability and dependability), or with actions to ensure ongoing success (including information systems evolution, scenario planning and disaster recovery). Running throughout the module is a strand concerned with legal, social, ethical and professional issues, and with project management.
The nature of IT systems success is not taken for granted. The module acknowledges that this is a contested question, deeply bound up with different stakeholder perspectives and the power relations between stakeholders: what is a success to one group may look quite different to others. The nature of failure, and the different reasons why systems fail, is also examined in detail, and a distinction drawn between success in the execution of a project to develop and implement an IT system, and its success at effectively meeting the needs of the organisation where the system is situated.
Although TM353 introduces a significant number of practical tools and concepts, the module is ultimately aiming at a mental shift among students: the development of an awareness that IT systems are inherently socio-technical, and that their success or failure arises from socio-technical factors rather than purely technical ones.
B. TM354 — Software Engineering
This module teaches the principles, patterns, techniques and practice associated with requirements engineering, analysis, software architecture and design, as well as the principles and techniques of implementing and testing a software system. Students get a sound understanding of the quality issues involved in software products and processes. The module follows a plan-driven development contrasting it at each stage with an agile approach; for example, while studying requirements documentation using the Volere template2, the students also listen to, and write about, an interview3 where the authors of the template discuss their perspective on the implications of an agile approach to requirements and their documentation. Students develop a practical awareness of different approaches to software development and an understanding of agile practices.
Although modelling techniques are taught, and a notation like UML is used throughout the module, the emphasis is not on the details of the techniques but rather on understanding a problem and its context, to help students make their own judgements on what is most appropriate for a specific situation.
Students are encouraged to be creative and to work with others, sharing their artefacts and reflecting on feedback from colleagues. They use a collaborative tool where they upload models and give comments to, and receive feedback from, colleagues. As part of their assessment they need to reflect on changes they make to their own artefacts as a result of comments received. In a distance teaching setting, this is a way to simulate what would happen in an agile stand-up meeting in the process of reaching a shared understanding of a problem/solution.
TM354 was designed with the preoccupation to develop critical reflection. As a level 3 module, it also prepares students for the final project in software engineering, developing the required skills, e.g., conducting research searches, assessing and reviewing found material. To promote an understanding of the professional context, TM354 brings in regularly updated topics on software engineering practice, challenging students to confront what they learn with what practitioners do.
III. THE POSTGRADUATE MODULES
A. M811 — Information Security
Whether in the public or private sector, it is the value invested in the information assets of a modern organisation that underpins its effectiveness and drives its profitability. M811 explores the professional and technical skills necessary to understand, document, manage and implement strategic and operational aspects of an organisation’s information security.
2http://www.volere.co.uk/template.htm
3http://www.se-radio.net/2012/09/episode-188-requirements-in-agile-projects/
M811 teaches important and transferrable topics in information security risk assessment and management, as well as professionalism, home information security, and information security research.
Every organisation in the UK has Information Security responsibilities. Many large organisations (but by no means all!) do have hard InfoSec stances, understanding the criticality of their information assets, their threat landscape, and the relationship of policy, technologies and strategy in protecting them. Other organisations, typically smaller ones, have a weaker understanding of their InfoSec needs. They are, however, constrained by the availability of InfoSec knowledge that is directly applicable to their InfoSec needs. M811 is aimed at employees of such organisations and, as we will describe below, provides a fit-for-purpose pilot InfoSec management system for that organisation.
Students are located throughout their study within their own organisation. This provides a very rich context for the module to draw from and permits the student to deliver value back into their organisation from their study.
The role of the student on M811 develops from learner at module start to InfoSec problem solver at module end. The problem solving skills taught align with the international InfoSec standard and are based on industry standard texts. What M811 adds is a detailed conceptual framework that underpins leading edge professional skills, giving the student their own updatable learning framework which includes the research literature and the incredibly rich, essentially daily updated resource that includes blogs and podcasts. We achieve this by encouraging the student to explore the InfoSec world and to learn where are the valuable resources that are relevant for their and their organisation’s professional situation.
All assessment in the module is based within the student’s organisation. Typically, a student will identify a problem with their organisation and bring it into the module. Extending the module’s conceptual basis is a framework for guided reflection. Almost 50% of the assessment is the student’s own reflection on their organisation’s problems and their candidate solutions for them. We provide a generic marking scheme to the tutors to allow them to assess their students’ work consistently, despite the diversity of work to assess.
Using the student’s rich context has benefits for M811 in that it uniquely contextualises the module’s materials for the student, forcing them to deal with real-world complexity [8]. Typically, traditional assessment needs to provide time-boxed mechanisms for the validation of the student’s work; questions from this year cannot be reused next year as the answers will be the same. As the student’s rich context provides a unique assessment environment, M811 assessment materials do not have to change year on year.
B. M813 — Software Development
M813 is the first module in the new postgraduate Software Engineering specialism. It teaches a wide range of software engineering theories, principles and techniques across the life cycle, with particular emphasis on problem definition, analysis, design, implementation and testing, and includes systematic and creative application to practice through a wide range of transferrable, professional and research skills, including critical evaluation.
With a similar approach to M811, M813 takes advantage of its students’ rich professional context to close the gap between academic learning and professional practice, an acknowledged major challenge in software engineering education [9], [10], [11]. Via the module’s assessment students engage with a development problem of their choice, working towards a software system for an organisation they are familiar with, and interacting with stakeholders in that organisation. M813 uses the same generic marking scheme approach as M811.
As part of their submission, alongside software development artefacts, which demonstrate to which extent they have mastered specific approaches and techniques, students are also required to provide a written commentary in the form of guided reflection, including both an articulation of justifications and rationale for their choices in the application of what we teach within their real-world context and the lessons learnt in the process, as well as a critical reflection on the teaching as it stands against their own practice. The latter closes a feedback loop which is particularly useful to us as academics as it enables the evaluation of what we teach and its relevance and appropriateness in current professional practice.
C. M814 — Software Engineering
Continuing from M813, M814 is aimed at students interested in developing their systems analysis and management skills, e.g., software developers taking on system analyst or project manager duties, or managers coming from other disciplines. The module examines software’s role in organisations from human, social, knowledge, business, and domain problem (requirements) perspectives [12], thereby providing a system perspective to students.
On the one hand, M814 provides an in-depth exploration of the requirements engineering process, starting from stakeholders, goals and scope of software projects to elicitation, analysis and communication of requirements, centering on the Volere approach, as described in the set book [13].
On the other hand, it covers topics like ethical issues, intellectual property rights (including an interview with a patent examiner at the European Patent Office), human motivation, risk assessment, quality and knowledge management, and software evolution, many of which are required for professional accreditation, e.g., by BCS, The Chartered Institute for IT.
In order to make students reflect holistically about the multiple relationships and mutual influences between software and the wider organisational context, some assessment questions ask students to analyse a fictitious case study from multiple perspectives: human resource management, ethical and legal issues, choice of development process, etc. Those and other questions often have no clear right or wrong answer. Instead, the marking scheme rewards students for the arguments put forward, for the breadth of their knowledge, and for ‘seeing both sides of the coin’.
Information literacy and critical analysis skills are also key learning outcomes for M814. Students have to critically read literature to sift the original from the incremental and the evidence from the hype, a valuable professional skill in the fast-paced IT industry. Criteria to evaluate papers are given in the Course Guide. Each year, we strive to include one academic paper and one magazine article to expose students to different types of literature. Such papers help M814 maintain currency and provide complementing or contrasting perspectives on the issues covered in the M814 text.
A precursor module helped students gain first-hand experience of managing the variety of stakeholder viewpoints that must be reconciled as part of the requirements engineering process, through a collaborative requirements elicitation and analysis exercise based on a case study scenario. Despite the challenges of undertaking this activity asynchronously, at a distance, many students valued the experience because it helped them gain a better understanding of the requirements engineering process. We have retained this collaborative working activity in M814, modifying it to use an industrial configuration management tool (Git on GitHub) to collaboratively edit the requirements specification documents.
M814 uses 3 dynamic system models defined with VersionSim and custom-made interfaces developed with Sable. The models illustrate trade-offs between productivity, cost and quality [14], Brooks’ Law, and Lehman’s 2nd Law (as a system evolves its complexity increases, unless work is done to maintain or reduce it). Each model provides some parameters that students can change (e.g., the team size for Brooks’ Law) before running the simulation and seeing the results of output values (e.g., time to complete the project). Each model comes with various activities for students to become familiar with the model. Solutions to activities are provided to tutors, but not to students, so that they can discuss the activities in the online forums. The assignments always include a question about one of the system models, for example asking students to find input parameter values that lead to a particular scenario and to reflect on the use of such simulations for management decisions.
IV. Concluding Remarks
In this paper, we have described the new postgraduate and final year undergraduate software systems offering at The Open University. Changes in the IT and UK higher education landscapes have led to a new curriculum in which relevant technical and soft skills are blended to provide a rounded academic education to professionals. Topics are drawn from multiple disciplines so that students appreciate, from ethical, economical, management, and other perspectives, the rich socio-technical systems formed by software, its stakeholders and their organisations, and apply systems thinking to ascertain risks, solve problems, and prepare for systems failure.
The modules’ content and assessment are carefully designed so that they can be delivered at a distance and at scale to students who have to fit study into often busy personal and professional lives. For example, the type and workload of technology-mediated collaborative activities is considered.
Although the undergraduate and postgraduate modules described cover similar ground, the latter have more open-ended, reflective, and contextualised assessment. Higher education delivers value to the student through validation of their learning. Locating that education in the student’s rich professional context enhances and extends the value proposition for the student, who is then able to contribute to the solution of system-wide problems faced therein.
For M811 and M813, we have begun evaluating the novel situated approach to teaching, including their impact on students’ learning and how they are received. We will report preliminary outcomes soon. Here we have provided the rationale for the revised programme and the concepts of the modules taught there, informed by several decades of experience at The Open University in crafting high-quality distance learning.
REFERENCES
4 http://www.ventanasystems.co.uk/services/software
|
{"Source-Url": "http://oro.open.ac.uk/42076/1/systems15jseet.pdf", "len_cl100k_base": 4130, "olmocr-version": "0.1.49", "pdf-total-pages": 5, "total-fallback-pages": 0, "total-input-tokens": 14012, "total-output-tokens": 5407, "length": "2e12", "weborganizer": {"__label__adult": 0.0008950233459472656, "__label__art_design": 0.001407623291015625, "__label__crime_law": 0.0008521080017089844, "__label__education_jobs": 0.32568359375, "__label__entertainment": 0.0001958608627319336, "__label__fashion_beauty": 0.0005173683166503906, "__label__finance_business": 0.0010480880737304688, "__label__food_dining": 0.0012416839599609375, "__label__games": 0.0012454986572265625, "__label__hardware": 0.001220703125, "__label__health": 0.001628875732421875, "__label__history": 0.0008234977722167969, "__label__home_hobbies": 0.00033473968505859375, "__label__industrial": 0.0008878707885742188, "__label__literature": 0.0011510848999023438, "__label__politics": 0.0006055831909179688, "__label__religion": 0.0014896392822265625, "__label__science_tech": 0.01947021484375, "__label__social_life": 0.0005426406860351562, "__label__software": 0.013427734375, "__label__software_dev": 0.62255859375, "__label__sports_fitness": 0.0007925033569335938, "__label__transportation": 0.001377105712890625, "__label__travel": 0.0005998611450195312}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25278, 0.02624]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25278, 0.47742]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25278, 0.93561]], "google_gemma-3-12b-it_contains_pii": [[0, 801, false], [801, 5851, null], [5851, 12087, null], [12087, 18419, null], [18419, 25278, null]], "google_gemma-3-12b-it_is_public_document": [[0, 801, true], [801, 5851, null], [5851, 12087, null], [12087, 18419, null], [18419, 25278, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 25278, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25278, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25278, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25278, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25278, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25278, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25278, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25278, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25278, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25278, null]], "pdf_page_numbers": [[0, 801, 1], [801, 5851, 2], [5851, 12087, 3], [12087, 18419, 4], [18419, 25278, 5]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25278, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-27
|
2024-11-27
|
510e463e2902a99a155c8b70c470bd4670979fef
|
For this assignment, you are to write a simulation in which a number of processes access a group of shared buffers for both reading and writing purposes. Initially this will be done without the benefit of synchronization tools (semaphores) to illustrate the problems of race conditions, and then with the synchronization tools to solve the problems. Interprocess communications (messages) will be used by child processes to notify the parent of the results of their work. Optional enhancements allow for the use of threads and the investigation of deadlocks as well as race conditions.
Program Overview
The general operation of the program will be as follows:
1. First a number of buffers will be allocated in shared memory, i.e. an array of nBuffer integers, where nBuffer is a PRIME number given on the command line. All of the buffers will be initialized to zero.
2. Next the program will create a shared message queue, which child processes can use to send messages back to the parent. (It may also be possible to send messages from parent to child, but that complicates issues a bit.)
3. Then the parent will fork off a number nChild processes, where nChild = nBuffer / 2. (Note that nBuffer must be at least 5 for the simulation to be meaningful.) The ID numbers for each child will range from 1 to nChild. (Note that ID numbers start at 1, not 0.)
4. Each child will then perform a sequence of read and write operations on the shared buffers, accessing them in the following order:
a. The first buffer accessed will be the child’s ID number % nBuffer. (Which should just be the child’s ID so long as nChild < nBuffer.)
b. Successive accesses will jump by steps of the child’s ID number, in a circular fashion. Child number 3 will access every 3rd buffer, child number 5 will access every 5th buffer, etc., wrapping back to zero on a mod basis when the numbers exceed nBuffer.
c. The first two accesses of every three will be for reading, and the third for writing.
d. The cycle continues until each process has written into nBuffer of the buffers, which should involve writing into each buffer exactly once, (3 \times nBuffer total accesses), since nBuffer is prime and nChild must be strictly less than nBuffer.
e. So for example, if nBuffer = 7, then the order of access for child number 3 would be as follows, where the underlined numbers are write access and the others are reads:
\[ 3, 6, 2, 5, 1, 4, 0, 3, 6, 2, 5, 1, 4, 0, 3, 6, 2, 5, 1, 4, 0 \]
5. A read operation will consist of the following steps:
a. Read the initial value in the buffer.
b. Sleep for K \times ID seconds, where ID is the child’s ID number and K is a constant adjusted to make the simulation last a reasonable amount of time. An initial suggestion is to try K = 1 / nBuffer. (Note: use usleep( ) instead of sleep( ) for sub-second resolution. See man 3 sleep, man 3 usleep and man 2 nanosleep for details.)
c. Read the value of the buffer again, and send a message to the parent if the value changed while the child was sleeping. The message should include (at a minimum) the ID of the child sending the message, the buffer which changed, the initial value, and the final value.
6. A write operation will consist of the following steps:
a. Read the initial value of the buffer.
b. Sleep for K \times ID seconds. (See above.)
c. Add 1 \ll (ID – 1) to the value read in step (a), and store the result back into the buffer. (E.g. child number 3 adds binary 000001 shifted left 2 places = 000100 = 4.) Each child will add a single binary bit in a different position, which will make it possible to later identify which child(ren) were involved in any error conditions.
7. After a child has completed all write operations, it sends a final message indicating completion back to the parent, and then exits.
8. The parent reads messages from the message queue until it has read and processed the exit messages from each child process. Each message received is printed to the screen. Then the parent does a wait( ) on its children. (Or the parent could wait on the children one by one as each ending message is received.)
Message Queue Operations
- Messages, semaphores, and shared memory all use a similar set of commands and operations, following roughly the same sequence of operations shown below. (See the man page of ipc(5) for more details on the common features of these commands. Note carefully that the use of System V IPC is recommended for this assignment, which is not exactly the same as the POSIX versions. (Make sure to avoid the (P) sections of the man pages to avoid confusion.)
1. Acquire a “key” value, which is just a numeric “name” identifying this particular resource. There are three means of acquiring a key value: (A) Just pick a random number and hope no one else uses the same one, for example the last 4 or 5 digits of your student number. (B) Use IPC_PRIVATE, (0), for your key number, which means this resource will not be accessed by any other processes. This MIGHT work for common access by a parent and children of a fork for resources allocated before the fork takes place, but you’ll have to try it to find that out. (C) The system call ftok(3) will generate a unique key number based on a unique filename
and a user chosen number (8 bit character). This is most appropriate if the resource needed
relates to a file somehow (e.g. semaphores for file locking). Because key access is identical
for all resources, it will not be discussed further under semaphores or shared memory.
2. Either create a new instance of the desired resource, or get access to one that has already been
created, (presumably by some other process), using the unique key number acquired in
step 1. The command to do this for message queues is msgget(2), which takes two arguments –
the key described above and an integer of ORed bit flags. The low order 9 bits of this flag
are read/write permission bits, so include 0600 as part of the flag for read/write permission by
this user, or 0400 or 0200 for read-only or write-only permissions respectively. (Execute bits
are ignored.) You should also OR in IPC_CREAT when creating a new instance of this
resource (as opposed to getting your hands on a resource that has already been created.)
msgget returns a queue ID, which can then be used for later operations.
3. Control the resource, which basically means getting and setting parameters which control its
operation. The msgctl(2) command takes three arguments – the message queue ID, a
command constant, and a pointer to a struct of type msqid_ds. The man page for msgctl(2)
describes the legal commands, and ipc(5) describes the msqid_ds structure. Among other
information, msqid_ds holds the number of bytes currently in the queue and the process IDs
of the last sending and receiving process, as well as the last sending, receiving, or changing
times.
4. Use the resource, which for messages means using msgsnd(2) and msgrcv(2).
- msgsnd takes four arguments: The queue ID, a pointer to a msgbuf struct (see below), the
size of the message, and a flags word.
- msgrcv takes five arguments: The queue ID, a pointer to a msgbuf struct, the maximum
size of message accepted, the type of message desired (see below), and a flags word.
- The msgbuf struct contains two fields: a long int for the type of the message, and a char *
(e.g. an array of characters). The type information is used with msgrcv to request
specific types of messages out of the queue, or else to request whatever message is
available. (Note: char * was commonly used as a generic pointer type in C before the
void * type was added to the language. You can use typecasts to include any type of data
in msgbuf, not only characters.)
- The IPC_NOWAIT flag is used to specify whether sends or receives should be blocking
or non-blocking.
- **Message Types:** When receiving messages, a process may grab the next available message of any
kind, or search the queue for messages of a given “type”. For this assignment as written so far,
messages are one-way traffic from children to parent, and since only the parent is reading
messages, there is no need to specify types.
Alternatively, to provide for two-way message traffic, each message can be given a “type”, where
the type = the ID number for messages from children to the parent, and 100 + ID for messages
from parent to child. Children search the message queue looking only for messages with type =
100 plus their ID, and the parent reads all messages less than or equal to nChild. See the man
pages for msgsnd(2) and msgrcv(2) for more information on this idea.
**Orphaned Message Queues:** There is a problem that you should be aware of regarding message queues, (and other IPC resources?), and fortunately there is also a solution:
- Programs that create message queues and do not remove them afterwards can leave "orphaned" message queues, which will quickly consume the system limit of all available queues. Then no more can be created and your programs won't run. (And neither will anyone else's.)
- The command "ipcs -q -t" will show you what queues are currently allocated and who has them, along with an ID number for each one.
- Then the command "ipcrm -q ID" can be used to delete any that are no longer needed, where "ID" is the number you got from ipcs.
- You should check this periodically, and certainly before you log off. You should also be sure to free up your allocated queues in your program before exiting, (using msgctl with the cmd type of IPC_RMID. You may also want to employ exception handling so that in the event of a program crash the queues get cleaned up on exit.)
- Read the man pages for ipcs and ipcrm for more information.
- The lab computers can also be safely rebooted if you discover the problem there and the queues belong to someone else.
**Shared Memory Operations**
- The relevant commands for shared memory are shmget(2), shmctl(2), shmat(2), and shmdt(2), analogous to msgget, msgctl, and msgsnd/msgrecv as described above.
- Shmget operates similarly to new or malloc, by allocating or getting shared memory. The three arguments are the key ID (as above), the number of bytes of memory desired, and flags as discussed above. However note that shmget does not return a memory address the way new and malloc do – Rather it returns an integer ID for this block of shared memory, similar to msgget and semget.
- Shmctl is used to examine and modify information regarding the shared memory. It will probably not be needed for this assignment.
- Shmat returns a memory address given a shared memory ID number, much like new or malloc. At this point the memory address can be used for accessing the shared memory just as any other address is used for accessing “normal” memory. Essentially shmat binds the shared memory to the user’s local address space.
- Shmdt detaches shared memory from the local address space, and is a companion to shmat in the same way that delete or free are companions to new or malloc.
**Semaphore Operations**
- The relevant commands for semaphores are semget(2), semctl(2), and semop(2), analogous to msgget, msgctl, and msgsnd/msgrecv as described above.
- Note that System V semaphores come as an array of semaphores, which is actually convenient for our purposes. The semget command returns an ID for the entire set of semaphores generated. The three arguments to semget are a key number (as described for messages above), the number of semaphores desired in the set, and a flags word.
• Semctl uses a **union** of an integer value, an array of shorts, and an array of structs. A union is similar to a struct, except that only enough memory for the largest data item is allocated, and that memory is shared by all elements of the union. ( A struct containing a double, an int, and a char would be given enough space to store all three independently; A union with the same variables would only allocate enough room for the double ( the largest element ), and all three variables would be assigned the same storage space. Obviously in practice one ( normally ) only uses one of the elements of a union. )
• Semctl is used to get / set the **initial** values of semaphores, query how many processes are waiting for semaphore operations, and to get specific process IDs of such processes. Semctl is used for initialization and maintenance of semaphores, but should NOT be used for the wait and signal operations discussed in class. ( See semop, next bullet point. )
• The semop system call is used to perform normal semaphore operations. The command takes three arguments: a semaphore set ID, an array of sembuf structs, and an integer indicating the size of the array of structs.
• The sembuf struct contains three fields: the semaphore number to operate on, a short int indicating the semaphore operation desired, and another short int of flags ( e.g. IPC_NOWAIT ). Negative semaphore operations decrement the semaphore, blocking if appropriate ( e.g. wait ), a zero value blocks until the semaphore is exactly zero, and positive numbers increment ( e.g. signal ). If you are not familiar with bit twiddling in C/C++, you may want to find a good book and review the bitwise operators ~, &, |, ^, <<, and >>.
**Additional Details**
• Command Line Arguments – The first argument on the command line should be a prime integer, indicating how many buffers to use. The second argument is optional, and should be either “-lock” if semaphore locks are to be used or “-nolock” otherwise. Default operation should be “-nolock” if the second argument is not provided. You may add additional command-line arguments if you wish ( e.g. for optional enhancements such as the number of children ), but you must document them thoroughly.
**Required Output**
• All programs should print your name and CS account ID as a minimum when they first start.
• Each message received by the parent process from a child should be printed to the screen.
• The parent should keep track of how many read errors occur ( reported by children ), as well as how many write errors occur ( buffers which do not hold the correct value at the end, which should be 2ⁿChild - 1 for all buffers. ) Note the following:
• In the case of read errors, the process(es) that wrote to the buffer while the reading child was sleeping can be determined by examining the bits of the difference between the initial and final values of the buffer.
• In the case of write errors, the bits turned on in the difference between the correct value and the actual value indicates which children did not contribute to the total because their results were lost in a race condition situation. ( The correct answer should be all 1s in the rightmost nChild bit positions. Any 0 in any of these positions indicates a particular child whose write operation was over-written by another process. )
Other Details:
- A makefile is required, that will allow the TA to easily build your program, unless your program compiles easily with a standard g++ command. As always, you are free to develop wherever you wish, but the TA will be grading the programs based on their performance on the CS department Linux machines.
What to Hand In:
1. Your code, **including a readme file, and a makefile if needed**, should be handed in electronically using Blackboard.
2. The purpose of the readme file is to make it as easy as possible for the grader to understand your program. If the readme file is too terse, then (s)he can't understand your code; If it is overly verbose, then it is extra work to read the readme file. It is up to you to provide the most effective level of documentation.
3. The readme file must specifically provide direction on how to run the program, i.e. what command line arguments are required and whether or not input needs to be redirected. It must also specifically document any optional information or command line arguments your program takes.
4. If there are problems that you know your program cannot handle, it is best to document them in the readme file, rather than have the TA wonder what is wrong with your program.
5. A printed copy of your program, along with any supporting documents you wish to provide, should be handed in **at the beginning of class** on the date specified above.
6. Make sure that your **name and your CS account name** appear at the beginning of each of your files. Your program should also print this information when it runs.
Optional Enhancements:
It is course policy that students may go above and beyond what is called for in the base assignment if they wish. These optional enhancements will not raise any student’s score above 100 for any given assignment, but they may make up for points lost due to other reasons. Note that all optional enhancements need to be clearly documented in your readme files. The following are some ideas, or you may come up with some of your own:
- Measure and report the times required for each process to complete their task, as well as the amount of time spent waiting for locks to clear. (These numbers should be reported for each child, in the form of a table. The time spent waiting for locks should probably be determined by each child, and reported to the parent in their final message.) See time(2), gettimeofday(2), clock_gettime(2). (Time spent sleeping should be easily calculated. Can you check this?) The overall goal of this enhancement is to show the time penalty incurred by the use of locks, as compared to running the program without locks.
- As written above, each child will only need access to one buffer at a time, (either for reading or writing), so there cannot be any deadlocks. A modification is to require that each child gain access to two buffers for reading and one for writing **at the same time**, and then to implement code to ensure that deadlocks cannot occur. Note that it will be necessary to show that deadlock can and does occur if deadlock avoidance is not implemented, just as the base assignment shows that race conditions occur when synchronization is not implemented. It may be necessary to increase the number of child processes or the number of buffers simultaneously held in order to ensure deadlock occurs.
- Instead of using simple locks (semaphores) on the data buffers, try implementing reader-writer locks, and see if you can detect a difference in the performance.
- Provide a command-line option for implementing the assignment using pthreads instead of forking, and compare the performance of the two implementation methods. Since threads already
share data space, the threaded implementation could avoid the use of shared memory, and could possibly also avoid the use of message passing, though semaphores would still be required. Note that this enhancement calls for implementing pThreads IN ADDITION TO forking, not instead of forking. ( Two separate programs instead of a command-line option is acceptable. )
- Can you identify any appreciable difference running the program on a multicore computer as opposed to one with a single CPU? What if anything changes if you change the contention scope between threads ( assuming you did the above optional enhancement also? )
- Try experimenting with random sleep times instead of times fixed by the ID number, to see if that has any effect on the results. Note that in order to analyze this properly will require running the program several times each way and applying statistical analysis to determine if the differences are significant or not. ( Suggestion: Apply the student t-test, described in any book on statistics and probably available in Excel, ( along with Excel help. ) ) Note: the timing will obviously change, so what is more interesting is the error rate as a function of the sleep times.
- There are several adjustable parameters given in this assignment that may have an impact on the overall performance. ( Such as the ratio of children to buffers and the relative sleep times. ) You could play with these parameters to try and find a correlation between the number of simultaneous contenders and the number of errors that occur without locking or the amount of delay introduced with locking, etc. Note that nChild must be at least 2 and strictly less than nBuffer.
- The base assignment only requires messages to be sent from the children to the parent, which means the “type” feature of messages can be ignored. If you can think of a reason for the parent to send messages to the children also, then the type can be used to specify the intended recipient of any particular message. ( E.g. when the child sends a message to the parent, the parent could then send a reply back acknowledging the message and perhaps giving further instructions. )
|
{"Source-Url": "https://www.cs.uic.edu/~i385/HW5-385-Fall2011.pdf", "len_cl100k_base": 4607, "olmocr-version": "0.1.53", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 16488, "total-output-tokens": 4960, "length": "2e12", "weborganizer": {"__label__adult": 0.0005583763122558594, "__label__art_design": 0.0004963874816894531, "__label__crime_law": 0.0005006790161132812, "__label__education_jobs": 0.0213470458984375, "__label__entertainment": 0.00013124942779541016, "__label__fashion_beauty": 0.00026917457580566406, "__label__finance_business": 0.00032210350036621094, "__label__food_dining": 0.00083160400390625, "__label__games": 0.0013446807861328125, "__label__hardware": 0.003604888916015625, "__label__health": 0.0007243156433105469, "__label__history": 0.0005040168762207031, "__label__home_hobbies": 0.00034499168395996094, "__label__industrial": 0.001285552978515625, "__label__literature": 0.0004711151123046875, "__label__politics": 0.0003771781921386719, "__label__religion": 0.0007944107055664062, "__label__science_tech": 0.05780029296875, "__label__social_life": 0.0003609657287597656, "__label__software": 0.0088958740234375, "__label__software_dev": 0.89697265625, "__label__sports_fitness": 0.0006422996520996094, "__label__transportation": 0.0010776519775390625, "__label__travel": 0.00030994415283203125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 20783, 0.00839]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 20783, 0.52059]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 20783, 0.91753]], "google_gemma-3-12b-it_contains_pii": [[0, 1987, false], [1987, 5250, null], [5250, 8645, null], [8645, 11553, null], [11553, 14909, null], [14909, 18614, null], [18614, 20783, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1987, true], [1987, 5250, null], [5250, 8645, null], [8645, 11553, null], [11553, 14909, null], [14909, 18614, null], [18614, 20783, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 20783, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 20783, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 20783, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 20783, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 20783, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 20783, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 20783, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 20783, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 20783, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 20783, null]], "pdf_page_numbers": [[0, 1987, 1], [1987, 5250, 2], [5250, 8645, 3], [8645, 11553, 4], [11553, 14909, 5], [14909, 18614, 6], [18614, 20783, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 20783, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
76ffcfc04347e5351a443b75f2448fe89b81aa92
|
Novice Use of a Predictive Human Performance Modeling Tool to Produce UI Recommendations
Kyung Wha Hong and Robert St. Amant
Department of Computer Science
North Carolina State University, Raleigh, NC 27603
khong@ncsu.edu, stamant@ncsu.edu
ABSTRACT
This note describes two studies of the use of a performance modeling tool, CogTool, for making recommendations to improve a user interface. The first study replicates findings by Bonnie John [7]: the rates at which novice modelers made correct recommendations (88.1%) and supported them (68.2%) are close to the values in John’s study (91.7% and 75.1%, respectively). A follow-on study of novice modelers on the same task without CogTool produced significantly lower values. CogTool improves the UI design recommendations made by novices.
Author Keywords
CogTool; usability analysis; interface design.
ACM Classification Keywords
H.5.2 User Interfaces: Evaluation/methodology.
General Terms
Human Factors; Design.
INTRODUCTION
CogTool [6] is a cognitive modeling tool for HCI; it predicts human performance for storyboarded user interfaces. In the past few years it has been applied in real-world software development projects to good effect [1]. John [7] reports a study in 2011 of 100 novice modelers who used CogTool to produce recommendations for improving two Web sites. Modelers show significant consistency in their results, and the majority of their recommendations are well supported with quantitative justifications based on CogTool models. These results are important: modeling tools are typically viewed as helpful mainly to expert modelers in understanding user performance; John demonstrates that CogTool can be easily learned and applied by those new to modeling and relatively new to interface design.
This note describes a replication of John’s study. Wilson et al. [8] advocate for replication in HCI, to ensure that past results generalize, to check assumptions about prior work, and to build new findings on solid ground. The first contribution of this note is the finding that John’s results generalize beyond the sample of novice modelers at CMU, taught to use CogTool by one of its developers. Novice modelers at a different university, taught by an instructor with light experience using CogTool, produced and justified design recommendations for improving a specific user interface with similar accuracy and consistency. The implication is that learning of CogTool can scale, knowledge we believe is important for shaping future generations of HCI practitioners in the classroom.
CogTool shares the goals of other task modeling techniques for HCI (e.g., the Keystroke Level Model [2]), but we are aware of no empirical comparison between CogTool and these techniques for making design recommendations. A second contribution is a follow-on study in which novice modelers, without knowledge of CogTool but with the same exposure as in Study 1 to the KLM and other techniques, recommended improvements to the same user interface. Relatively large differences in performance were observed. In the remainder of this note we describe the two studies and discuss their implications.
METHOD
Undergraduate computer science students in an HCI course participated in the studies. The course is a conventional survey of topics in HCI, using The Resonant Interface [4] as the textbook. At the time of each study, modeling topics in class had covered Fitts’ Law, KLM, GOMS, and modeling for HCI in general (three 1.25-hour lectures in all). Students (hereafter “modelers”) submitted models as part of a homework assignment, worth 5% of their course grade.
In both studies, modelers were given an explicit task to perform on a Web site, as shown in Figure 1. We chose a simple task comparable to John’s for interpretability of our satisfaction.
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.
CHI 2014, April 26 - May 01 2014, Toronto, ON, Canada
Copyright 2014 ACM 978-1-4503-2473-1/14/04...$15.00.
http://dx.doi.org/10.1145/2556288.2556972
1. Visit the Web page http://www.amazon.com. (If you are automatically logged into your Amazon account, log out, then reload the page.)
2. Click in the Search text box.
3. Type “kinect” (without quotation marks) in the Search text box, and press return.
4. Click on the top link that is shown in the search results; for me this is “Kinect Sensor with Kinect Adventures and Gunstringer Token Code.”
5. Click on the Add to Cart button on the right.
Figure 1. Task instructions given to novice modelers
Determine three potential improvements to the usability of the Web site, for this task, based on the information in the visualization. For each of your improvements,
1. Give a short phrase that identifies the improvement.
2. Optional: If the phrase doesn’t entirely specify what the change to the Web site should be, explain it in more detail.
3. Give a screenshot of the visualization, annotated to show how the improvement would change performance (e.g., a circle around some pattern).
4. In words, summarize the pattern you’ve identified in the visualization.
5. Give the time savings, in seconds and milliseconds, that your improvement would produce.
Figure 2. Modeling instructions given to novice modelers
If our results did not match, we would have an additional explanatory factor for the differences. Our interest is in the generalizability of CogTool across populations of users; we must leave generalization to more complex tasks for future work.
Modelers were also given instructions for building a model for the task and making three recommendations for improving the interface. Additional instructions, elided here, directed modelers to carry out the task by hand first, to be as specific as possible in their recommendations, and to remember that (a) the goal was to model expert behavior and (b) not all potential changes, such as reducing visual clutter or changing the color scheme, would plausibly improve expert behavior, and such changes were not amenable to analysis using the techniques the modelers were to rely on.
Figure 2 gives the modeling instructions for Study 1: modelers were to build their models in CogTool and support their recommendations with annotations of a CogTool timeline visualization. Study 1 replicates John’s as follows: the participants were new to modeling and CogTool, they were given a step-by-step description of a task, and they completed their modeling and recommendation activities within one week. The instructions were equivalent to John’s, though more explicit in describing the required structure for submissions. There were differences. The participants were all computer science majors rather than HCI majors with a mix of backgrounds, and they were asked to analyze a different Web site from the ones used by John. The introduction to CogTool, including a demonstration, took an additional half hour of class time. The introduction was given by someone not on the CogTool development team, and unlike John’s study no hands-on working session followed during which questions could be answered. (A few procedural questions were answered via email.) Otherwise Study 1 was as close to John’s as practicable.
When we attribute performance to a specific influence—here, CogTool—we must ask about performance in its absence. We thus conducted a follow-on study one semester later in the same course. The conditions in Study 2 were the same as in Study 1, except that the modeling task was given to students before the introduction of CogTool. (They used CogTool later in the course for their project work.) The modeling instructions for Study 2 gave more generic guidelines, without mention of CogTool: Base your structured description on the material in Chapter 7 and our discussion in class: the Model Human Processor, with its visual, motor, and cognitive capabilities; the Keystroke Level Model; various GOMS techniques. Modelers worked without specialized tools, mostly relying on Fitts’ Law and KLM. Aside from the use of CogTool, Study 1 and Study 2 are effectively identical, with respect to the task and the background of the participants.
STUDY 1: RECOMMENDATIONS WITH COGTOOL
In Study 1, 53 modelers submitted recommendations. Two submissions were produced without using CogTool and are not included in our analysis. Of the remaining 51, two modelers provided only two recommendations rather than three, giving 151 recommendations in all.
Two evaluators independently created categorizations over the aggregate set of recommendations. The evaluators then worked together to agree on a specific category for each recommendation. As shown in Figure 3, the most common recommendations were to place an additional “Add to cart” button beside each product and to make targets for mouse clicks larger or to place them closer together.
Following John, the recommendations were judged with respect to being “correct” (whether they would reduce the predicted duration of the task) and “well supported” (by reference to a visualization produced by CogTool). The evaluators judged 68.2% of the recommendations correct and well supported (c+ws), below John’s 75.1%. An additional 19.9% were correct but “vague or inarticulately argued,” in most cases because the explanation did not refer to the model (cf. John’s 16.6%). The remainder were incorrect. In total, 88.1% of the recommendations were judged to be correct, if not necessarily well supported (cf. 91.7%).
Figure 3 shows all of the correct and well-supported recommendations given by modelers; no others were identified. All but one modeler (98%; cf. John’s 100%) gave at least one correct recommendation. 42 of the 51 gave at least one correct and well-supported recommendation (82%; cf. John’s 96%—possibly due to the abbreviated instructions for CogTool in Study 1). Fourteen modelers gave one or more incorrect recommendations (27%; cf. John’s 21%).
---
1 Our emphasis is not on the categorization of novice design recommendations, but we note the challenge of consistent categorization of usability improvements based on textual descriptions and CogTool visualizations, working without an a priori set. The two evaluators (with both research and practical experience in HCI and usability) differed in the number and assignment of categories they identified, due to ambiguities or combinations of categories in the modelers’ descriptions. There was initial agreement on 74% of the recommendations, with Kappa = 0.693.
These represent poorer performance than John’s numbers, but most measures are surprisingly close.
Figure 3 also shows the median duration and interquartile range of the time savings calculated by the modelers, per category of recommendation. The total time for the task is more than ten seconds, and most of the recommendations would each save half a second or more. We find it notable that novice modelers can justify recommendations for improving a professionally designed interface in wide use.
Variability in estimates of time savings (in the IQR column) is inevitable, due to the coarseness of categorization. For example, changing the size or location of a target icon can reduce duration, but how much depends on the new size or location; Search autocomplete and Incremental search can reduce typing time, but the reduction depends on how many keystrokes are saved. Some but not all modelers modified their models for these two design changes; others estimated the savings by subtracting some number of keystrokes. The latter approach appeared to be common, but it will not always produce accurate results. Incremental search savings are inflated because most modelers did not include the required shift of visual attention to a dynamically changing set of products. Even for more straightforward recommendations, such as Autofocus in search box, modelers differed in whether the Think operator should be included in the savings. As long as the recommendation was correct and the annotation included the relevant cognitive/visual/motor components of the task, it was considered well supported.
One category of interest not included in Figure 3 is Remove extraneous content. Many modelers observed that removing clutter could improve performance by allowing for target elements to be closer together (leading to a Closer/larger targets categorization), but other modelers recommended reducing clutter based on incorrect arguments (e.g., that experts are distracted by a cluttered visual display, or that thinking time is spent processing screen information not included in a model). These were considered incorrect.
In general, incorrect recommendations were of two types: within the scope of the task but not likely to improve an expert user’s performance (e.g., removing ads or changing button colors—8% of all recommendations); or out of scope, without regard for expertise (e.g., providing more results to scroll through—4% of all recommendations).
We evaluated the consistency of the recommendations with the Any-Two Agreement (A2A) statistic [5]. A2A is the number of common problems found by two modelers, divided by the total number of problems found by those two modelers, averaged over all modelers. John’s A2A value of 34% puts her study above 9 of the 12 studies in Hertzum and Jacobsen’s survey [5]; our A2A value of 30% is above 8. Study 1 adds evidence to the view that CogTool may reduce the evaluator effect by providing a model-based grounding for recommendations [7].
Two weeks after the completion of the modeling exercise a brief, informal survey was given. 47 modelers submitted free-form text answers to questions about their use of CogTool. (The survey was anonymous to allow the question, Did you follow the instructions?; all respondents answered yes.) The most informative answers were to the question, Describe in a few sentences how CogTool fit into the process of your making recommendations for design improvements. John has demonstrated that novice modelers can produce useful results with CogTool; our survey provides initial clues about how they integrate modeling into their analysis, as well as how CogTool improves the process.
Our informal analysis of the responses showed three categories of interest. The most common answer, from 26 modelers (51%), described using CogTool to identify appropriate areas for design changes. “I would use CogTool to see which areas of an application take the longest for a user to move through.” “I looked at the model that CogTool presented and looked for areas where there were actions canceling each other out, such as moving a hand to the mouse and then back… and tried to understand how to eliminate some of those steps.” Most then described using CogTool to justify their recommendations in quantitative terms.
Nine modelers (18%) also mentioned making comparisons between models, to evaluate the differences between interface designs. “I then looked at side-by-side comparisons… to see where differences existed.”
Thirteen modelers (25%) only mentioned using CogTool to validate design decisions they had thought of on their own: “It helped give me proof that my suggestions would actually help by providing estimated times.”.
<table>
<thead>
<tr>
<th>Recommendation</th>
<th># Modelers (%)</th>
<th>Median</th>
<th>IQR</th>
<th># Modelers (%)</th>
<th>Median</th>
<th>IQR</th>
</tr>
</thead>
<tbody>
<tr>
<td>“Add to cart” button for each product</td>
<td>25 (49%)</td>
<td>1.93</td>
<td>0.22</td>
<td>18 (32%)</td>
<td>2.33</td>
<td>1.30</td>
</tr>
<tr>
<td>Closer/larger targets</td>
<td>22 (43%)</td>
<td>0.18</td>
<td>0.35</td>
<td>8 (5%)</td>
<td>0.70</td>
<td>0.86</td>
</tr>
<tr>
<td>Incremental search, per-keystroke updates</td>
<td>17 (33%)</td>
<td>1.67</td>
<td>0.72</td>
<td>10 (7%)</td>
<td>0.75</td>
<td>1.83</td>
</tr>
<tr>
<td>Autofocus in search box</td>
<td>15 (29%)</td>
<td>2.54</td>
<td>1.25</td>
<td>20 (13%)</td>
<td>1.64</td>
<td>1.23</td>
</tr>
<tr>
<td>“I feel lucky” button</td>
<td>4 (8%)</td>
<td>1.89</td>
<td>1.00</td>
<td>5 (3%)</td>
<td>2.01</td>
<td>2.38</td>
</tr>
<tr>
<td>Keyboard navigation versus mouse clicks</td>
<td>4 (8%)</td>
<td>0.57</td>
<td>3.40</td>
<td>3 (2%)</td>
<td>0.93</td>
<td>3.57</td>
</tr>
<tr>
<td>Search autocomplete</td>
<td>4 (8%)</td>
<td>0.70</td>
<td>0.55</td>
<td>2 (1%)</td>
<td>0.26</td>
<td>0.28</td>
</tr>
</tbody>
</table>
Figure 3. Correct and well-supported recommendations, with median and interquartile range of time savings in seconds.
Figure 4. Study 1 versus Study 2 performance per modeler as tail distribution functions: $c\%$ shows the percent of modelers giving $k$ or more correct recommendations, $c + ws\%$ $k$ or more correct and well-supported recommendations.
### STUDY 2: COMPARATIVE ANALYSIS
For Study 2, in which modelers did not use CogTool, 50 modelers submitted 150 recommendations in total. The same evaluators followed the same procedure as in Study 1 to categorize recommendations, except using references to the modeling techniques above rather than to CogTool in their evaluation. Figure 3 shows that the correct and well-supported recommendations in Study 2 are comparable to those of Study 1 in the numerical distribution of categories and estimates of time savings. But the totals were considerably lower. In Study 1, 88% of recommendations were correct, versus 63% in Study 2; for correct and well-supported recommendations the values were 68% and 43%.
Figure 4 shows the tail distributions for the count of correct/well-supported recommendations, aggregated over modelers; that is, 35/51 or 69% of modelers in Study 1 gave three correct recommendations, and so forth. A complete statistical analysis is beyond the scope of this note, but a two-sample Kolmogorov-Smirnov exact test shows a significant difference between Study 1 and Study 2: $D = 0.321$, $p < 0.01$. (Treating the counts as continuous data, we can ask about the difference between the mean number of correct recommendations per modeler, 2.6 in Study 1 versus 1.9 in Study 2: $t(99) = 3.97, p < 0.01$.) Analysis of correct and well-supported recommendations shows the same result. In other words, performance in these studies is not determined purely by the task and the background knowledge of modelers; use of CogTool is a significant factor.
A2A in Study 2 is 20%. The drop from 30% in Study 1 is not unexpected, given the greater variation in modeling procedures. No new correct and well-supported recommendations were identified, but there was a wider range of incorrect recommendations. These fell into the same general classes as in Study 1: changes affecting performance outside the scope of the task (e.g., multiple item selection or filtering capabilities—11% of all recommendations), and not focusing on expert users as specified in the instructions (25% of all recommendations). The latter is not surprising. In an HCI survey course, the clearest illustrations of usability issues are often based on the challenges that novice users face in complex interfaces; CogTool currently targets expert users. The former category of incorrect recommendations is more surprising, though not in retrospect. CogTool also appears to help novice modelers remain aware of the boundaries of a specific task when attempting to improve user performance by changing the UI design.
### CONCLUSION
John's experience teaching CogTool to HCI majors at CMU extends to computer science majors at a different university (without a formal HCI program), and detailed knowledge of CogTool is not needed for adequate instruction. This is promising news for practical modeling, recognized by some of the novice modelers: "I would never have thought about these areas taking up users’ time, so CogTool did help…"
Existing research provides limited information about how modeling can best be integrated into interface design tasks (e.g., [1, 3]), but the strategies used in Study 1 are among those typically recommended by experienced HCI modelers. Notably, the novices were able to find effective ways to use CogTool without explicit guidance, to produce correct, well-supported recommendations.
Study 2 indicates that CogTool is a decisive factor in helping novice modelers produce good design recommendations—it was not because the task was too easy. With CogTool, recommendations were much more often correct and well supported, and the proportion of modelers who made such recommendations was higher. CogTool appears to help novice modelers to focus their recommendations on those relevant to a specific class of users, within the boundaries of specified tasks. Further exploration of how and why, as well as implications for professional UI development, remain for future work.
### REFERENCES
|
{"Source-Url": "http://www4.ncsu.edu/~stamant/papers/kwh-rsa-chi14_camera-ready.pdf", "len_cl100k_base": 4722, "olmocr-version": "0.1.50", "pdf-total-pages": 4, "total-fallback-pages": 0, "total-input-tokens": 17463, "total-output-tokens": 5345, "length": "2e12", "weborganizer": {"__label__adult": 0.0007443428039550781, "__label__art_design": 0.01178741455078125, "__label__crime_law": 0.0005407333374023438, "__label__education_jobs": 0.04730224609375, "__label__entertainment": 0.0003197193145751953, "__label__fashion_beauty": 0.000560760498046875, "__label__finance_business": 0.0008158683776855469, "__label__food_dining": 0.00072479248046875, "__label__games": 0.0014934539794921875, "__label__hardware": 0.0022182464599609375, "__label__health": 0.0012912750244140625, "__label__history": 0.0010938644409179688, "__label__home_hobbies": 0.00033211708068847656, "__label__industrial": 0.0008339881896972656, "__label__literature": 0.001811981201171875, "__label__politics": 0.0003848075866699219, "__label__religion": 0.0011091232299804688, "__label__science_tech": 0.1683349609375, "__label__social_life": 0.0003426074981689453, "__label__software": 0.0248260498046875, "__label__software_dev": 0.7314453125, "__label__sports_fitness": 0.0005059242248535156, "__label__transportation": 0.0010976791381835938, "__label__travel": 0.0003256797790527344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22462, 0.04103]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22462, 0.5794]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22462, 0.93375]], "google_gemma-3-12b-it_contains_pii": [[0, 5043, false], [5043, 10990, null], [10990, 16946, null], [16946, 22462, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5043, true], [5043, 10990, null], [10990, 16946, null], [16946, 22462, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 22462, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22462, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22462, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22462, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 22462, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22462, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22462, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22462, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22462, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22462, null]], "pdf_page_numbers": [[0, 5043, 1], [5043, 10990, 2], [10990, 16946, 3], [16946, 22462, 4]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22462, 0.10465]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
128ea21968ff0d457020fd3ef810ae32b89c7d1d
|
JAGGERY MARKETING EXPERT SYSTEM USING DECISION TREE
B V A N S S PRABHAKAR RAO¹, M SURESH KUMAR², P V VENKATESWAR RAO³, MATTA SANKARA SASTRY⁴ and VADALI SRINIVAS⁵
¹Dept. of CSE, Miracle School of Engineering, Miracle Educational Society Group of Institutions, Vizianagaram, Andhra Pradesh, India
²Dept. of Computer Science, GITAM University, Visakhapatnam, India
³Dept. of CSE, AITAM, Tekkali, Andhra Pradesh, India
⁴Dept. of MCA, Miracle School of Computing, Miracle Educational Society Group of Institutions, Vizianagaram, Andhra Pradesh, India
⁵Dept. of CSE, Kakinda Institute of Engineering Technology-2, Kakinada, India
ABSTRACT
This paper is aimed at providing services regarding the Jaggery marketing. The concept of Jaggery Marketing plays an influential role in the lives of people, because most of them use Jaggery for their rations. In India, leaving out a few metropolitan cities, all the districts and industrial townships are connected with Jaggery markets. Due to the social and backward condition of the rural people, the personal selling effort requires the special measures in rural marketing. The Jaggery Marketing Expert System maintains details about the current prices of a particular item, updates information whenever necessary, delete an item if it is not in use and also various marketing information. This system is developed using ID3 decision tree algorithm. It provides an interface to the users and asking a set of questions to the users. Based on the response the system evaluates and computes the availability, price and season to the end-user.
Keywords: Jaggery, Expert System, ID3, Entropy, Gain, and Rural Marketing.
[I] INTRODUCTION
An expert system is a computer program conceived to simulate some forms of human reasoning and capable to manage an important quantity of specialized knowledge. A system that uses human knowledge captured in a computer to solve problems that ordinarily require human expertise. Jaggery from India is also well known for its quality, which has wide demand in international market. Marketing is one of the important activities in the production process of jaggery, which facilitates the movement of goods from site of production to ultimate consumer through various ways and by different intermediaries within the minimum period.
This system involves various services for the product Jaggery like required color, available packing, location where the item is actually available quality, quantity and season etc.
Decision tree is commonly used for gaining information for the purpose of decision-making. Decision tree starts with a root node on which it is for users to take actions. From this node, users split each node recursively according to decision tree learning algorithm. The final result is a decision tree in which each branch represents a possible scenario of decision and its outcome [1] & [7]. Jaggery or gur refers to the unrefined sugars used widely in the South Asian and South East Asian...
regions. Per se, it refers to the sugarcane sugar but is also used to refer to the products derived from both sugarcane and the date palm. It is a relatively pure and wholesome sugar, possessing high amounts of nutrients [4]. Traditional Indian medicine or Ayurveda considers Jaggery to be the most useful food in the treatment of various lung and throat infections. It is considered a better choice than refined sugars as it is a rich source of iron and other required minerals salts and is, therefore, highly recommended as part of a healthy lifestyle. Jaggery is a popular part of the cuisines of the Indian subcontinent and is used in the various sweet dish preparations. According to the Indian culture, it is to be eaten in the raw form before any important occasion or any new project or venture is undertaken. The sap of the date palm is regarded as the ideal source for producing the best type of sugar and it is, therefore, highly valued. As sugarcane is not grown in as widespread an area as the northern part of the country, Jaggery is produced from the sago and the coconut palms in the southernmost parts of the subcontinent. The centrality of the Jaggery can be attested to by the fact that the two largest Jaggery markets in the world are located in the districts of Uttar Pradesh and Andhra Pradesh in India [2].
Jaggery is considered by some to be a particularly wholesome sugar and, unlike refined sugar, it retains more mineral salts. Moreover, the process does not involve chemical agents. Indian Ayurvedic medicine considers Jaggery to be beneficial in treating throat and lung infections Gandhi felt that Jaggery was healthier than refined sugar, as it was not introduced into the blood as rapidly. As such, he used it in his own personal diet and recommended it to use in his invented goat-milk diet (and all other diets/eating styles) as well. Jaggery is very rich in iron, which, a composite of haemoglobin prevents anemia. Jaggery is often called the 'medicinal sugar. So much so, you can become an emergency doctor with Jaggery. It is also very useful in health problems like -- Dry Cough, Cough with Sputum, Indigestion, and Constipation [3].
1.1 Uses of Jaggery
Jaggery is widely used in the Indian cooking including those of the South Indian and Gujarati cuisines. The various South Indian foods like rasam, dal and sambar are also prepared with the addition of Jaggery. In addition to its consumption in the raw form, it is used in the traditional dishes where it lends a touch of sweetness to the sourness and spiciness of the preparations. Further, it is used in the preparation of alcoholic beverages and to make items like candy, toffees, Jaggery cakes and other similar sweet preparations. Its regular usage is advocated in the daily diet as it is a healthy and unrefined form of sugar. Interestingly, Jaggery is used for the coating of insides of a tandoor oven to enable better flavor of dishes. In south east Asia, Jaggery is prepared from the toddy palm syrup. In Burmese cuisine, Jaggery is a highly relished delicacy and is prepared with coconut shredding, plum purees or sesame depending on the area. It is regarded as delicacy and is referred to locally as Burmese chocolate. It is a preferred addition in the Burmese cuisine as it enhances the flavors and the colors of the dishes [1].
1.2 Health Benefits
Jaggery is ascribed with various medicinal properties and other health benefits. A pure and wholesome food, it shares the variety of essential amino acids, minerals and vitamins of the sugarcane juice and this is why it is considered a healthier option. It is also high on calcium which is required for maintenance of bone strength and is a healthy and delicious snack. Being rich in iron, it prevents diseases like anemia and also contains essential nutrients like magnesium and potassium.
Magnesium is vital for the proper functioning of the nervous systems and the potassium regulates the blood pressure and the heart functions.
While manufacturing processes in sugar utilizes chemicals such as sulphur dioxide, lime and other bleaching agents, Jaggery is prepared in a natural way and is a relatively unrefined sugar. It purifies the blood, prevents rheumatism and bile disorders and is highly nutritious in value. Jaggery is also useful in combating problems like cough and stomach ailments like indigestion, acidity and constipation. Recent scientific research has reaffirmed the benefits of Jaggery for the sensitive organs of the human body like the lungs. Consumption of Jaggery is useful for those who are exposed to pollution on a regular basis like industrial workers. It has been lauded for its ability to help the human body to fight off the ill effects of pollution.
1.3 Jaggery: A Healthy Choice
Although not firmly associated with disease, the greatest potential threat of white sugar stems from the processing it undergoes. Initially, the sugarcane plants are washed, shredded, crushed, and rolled to extract the cane juice. In fact, the fibrous residual is often recycled as fuel for the mill furnaces. However, the cane juice is then "clarified" by the addition of lime. After evaporation and centrifugation, it is then further refined though the addition of sulphur dioxide, phosphoric acid, and decolorizers. These processes remove all the phytonutrients, including the vitamins and minerals, and leave only the empty calories behind for us to put in our tea, coffee, and recipes.
1.4 The following steps are involved in preparing Jaggery
Fortunately, not all forms of sugarcane products are nutritional wastelands. For centuries, Jaggery has been used throughout India as a healthy sweetener. Jaggery actually comes from the sap of either the sugarcane plant we've been discussing or from several species of sugar palm trees. To convert the sap into Jaggery, simple evaporation or crude centrifugation is the only process. No chemicals or bleaches are added. It is then simply poured into moulds to form small cakes. Farmers have found a very simple method, which involves special iron vessels and a single machine to manufacture Jaggery. This is the simplest way to do so.
Let us start off the process.
Step1. Cutting sugar cane from fields
Step2. Feeding the grinder to extract juice
Step3. Boiling the juice
Step4. Adding Ingredients
Step5. Tray Feeding
White sugarcane have a very rich content in sugar, white sugar cane is the main source of raw material in a sugar factory to manufacture sugar.
[II] PROBLEM ANALYSIS
Always Jaggery producer unable to get the minimum support price and at the same
time the consumer can’t get the benefit. These kinds of issues are proved in the
case of onion marketing and now in red-
grams marketing. The steps taken by the
Government of India to cut down the
poverty line have improved the condition
of the rural masses but not on the price
control. Jaggery Marketing is much talked
and less practiced subject needing serious
attention from all stake holders.
[III] KNOWLEDGE BASE
Representing the facts and rules in the
knowledge base
3.1 Architecture Design:
The science of designing expert
systems, like AI in general is largely
experimental [5].
What makes it so is its modus
operandi of “leaping from the known
into the unknown”.
Every expert system should be
considered an experiment, subject to
validation on the basis of empirical
results.
In addition, the development of expert
systems has three special design
criteria:
1. The domain - Planning
2. The expert – Knowledge
Engineering
3. The user environment -
Implementation
The three phases of developing expert
system
Planning -
Specify objectives
Define problems and sub-problems
Develop controls and measures
Knowledge Engineering-
Select Experts
Extract Knowledge
Develop Knowledge Base
Implementation-
Programming
Preliminary testing
Refinement
3.2 The Inference Engine
The inference engine applies the
knowledge to solution of actual
problems. It is essentially an interpreter
for the knowledge base.
The task of the interface engine is as follows:
• It compares information supplied
in the user’s query with information
in the knowledge base.
• It seeks specific event-related
goals or causal relationships.
• It evaluates the relative certainty
of facts, based on the respective
confidence values associated with
each fact.
Program Modules for the Inference
Engine
The inference engine’s pursuit of rules:
FIND_RULE will search the rule list to
locate the first rule that applies to the
object whose value is currently being
sought.
CONCLUDE implements the
conclusions of a rule.
Pursue acts on the name of an object, and attempts to apply the rules to give the object a value.
P_result causes the system to display the results of the consultation.
Creating the rules file: The rules file includes the following syntax.
Rule (n): if PREMISE Then CONCLUSION
Creating the legal values file: The legal value includes the following syntax.
OBJECT = VALUE 1 VALUE 2 VALUE 3 VALUE 4
Creating the questions file: The questions include the following syntax.
(OBJECT) = (QUESTION).
3.3 Machine Learning Algorithm Design:
Decision tree learning algorithm has been successfully used in expert systems in capturing knowledge. The main task performed in these systems is using inductive methods to the given values of attributes of an unknown object to determine appropriate classification according to decision tree rules.
3.4 What is Decision Tree?
A decision tree is a tree in which each branch node represents a choice between a number of alternatives, and each leaf node represents a decision.
Decision tree learning is a method for approximating discrete-valued target functions, in which the learned function is represented by a decision tree. Decision tree learning is one of the most widely used and practical methods for inductive inference [6].
Decision trees classify instances by traverse from root node to leaf node. We start from root node of decision tree, testing the attribute specified by this node, and then moving down the tree branch according to the attribute value in the given set. This process is the repeated at the sub-tree level.
3.5 Decision Tree Learning Algorithm
ID3 is a simple decision tree learning algorithm developed by Ross Quinlan (1983). The basic idea of ID3 algorithm is to construct the decision tree by employing a top-down, greedy search through the given sets to test each attribute at every tree node. In order to select the attribute that is most useful for classifying a given sets, we introduce a metric—information gain [8]. To find an optimal way to classify a learning set, what we need to do is to minimize the questions asked. Thus, we need some function which can measure which questions provide the most balanced splitting. The information gain metric is such a function. The information gain,
$$\text{Gain}(S, A) = \text{Entropy}(S) - \sum \text{for } v \text{ from 1 to n of } (\frac{|S_v|}{|S|} \times \text{Entropy}(S_v))$$
We can use this notion of gain to rank attributes and to build decision trees where at each node is located the attribute with greatest gain among the attributes not yet considered in the path from the root.
3.6 Results
The required database format is addressed as below:
<table>
<thead>
<tr>
<th>Color</th>
<th>Taste</th>
<th>Available</th>
<th>Quantity</th>
<th>Quality</th>
<th>Usage</th>
<th>Location</th>
</tr>
</thead>
<tbody>
<tr>
<td>Black</td>
<td>Sweet</td>
<td>Any</td>
<td>Large</td>
<td>First</td>
<td>Curries</td>
<td>Rajam</td>
</tr>
<tr>
<td>Red</td>
<td>Sweet</td>
<td>Pot</td>
<td>Medium</td>
<td>Second</td>
<td>Curries</td>
<td>Chintada</td>
</tr>
<tr>
<td>Black</td>
<td>Sweet</td>
<td>Packet</td>
<td>Large</td>
<td>First</td>
<td>Curries</td>
<td>Saravaloka</td>
</tr>
<tr>
<td>Black</td>
<td>Sweet</td>
<td>Pot</td>
<td>Large</td>
<td>First</td>
<td>Curries</td>
<td>Chintada</td>
</tr>
<tr>
<td>Red</td>
<td>Salty</td>
<td>Packet</td>
<td>Large</td>
<td>First</td>
<td>Curries</td>
<td>Amakapalli</td>
</tr>
<tr>
<td>Black</td>
<td>Sweet</td>
<td>Pot</td>
<td>Large</td>
<td>First</td>
<td>Curries</td>
<td>Hiramandalam</td>
</tr>
<tr>
<td>Black</td>
<td>Sweet</td>
<td>Pot</td>
<td>Medium</td>
<td>Second</td>
<td>Curries</td>
<td>Amadalavalasa</td>
</tr>
<tr>
<td>Black</td>
<td>Sweet</td>
<td>Pot</td>
<td>Large</td>
<td>Second</td>
<td>Sweets</td>
<td>Amadalavalasa</td>
</tr>
<tr>
<td>Red</td>
<td>Sweet</td>
<td>Pot</td>
<td>Medium</td>
<td>Second</td>
<td>Sweets</td>
<td>Amadalavalasa</td>
</tr>
<tr>
<td>Black</td>
<td>Sweet</td>
<td>Pot</td>
<td>Large</td>
<td>First</td>
<td>Sweets</td>
<td>Venkannapeta</td>
</tr>
<tr>
<td>Red</td>
<td>Sweet</td>
<td>Pot</td>
<td>Medium</td>
<td>First</td>
<td>Sweets</td>
<td>Venkannapeta</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
[IV] Results
**Output of the Decision Tree Algorithm:**
```java
if (Usage == "Multi")
{
if (Color == "Black") {
if (Taste == "Sweet") {
if (Availablein == "Any") {
if (Quantity == "Large") {
if (Quality == "First") {
Location = {"Rajam"};
} else if (Availablein == "Pot") {
Location = ..........;
}
}
}
}
} else if (Availablein == "Pot") {
Location = ..........;
}
}
```
**Rules Generated from Decision Tree**
**RULE:**
IF Usage = Curries
AND IF Color = Black
AND IF Availablein = Any
THEN Location = Rajam
**RULE:**
IF Usage = Curries
AND IF Color = Red
AND IF Availablein = Packet
AND IF Quantity = Large
AND IF Taste = Salty
THEN Location = Anakapalli
**Fact:**
Salt Jaggery is available in "Anakapalli"
The cause for Jaggery to salt in taste is:
This salt in taste because of the soil type in that lands and the ingredients that are used in preparing the Jaggery. And it is well suited for storing for long period also as it is in crystal format.
**[V] DISCUSSION**
**Decision Table Run Information**
- Instances: 149
- Attributes: 7
- Color
- Taste
- Availablein
- Quantity
- Quality
- Usage
- Location
=== Classifier model
------------------
Usage = Curries
| Availablein = Any: Rajam (1.0)
| Availablein = Pot: Kollivalasa (35.0/29.0)
| Availablein = Packet: Saravakota (9.0/6.0)
Usage=Homefooditems:Narsipatnam (2.0)
Usage = Medicine: Kakinada (14.0/2.0)
Usage = Multi: Rajam (7.0/6.0)
Usage = Pickle
| Taste = Sweet: Kotturu (2.0)
| Taste = Salty: Anakapalli (5.0/2.0)
| Taste = Normal: Palasa (1.0)
Usage = Sambar: Yelamanchili (9.0/6.0)
Usage = Sweets: Venkannapeta (15.0/9.0)
Number of Leaves : 11
Size of the tree: 14
Time taken to build model: 0 seconds
Summary
Correctly Classified Instances 49
32.8859 %
Incorrectly Classified Instances 100
67.1141 %
Kappa statistic 0.2796
Mean absolute error 0.0505
Root mean squared error 0.1645
Relative absolute error 77.1788 %
Root relative squared error 90.9656 %
Total Number of Instances 149
VI] CONCLUSION
This application was developed using java server pages and MySQL database is used as backend. Its main emphasis is to have a well designed interface for giving Jaggery Marketing related advices and suggestions marketing of Jaggery products by providing facilities like dynamic interaction between expert system and the consumer without the need of domain expert at all times.
REFERENCES
[7] K.P.Soman Shyam Diwakar V.Ajay: Insight into Data Mining, PHI.
Biography of Author(s)
B V A N S S Prabhakar Rao obtained his Bachelor’s degree in Electronics, MCA, M.Tech (CST) from Andhra University and also pursuing his Ph.D in Software Engineering through JNTUK. Previously he worked with Govt. Degree College and Dr. V S Krishna Govt. Degree College as Lecturer in Computer Applications & Science. With GITAM University as Assistnat Professor. Presently he working as Associate Professor with Miracle Educational Society Group of Institutions.
Suresh Kumar Maddila, pursuing his M.Tech in CST from AU College of Engineering, Andhra University. He received his MCA Degree from Andhra University affiliated college in 2003. He joined in January 2009, Department of Computer Science, GITAM University, India as Assistant Professor. He joined in July (2006-2008), Dept of MCA, Anil Neerukonda Institute of Technology and Sciences, Visakhapatnam, Andhra Pradesh, India as Assistant Professor. His areas of interest are Networks, Multimedia and Computer Graphics.
P V Venkateswara Rao
working as Associate Professor in Department of CSE, AITAM, Tekkali, Andhra Pradesh, India. He has completed his B.Tech from JNTU College of Engineering Kakinada and M.Tech from Berhampur University. At present he is pursuing his PhD from JNTUK. His area of interest is Computer Networks, Mobile Computing, Information Security, Human Computer Interaction, Operating Systems. He has 20 years of experience in teaching and industries.
M Sankara Sastry
obtained his Bachelor’s degree in Computer Science & Statistics from Andhra University, Master of Science in Statistics from Andhra University. He has completed his M.Tech with Computer Science & Technology from GITAM University. Previously he worked with Sri Prakash Institute of Technology as Assistant Professor, Tuni. Presently he working as Assistant Professor with Dept. of MCA, Miracle Educational Society Group of Institutions, Vizianagaram.
Vadali Srinivas
obtained his Bachelor’s degree in Electronics from Andhra University, Master of Science in Electronics from Andhra University. He has completed his M.Tech (CST) from GITAM University. Previously he worked with N E S College of Information and Technology as Assistant Professor. Currently he working with Kakinda Institute of Engineering and Technology-II, Kakinda as Assistant Professor in Dept. of CSE and also pursuing his Ph.D through JNTUK, Kakinada.
|
{"Source-Url": "http://bipublication.com/files/csv1I120104.pdf", "len_cl100k_base": 5083, "olmocr-version": "0.1.53", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 23791, "total-output-tokens": 5531, "length": "2e12", "weborganizer": {"__label__adult": 0.0014905929565429688, "__label__art_design": 0.0014848709106445312, "__label__crime_law": 0.0015048980712890625, "__label__education_jobs": 0.0236358642578125, "__label__entertainment": 0.000339508056640625, "__label__fashion_beauty": 0.0009007453918457032, "__label__finance_business": 0.0170135498046875, "__label__food_dining": 0.121826171875, "__label__games": 0.00415802001953125, "__label__hardware": 0.003940582275390625, "__label__health": 0.007511138916015625, "__label__history": 0.0008788108825683594, "__label__home_hobbies": 0.0009832382202148438, "__label__industrial": 0.017181396484375, "__label__literature": 0.0022029876708984375, "__label__politics": 0.0010662078857421875, "__label__religion": 0.0016984939575195312, "__label__science_tech": 0.26513671875, "__label__social_life": 0.0004341602325439453, "__label__software": 0.068359375, "__label__software_dev": 0.454345703125, "__label__sports_fitness": 0.0005154609680175781, "__label__transportation": 0.00273895263671875, "__label__travel": 0.0008177757263183594}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 21619, 0.02481]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 21619, 0.51394]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 21619, 0.9258]], "google_gemma-3-12b-it_contains_pii": [[0, 2984, false], [2984, 6832, null], [6832, 9473, null], [9473, 11617, null], [11617, 15492, null], [15492, 17408, null], [17408, 20225, null], [20225, 21619, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2984, true], [2984, 6832, null], [6832, 9473, null], [9473, 11617, null], [11617, 15492, null], [15492, 17408, null], [17408, 20225, null], [20225, 21619, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 21619, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 21619, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 21619, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 21619, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 21619, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 21619, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 21619, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 21619, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 21619, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 21619, null]], "pdf_page_numbers": [[0, 2984, 1], [2984, 6832, 2], [6832, 9473, 3], [9473, 11617, 4], [11617, 15492, 5], [15492, 17408, 6], [17408, 20225, 7], [20225, 21619, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 21619, 0.06667]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
3682471f0bf0a40a69adb85b28fe8e57c22c175b
|
Quality Control As Data Analysis
Paul Gorrell, Social & Scientific Systems, Inc., Silver Spring, MD
ABSTRACT
Good quality control programs are the opposite of good marketing; i.e. you want the smallest flaw, even if it's on a single record, to announce its presence loud and clear. We will take advantage of the fact that SAS® offers a wide variety of tools for data analysis and we will look at quality control [QC] as one particular form of data analysis. From this perspective, effective QC becomes a question of applying data-analysis techniques through the use of SAS PROCs, formats, and LOG messages. For example, valid data analysis would never be based on the first 50 observations of a 100,000 record file. Yet many SAS programmers print 50 observations to 'check' on variable values, or the results of a merge. Although there may be times this is necessary (or, at least, comforting), it is rarely (if ever) sufficient. QC, like data analysis, should be based on logic and pattern verification, as well as on properties of the entire output data set (or an identified sub-group). I will emphasize the importance of knowing what patterns the data SHOULD exhibit, and how to use SAS PROCs and LOG messages to test for them.
INTRODUCTION
The title of this paper points to two important aspects of quality control with SAS programming. The first is that checking to see that the data set created by a SAS program has the intended properties is a form of data analysis. The second is that the SAS programmer is in the fortunate position of having a variety of excellent data-analysis tools at hand.
I'm going to distinguish between 3 types of quality control [QC].
1. a. INPUT QC
b. PROGRAM QC
c. OUTPUT QC
Input QC is the process of learning about the input data to your program. It's important to distinguish between properties that the data is supposed to have, and the properties it actually has. It is also important for the SAS programmer to have a good, general, sense of what the data means and how it will be used. This knowledge allows the programmer to integrate more-intelligent QC measures into the programs than would be possible by blindly following specs.
Program QC refers to writing programs so that quality-control information is available both from intermediate stages of the program as well as in the final output. For example, merges are crucial areas of a program requiring QC. I will give examples where the merge DATA step can be written to show important information about the merge.
Output QC is what most programmers are thinking about when QC is mentioned. That is, Output QC is looking at the output data sets to make sure that they have the intended properties. There are various aspects of this. There's the basic level of making sure that 2+2=4. There are also relationships between variables that are determined by external factors, e.g. IF MONTH = 'SEPT' THEN (1 <= DAY <= 30). There are variable values and relationships to check that are specific to the particular data set being input or generated, e.g. number of children in the family was recorded only if they were living at home.
I will discuss a number of specific SAS programming examples, but the goal of this paper is to emphasize as much as possible the general principles which lead to more-effective quality control. Throughout I will focus on a common situation for a SAS programmer: you have an input SAS data set (or, sets) and you have specs to modify this data set in some way and output a new data set. Of course there are numerous other situations (e.g. reading in flat files, outputting to Excel spreadsheets, etc.) that require QC. I hope that I am able to communicate my basic approach in such a way that the programmer can readily apply it to situations not covered here.
One thread that will run through this discussion is what we might call content-based programming. By that I mean that it is well worth the time for a SAS programmer to learn as much as possible about the project the programs are a part of, the type of people who will be working with the data, and the general goals which motivate the particular specs. A lot of time and money can be saved if the programmer is in a position to catch content-based problems before they are delivered to the client. For example, I work a lot with health-care survey data and it is fairly easy to figure out that males should not have valid responses to pregnancy questions. It is less obvious that some questions (e.g. "Have you fully recovered?") are only asked of people with certain types of medical conditions.
An added benefit to content-based programming is that it makes the work more interesting. The more interested I am, the more alert and engaged I am with the data and the programs. So it's efficient in the long run for the programmer to take some time before ever writing a line of code to find out as much as possible about the data, and to plan ahead with QC in mind.
INPUT QC
A lot of old cliches are exactly right when it comes to Input QC ("A stitch in time saves nine", "Penny wise but pound foolish", etc.). I'll add two more:
2. a. Don't overlook the obvious.
b. Verify what you're told.
The word verify is going to come up quite often in this paper because a lot of basic QC comes down to verifying that what you think is true, or have been told is true, actually is true. One of the great enemies of good QC is time pressure, and this can start right at the beginning by not taking the time to take a good look at the input data.
SAS provides a wonderful tool for initially examining input data sets: the CONTENTS procedure. It is absolutely essential to run a PROC CONTENTS to see, at least, the following:
(3) a. Number of Variables
b. Number of Observations
c. Sorted?
d. Engine (V8?)
e. Variable Name
f. Variable Type (Numeric/Character?)
g. Variable Length
h. Variable Labels
i. Variable Formats
Initially it's important to know if this general information agrees with the documentation you have about the file. If it doesn't then you need to straighten this out before going any further (perhaps you have the wrong file, one that's similar to the right file).
If the general information (e.g. number of variables and observations) appears to be as it should be, you can look at specifics such as variable names and data types. Whether a variable is numeric or character is not always predictable from its name. An ID variable that consists only of numbers might be either numeric or character. A flag variable whose values are only 0 or 1 might be numeric or character. It's obviously important when you start writing code to know what type of variables you have.
When working with numeric data it's important to know the variables' length. The default is 8 bytes, but this is often reduced to save disk space. If you are going to be modifying the values of numeric data, it's especially important to know variable length. Here's a simple program for taking a first look.
(4) PROC CONTENTS DATA= DSN_IN OUT= CHECK1
(KEEP= NAME TYPE LENGTH LABEL);
RUN;
PROC FREQ DATA= CHECK1;
TABLES LENGTH;
WHERE TYPE = 1;
RUN;
The output data set CHECK1 will have 4 variables: NAME (= the names of the variables on the DSN_IN data set); TYPE (1 if numeric, 2 if character); LENGTH and LABEL.
The PROC FREQ outputs a table showing the frequency of numeric variables (WHERE TYPE = 1) by LENGTH. There are two reasons to care about numeric length: (i) if it is less than 8 bytes and you will be increasing any values, you need to make sure that the length specification is sufficient for the updated values; (ii) if you are concerned about saving disk space, you may want to consider reducing numeric length for some variables. For more-detailed discussion of this topic, see my paper on SAS numeric data in these Proceedings.
The situation is similar for character data. Suppose you have a character variable RESPONSE that has a LENGTH of 3 on the input data set and 3 values: "YES", "NO" and "DK" (where "DK" indicates "Don't Know"). You're asked to edit this variable as in (5):
(5) IF RESPONSE = 'DK'
THEN RESPONSE = 'MAYBE';
Because LENGTH is a variable attribute that, by default, is inherited by one data set from another, the LENGTH of 3 will cause the new value to be "MAY" instead of "MAYBE". This is one of many situations where a little time spent reading before typing can save a lot of time later ("Anyone remember which program we edited that RESPONSE variable in?").
It's important to become familiar with variable labels because they are often important sources of information about the intended content and use of the variables. Sometimes labels offer abbreviated explanations of particular values ("1 IF NUMERIC, 2 IF CHARACTER"). If your editing adds to, or changes, these values, you will need to modify the label as well.
Even the best specs aren't perfect and the programmer who has taken (or, been given) the time to understand the context of the data and the specs, can often spot additional modifications that may be needed. Often these take the form, "If you change X then you should also change Y." This is another potential time saver—and one that is often appreciated by the client writing the specs.
Formats are also important for a number of reasons. If numeric variables are associated with formats, this may affect the operation of particular PROCS. It's good to verify that associated formats should be kept, and to communicate any potential implications.
If formats indicate value ranges, it's good to verify that these ranges are meaningful for the data you have. For example, if the format values are \([-1 = '-1']\\), \([0 = '0']\\) and \([1-100 = '1-100']\\) but the actual range of positive values on the input data set is 40-60, you should check whether or not this format range should be changed. For this type of case, if you only ran a formatted FREQ, you would never see any problem because the range of actual values is within the format range. The output would only show a certain number of records with each of the format values.
Another important piece of information to know about an input data set is which variable(s) uniquely identify observations, i.e. the key variable (often, but not always, this is the SORTED BY variable). If you are told that PERSON_ID uniquely identifies rows, then you should run the following check:
(6) PROC SORT DATA= DSN_IN OUT= CHECK2
NODUPKEY;
BY PERSON_ID;
RUN;
If PERSON_ID really is the key variable, then the LOG will show that 0 observations have been deleted.
Don't overlook the obvious takes many forms. For example if you have MONTH and DAY variables, you could include conditionals such as (7) as part of a DATA step.
You can also use format ranges to test for valid and invalid values for particular variables. Part of the importance of knowing what properties the data SHOULD have concerns how various types of non-response values are coded. For example, what is the value for a MONTH variable if this information is unknown. For many surveys, responses such as ‘Don’t Know’ or refusals are coded as specific minus values (-8, -7, etc.) or out-of-range values (e.g. 99). Knowing what these are is essential before any code is written that will edit or re-code the input data. See Ron Cody’s book on data cleaning for many useful approaches to checking the values of input variables.
Here’s an example of the verify what you are told theme: suppose that you have a person-level data set (key=PERSON_ID) and each person is a member of a family, identified by FAMILY_ID. Both variables are character, with PERSON_ID having LENGTH 4 and FAMILY_ID LENGTH 2. PERSON_ID is composed of FAMILY_ID plus a two-character sequence number. The data set would look like (8).
(8) | FAMILY_ID | PERSON_ID |
---|---|---|
01 | 0101 |
01 | 0102 |
01 | 0103 |
02 | 0201 |
02 | 0202 |
03 | 0301 |
One generalization is that the first two characters of PERSON_ID = FAMILY_ID. You can verify this as follows:
(9) IF FAMILY_ID NE SUBSTR(PERSON_ID,1,2)
THEN DO;
PUT ‘***** ID ERROR *****’ ;
PUT FAMILY_ID= PERSON_ID= ;
END;
This will print a message to the LOG for each record where FAMILY_ID is not the first two characters of PERSON_ID. If you suspect you have a lot of bad data and don’t want to fill up your LOG, you can initially set a flag variable (e.g. ID_ERR) that is assigned a value of 1 if the conditional evaluates as true. Then you can run a FREQ on ID_ERR or use it to create an output data set.
This type of approach is much better than dumping 50 or so observations to ‘check’ on variable values or the relationships between variables. I will discuss this further in the section on Output QC, but it is relevant here as well. Printing a small number of records is an amazingly common practice among SAS programmers. It is often requested by clients. It is useful for getting a kind of ‘at-a-glance’ initial sense of the data. It may even make you aware of a problem that would never have occurred to you to check on. But it is never a sufficient QC check for the simple reason that, if you print 50 records, there may be a problem with records 51 through 100,000.
Here’s where ‘QC as data analysis’ comes in most clearly. Good QC, like good data analysis, allows you to draw conclusions about the data. From a QC perspective, you want to be able to say, with confidence, that the first two characters of each PERSON_ID on DSN_IN = FAMILY_ID. The only way to put yourself in position to say that is to examine all the records. The only reasonable way to do this is with a DATA or PROC step. I recently worked with an input file with 4 different ID variables. The file has 323,536 records. On each record, a substring of each of the ID variables is supposed to have the same 3-digit person identifier. This turned out to be true for all but one record. But it was important to catch that one error and correct it.
**PROGRAM QC**
The point of Program QC is to write DATA steps (e.g. merges) and include PROCs in such a way that you are outputting information that is necessary for evaluating the correctness of the program and its output.
There are a couple of SAS options that I would recommend either as system or program options. The first is ERRORABEND. This will cause SAS to abend for errors where it would otherwise (i.e. if NOERRORABEND is set) write a LOG ERROR note, set OBS=0 and go into syntax-checking mode. I rarely find syntax checking after the initial error very useful, and it is much easier for me to focus on correcting the one error that caused SAS to abend. The LOG of any running program should be free of ERROR messages, even those associated with errors that “don’t matter.” Chapter 2 of Michele Burlew’s book on debugging SAS programs has good information on interpreting and correcting Notes, Warning and Error messages in SAS LOGs.
Another option I would recommend, not available in V6, is MERGENOBY=ERROR. If you fail to include a BY statement when merging data sets, SAS will write the following message to the LOG.
(10) ERROR: No BY statement was specified for a MERGE statement.
This is a very useful option which I have in my AUTOEXEC file. I never intentionally merge data sets without a BY statement (even one-to-one merges) so =ERROR works best for me. You can also set MERGENOBY=WARN to get a warning rather than an error message.
In (11) I illustrate a merge DATA step where temporary variables containing information about the merge are written to the LOG.
(11) DATA THREE;
MERGE ONE (IN= A) TWO (IN= B)
END= ITSOVER;
BY ID;
IF A AND B
THEN MTCH+1;
ELSE IF A
THEN JUSTA+1;
ELSE IF B
THEN JUSTB+1;
IF ITSOVER
THEN PUT MTCH= JUSTA= JUSTB= ;
DROP MTCH JUSTA JUSTB;
RUN;
END= creates a temporary variable indicating the end of the file with the largest number of observations. Here this variable is named ITSOVER and the LOG message is only written when the last observation is processed. At this point the value of the variable MTCH equals the number of observations where ONE and TWO match BY ID. The value of JUSTA is the number of non-matches in ONE. The value of JUSTB is the number of non-matches in TWO. Although it’s often the case that the number of OBS in the output data set indicates the number of matches, if a subsequent problem is noticed, then knowing the number of non-matches can be important.
When possible I try to have enough information to be able to make predictions about the outcome of a merge. Is it a one-to-one merge where all records should match? Is it a one-to-many match? I can’t always predict what the exact values of MTCH, JUSTA and JUSTB should be—but I can usually make some predictions, even it’s simply that there should be very few non-matches.
Let’s take a different type of example, one where Input and Program QC will help you write the correct code without trial and error. Suppose you have the spec in (12).
(12) Create a variable AGECAT. If a person is under 18 then AGECAT = CHILD. If the person is 18 or older, then AGECAT = 'ADULT'.
Without having looked at the data, it might be tempting to code this as:
(13) IF AGE < 18
THEN AGECAT = 'CHILD';
ELSE AGECAT = 'ADULT';
But as part of Input QC, you noticed that there were both missing values and zero values. The conditional in (13) will code both of these values as ‘CHILD.’ This may be want is intended for 0, but certainly not for missing values. Another way to catch this type of value is to always include a QC crosstab after re-coding. This crosstab should have the basic form BEFORE*AFTER. Of course the trick to such a crosstab is how to format the BEFORE variable. For something like AGE (with perhaps 100 different values) it wouldn’t be too annoying to leave it unformatted. But that isn’t often a realistic option.
Here you could run a PROC to get the MIN and MAX values (perhaps using a WHERE AGE GT 0 clause) and then format AGE as MISSING, O, 1-17 and 18-95 (assuming that 95 was the maximum age on the data set). Then you could modify (13) as in (14). Of course, once you know to ask, it may be a simple check to find out if 0 values should be coded as ‘CHILD.’ If so then (14) can be simplified to include 0 in the CHILD range.
(14) IF (1 <= AGE <= 17)
THEN AGECAT = 'CHILD';
ELSE IF (18 <= AGE <= 95)
THEN AGECAT = 'ADULT';
ELSE IF AGE = 0
THEN AGECAT = 'ZERO VALUE';
ELSE IF AGE = .
THEN AGECAT = 'MISSING';
ELSE AGECAT = '??????';
The final clause here points to another part of good programming: conditionals should always exhaust the logical possibilities. The final ELSE gives you control over the unexpected. You will have a clear indicator ("??????") that there are AGE values you haven’t accounted for.
Often the best you can do for quality control is to test that two different methods lead to the same result. SAS is great for this because there’s usually more than one way to do any particular operation. Consider an example where you have a person-level data set with three expenditure variables: OOP (for out of pocket); PRV (for private); and PUB (for public). The spec is to create a person-level total expenditure variable TOTEXP.
Here’s a way of building good QC into the DATA step (assume there’s a person-level ID variable).
(15) DATA TWO;
SET ONE END= ITSOVER;
TOTEXP = (OOP+PRV+PUB);
SUMTOTXP+TOTEXP;
TOTCHK = SUM(OOP,PRV,PUB);
SUMTOTCK+TOTCHK;
SUMOOP+OOP;
SUMPRV+PRV;
SUMPUB+PUB;
IF TOTEXP NE TOTCHK
THEN PUT ID= TOTEXP= TOTCHK= ;
IF ITSOVER
THEN
DO;
IF SUMTOTXP NE SUMTOTCK
THEN PUT ID= SUMTOTXP= SUMTOTCK= ;
ELSE PUT 'SUM TOTALS OK';
IF SUMTOTXP NE
SUM(SUMOOP,SUMPRV,SUMPUB)
THEN PUT ID= SUMTOTXP= SUMOOP= SUMPRV= SUMPUB= ;
ELSE PUT 'SUMTOTXP OK' ;
END;
RUN;
On the record (i.e. person) level, this DATA step creates a total expenditure variable TOTEXP. As a check on this we create another total expenditure variable TOTCHK with the sum function. They should be equal and we test for this on each record (IF TOTEXP NE TOTCHK...). As an added check, we sum these totals and their components (OOP, PRV and PUB) for the full data set—and then put in conditionals to make sure
that the sums of the totals equal the totals of the sums (i.e. everything adds up the way it should).
Clearly there is more that could be built in here, and other ways (e.g., using summary PROCs) to check on these variables. But, even though this DATA step is more complicated than it would be without the QC, it is easier than coming back later and trying to figure out why something's not adding up.
The extra assignment statements and conditionals in this DATA step put you in a position where you can say, with confidence, that for each record the TOTEXP variable accurately sums the OOP, PRV and PUB variables. Also, if program LOGs are part of what you deliver to the client, you now have specific program output that you can point to to back up your assertions about the programs and the data.
Another common area of SAS programming is creating a new file or variable that's at a different level (e.g. person, family, etc.) than the input file. As an example, assume that you have a person-level file with family and person ID variables, plus an age variable. The spec is in (16).
(16) Create a family-level variable FAM_AGE that has a value of 1 if at least one member of the family is 65 or older. Otherwise FAM_AGE = 0.
A common way to do this in SAS is shown in (17). I haven't included the QC parts of the merge because (17) is illustrating common practice.
(17) PROC SORT DATA= ONE;
BY FAMILY_ID;
RUN;
DATA TWO (KEEP= FAMILY_ID FAM_AGE);
SET ONE;
BY FAMILY_ID;
RETAIN FAM_AGE;
IF FIRST.FAMILY_ID
THEN FAM_AGE = 0;
IF AGE >= 65
THEN FAM_AGE = 1;
IF LAST.FAMILY_ID;
RUN;
PROC SORT DATA= TWO;
BY FAMILY_ID;
RUN;
DATA THREE;
MERGE ONE TWO;
BY FAMILY_ID;
RUN;
In this DATA step the data set ONE is read in twice BY FAMILY_ID. That is, a family group of records is read in from ONE (IN= A), and the FAM_AGE variable is created based on the AGE variable. This variable is RETAINed and its value on the last record for this family 'spills over' into the records for this same family when ONE is read in again BY FAMILY_ID. The trick here is this second pass through the family group doesn't trigger the THEN FAM_AGE = 0 conditional because the value of FAMILY_ID doesn't change so it's only records on the IN= A data set where FIRST.FAMILY_ID = 1. If you want to see this concretely, create a small data set of 3 or 4 families and place (19) just before the RUN statement.
(19) PUT FAMILY_ID= AGE= FAM_AGE=
FIRST.FAMILY_ID= LAST.FAMILY_ID= ;
The DATA step in (18) isn't directly generating any QC output. But it is creating an output data set that will allow for OUTPUT QC to yield some results, as we'll see in the next section.
The general structure, somewhat simplified, of many SAS programs is to input a data set, create a series of temporary data sets, and output a permanent data set. We can illustrate this in (20).
(20) I \rightarrow T_1 \ldots \rightarrow \ldots \rightarrow T_n \rightarrow O
It's a good rule of thumb to generate QC output (either as LOG messages or PROC output) for each temporary data set the program generates. That way, if you have to work your way back from some problematic output to its source, you have a series of snapshots to guide the search.
**OUTPUT QC**
Let's begin this section with the last example from the previous section. We've created a family-level variable FAM_AGE on a person-level file. How do we check the correctness of our code?
First question is: Given the specs, what SHOULD be true? It SHOULD be the case that all records on the file where AGE is 65 or greater have a FAM_AGE value of 1. That is, if you're 65 or older you must be in a family that has a member who is 65 or older. So, if we run a crosstab FAM_AGE*AGE (where AGE is formatted as 'UNDER 65' and '65 OR OLDER'), we should find that for all records where AGE='65 OR OLDER', FAM_AGE = 1.
But what can we say about the records where AGE is less than 65? Not much directly. This is where the DATA step in (17) comes in. We now have two DATA sets that should be identical, even though the family-level variable FAM_AGE was created in two different ways. This is a time to use PROC COMPARE. We can use it in its simplest form, as in (21).
(21) PROC COMPARE BASE=THREE
COMPARE=CHKFAM;
RUN;
The PROC COMPARE output should say that there are no observations with variables of unequal value. Note that this is also an added check on the merge in (17). That is, data set THREE should be equal to ONE plus the new FAM_AGE variable. Data set CHKFAM created in (18) also should be identical to ONE plus the FAM_AGE variable. So, if (17) and (18) produce identical output, and the crosstab shows that all persons 65 or older are in families where FAM_AGE = 1, then this seems like a pretty strong indication that we're outputting the intended result. Note that it's not proof. We've used the same conditionals in (17) and (18) to create the variables, so if we're repeating an error in our logic that it isn't shown by the crosstab, it may still slip through.
This points to another aspect of trying to exhaust the possibilities, not just when writing conditionals, but also when testing output. I have seen programs where, having recognized that we can only predict the FAM_AGE values for those 65 and older, programmers will run a PROC FREQ for FAM_AGE and include the clause WHERE AGE >= 65. This is risky because then we can't see the numbers for those under 65. It might be that the crosstab shows that FAM_AGE = 1 for ALL records on the file. This is almost certainly a programming error (if it's true, why create the variable?). The WHERE clause restricts the information that is output, creating the possibility of missing a large problem.
This brings us back to content-based programming. What is the population on the data set? Is it families with at least one person receiving Medicare? A random sample of families in the US? Obviously this will affect our expectations. When creating variables at a certain level, it's useful to run FREQUENCIES at that level, even if not required by the specs. So run a FREQUENCIES for FAM_AGE on the family-level file TWO created in (17). Is the output reasonable given the population?
One last point with this example. If you wanted to directly check that the output file THREE is identical to ONE except for the addition of the FAM_AGE variable, you can compare them by simply dropping the new variable, as in (22).
(22) PROC COMPARE
BASE=THREE (DROP=FAM_AGE)
COMPARE=ONE;
RUN;
This allows you to check that there haven't been any 'inadvertent' changes along the way. As mentioned in the section on PROGRAM QC, a typical program usually generates a number of temporary data sets before a permanent data set is created. In addition to including QC LOG messages and PROC output for the temporary data sets, it is important to repeat any relevant QC measures with the final output. Not all will be possible because the output file might be different in character (e.g. a person-level rather than a family-level file) from some of the temporary data sets, but what is possible should be done. After all, it's the final output that's important.
One all-too-common way to check the final output is to print 50 OBS or so of a large file to check that everything looks the way it should. A lot of programmers do this, and a lot of clients request it, because it gives a concrete sense of how the variable values look. But it is not a sufficient QC measure.
Sometimes there's a series of record-level edits that really are just a list of individual changes to a file. In this case PROC OUTPUT, which is usually designed to capture patterns in the data, is of little use. Here's one case where the temptation to dump 50 OBS is hard to resist. If we take the 'data-analysis' perspective, one problem with dumping 50 OBS is that you usually see the following:
(23) PROC PRINT DATA=THREE (OBS=50);
RUN;
Here the OBS= 50 tells SAS to print the first 50 observations in the data set. Usually there is no particular reason to print the first 50 observations, it's just convenient. If there really is no alternative than examining a small number of observations to check a large number of record-level edits (i.e. there is no pattern to be tested), I would recommend, since it's now very easy in SAS, to take a simple random sample [SRS], as shown in (24). This is really just a form of data-entry checking.
(24) PROC SURVEYSELECT DATA=THREE
METHOD=SRS
SAMPSIZE=50
OUT=CHECK3;
RUN;
PROC PRINT DATA=CHECK3;
RUN;
You can change SAMPSIZE to be whatever number of records you would normally dump and then print the output. This method allows you to avoid basing conclusions on variable values that may be particular to the first 50 or so observations in a data set. It's not perfect, but it's better than the alternative.
In many ways OUTPUT QC mirrors INPUT QC in that you want to have a very detailed picture of both input and output data sets. In the INPUT QC section I stressed the essential role of PROC CONTENTS. This is equally important with OUTPUT QC. The list of data set properties in (3), repeated here as (25) should form a minimal output checklist.
(25) a. Number of Variables
b. Number of Observations
c. Sorted?
d. Engine (V8?)
e. Variable Name
f. Variable Type (Numeric/Character?)
g. Variable Length
h. Variable Labels
i. Variable Formats
Are the number of variables and observations correct? Should the data set be sorted? Do all the variables have labels and/or formats? I would also add to this list a question about compression. SAS V8 offers good options for compression that are worth considering (COMPRESS= CHAR | BINARY). It is also useful to use the POSITION or VARNUM option to clearly see the position of the variables on the data set. This is often a good way to pick up any stray variables (e.g. I or X from a DO loop) that may have been accidentally left on the data set. These variables will tend to be positioned near the end.
CONCLUSION
The basic principle of QC is to know your data. Good programming requires that you know your input data, that you know the relevant properties of intermediate data sets, and that you know the details of your permanent output. An important element of this is to distinguish between the values that variables actually have, and the values that they should have. As much as possible this should be done for all records on all the files you are working with.
SAS programmers are fortunate to have a variety of data-analysis tools at their disposal. The minimal added cost of including QC PROCs or conditional LOG messages in SAS programs is usually more than offset by the benefit of preventing the generation of unintended output.
In the section on INPUT QC, I said that time pressure is one of the great enemies of good QC. It’s clear that in the real world you can’t always run every check that you’d like. But there’s an awful lot that can be done fairly efficiently. In the same way that there are patterns in data we want to capture with our programs, there are patterns to QC that often recur on projects we are working on. As with input data before beginning a program, it’s worthwhile at the beginning of a project to anticipate QC needs and build them into program specs. Often this will allow a number of QC steps to be ‘macrotized’ for a greater saving of project resources by being applicable to a number of different programs.
In general, the net cost in time for good QC is probably minimal. Many of us know from painful experience the feeling that comes when someone asks, right after the final data delivery, “Did you know that those expenditure values we summed had –1 values for missing data?”
REFERENCES
ACKNOWLEDGMENTS
When writing papers such as this, one feels more like an editor than an author. Part of being a good programmer is being a magnet for all the tips and tricks that you can pick up from old programs, old programmers, young programmers, listservs, users’ groups and hallway conversations. This paper is filled with things I’ve picked up along the way and much of it (I hope) is familiar to many readers. Thanks to the SAS-programming community, especially my colleagues at Social & Scientific Systems.
CONTACT INFORMATION
Paul Gorrell
Social & Scientific Systems, Inc.
8757 Georgia Avenue, 12th Floor
Silver Spring, MD 20910
Email: pgorrell@s-3.com
Telephone: 301-628-3237 (Office)
301-628-3000 (Main)
FAX: 301-628-3201
|
{"Source-Url": "http://www.lexjansen.com/nesug/nesug02/at/at008.pdf", "len_cl100k_base": 7715, "olmocr-version": "0.1.50", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 22600, "total-output-tokens": 8447, "length": "2e12", "weborganizer": {"__label__adult": 0.0002036094665527344, "__label__art_design": 0.00025153160095214844, "__label__crime_law": 0.0002429485321044922, "__label__education_jobs": 0.0013666152954101562, "__label__entertainment": 4.106760025024414e-05, "__label__fashion_beauty": 9.876489639282228e-05, "__label__finance_business": 0.0006308555603027344, "__label__food_dining": 0.0002372264862060547, "__label__games": 0.00028777122497558594, "__label__hardware": 0.0005278587341308594, "__label__health": 0.0003457069396972656, "__label__history": 0.00011938810348510742, "__label__home_hobbies": 9.745359420776369e-05, "__label__industrial": 0.0004041194915771485, "__label__literature": 0.00013434886932373047, "__label__politics": 0.00014543533325195312, "__label__religion": 0.0002386569976806641, "__label__science_tech": 0.0141143798828125, "__label__social_life": 8.422136306762695e-05, "__label__software": 0.02093505859375, "__label__software_dev": 0.958984375, "__label__sports_fitness": 0.00015842914581298828, "__label__transportation": 0.0002677440643310547, "__label__travel": 0.00012165307998657228}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 33321, 0.0365]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 33321, 0.58472]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 33321, 0.92649]], "google_gemma-3-12b-it_contains_pii": [[0, 5548, false], [5548, 10783, null], [10783, 15708, null], [15708, 20336, null], [20336, 24285, null], [24285, 29865, null], [29865, 33321, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5548, true], [5548, 10783, null], [10783, 15708, null], [15708, 20336, null], [20336, 24285, null], [24285, 29865, null], [29865, 33321, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 33321, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 33321, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 33321, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 33321, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 33321, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 33321, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 33321, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 33321, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 33321, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 33321, null]], "pdf_page_numbers": [[0, 5548, 1], [5548, 10783, 2], [10783, 15708, 3], [15708, 20336, 4], [20336, 24285, 5], [24285, 29865, 6], [29865, 33321, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 33321, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-01
|
2024-12-01
|
8d04b7bec94a798edefc6fea8ef6e37a4efcde32
|
Towards a generation-based semantic web authoring tool
Conference or Workshop Item
How to cite:
For guidance on citations see FAQs.
© 2009 The Author
Version: Accepted Manuscript
Link(s) to article on publisher’s website:
http://portal.acm.org/citation.cfm?id=1610195.1610197
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.
Towards a Generation-Based Semantic Web Authoring Tool
Richard Power
Department of Computing
Open University
Milton Keynes, UK
r.power@open.ac.uk
Abstract
Widespread use of Semantic Web technologies requires interfaces through which knowledge can be viewed and edited without deep understanding of Description Logic and formalisms like OWL and RDF. Several groups are pursuing approaches based on Controlled Natural Languages (CNLs), so that editing can be performed by typing in sentences which are automatically interpreted as statements in OWL. We suggest here a variant of this approach which relies entirely on Natural Language Generation (NLG), and propose requirements for a system that can reliably generate transparent realisations of statements in Description Logic.
1 Introduction
We describe here a simple prototype of an editing tool that allows a user to create an ontology through an open-ended Natural Language interface. By ‘open-ended’ we mean that when introducing class or property names into the ontology, the user also decides how they should be expressed linguistically: thus the lexicon of the Natural Language interface is not predetermined. The purpose of such a tool is to support knowledge editing on the Semantic Web, which at present requires training in graphical user interfaces like Protégé (Rector et al., 2004), or direct coding in OWL and RDF. Linking OWL to Controlled Natural Language is currently the topic of an OWL1-1 task force, and several groups are already working in this area (Schwitter and Tilbrook, 2004; Thompson et al., 2005; Bernstein and Kaufmann, 2006; Pool, 2006; Dongilli, 2007); the novelty in our approach is that we rely entirely on Natural Language Generation (NLG), extending the WYSIWYM (or Conceptual Authoring) method (Power and Scott, 1998; Hallett et al., 2007) so that it supports knowledge editing for ontologies as well as for assertions about individuals.
The idea of linking formal and natural languages can be traced back to Frege (1879), who observed that mathematical proofs were made up of formulae interspersed with passages in natural language, and invented formal logic as a way of rendering these passages in a precise notation. With the arrival of Artificial Intelligence in the 1950s, formal logic became the foundation for knowledge representation and automatic reasoning — a trend leading to the recent concept of a ‘semantic web’ that would open up knowledge encoding and utilisation to a world-wide community (Berners-Lee et al., 2001). However, accessible knowledge management requires accessible presentation: hence the current interest in methods of ‘sugaring’ formal logic into natural language text (Ranta, 1994; Horacek, 1999), thus in a sense turning Frege upside-down.
1.1 Description Logic
The theoretical underpinning of OWL (and hence of the semantic web) is a discipline that evolved under various names in the 1980s and 1990s and is now called Description Logic (Baader et al., 2003). This refers not to a single logical language, but to a family of languages. All of these languages allow statements to be built from individuals, classes and properties, but they differ in the resources provided in order to construct classes and properties, thus allowing different balances to be drawn between the conflicting demands of expressiveness and tractability (i.e., decidability and efficiency of reasoning).
Figure 1 shows some common class constructors, using mathematical notation rather than OWL syntax (which is equivalent, but much lengthier). There are in fact three versions of OWL (Lite, DL and Full) which provide pro-
<table>
<thead>
<tr>
<th>Description</th>
<th>Syntax</th>
</tr>
</thead>
<tbody>
<tr>
<td>atomic class</td>
<td>$A$ (etc.)</td>
</tr>
<tr>
<td>universal class</td>
<td>$\top$</td>
</tr>
<tr>
<td>negation</td>
<td>$\neg C$</td>
</tr>
<tr>
<td>intersection</td>
<td>$C \cap D$</td>
</tr>
<tr>
<td>union</td>
<td>$C \cup D$</td>
</tr>
<tr>
<td>value restriction</td>
<td>$\forall R.C$</td>
</tr>
<tr>
<td>exists restriction</td>
<td>$\exists R.C$</td>
</tr>
<tr>
<td>enumeration</td>
<td>${a}$</td>
</tr>
</tbody>
</table>
Table 1: Class constructors
gressively more constructors, not only for classes but also for properties and axioms. Having chosen the desired logic, the ontology builder is free to introduce new atomic classes (and also properties and individuals), which can be given any name consistent with the RDF naming conventions (i.e., names must be Unique Resource Identifiers). Thus a new class might be named http://myontology.net/parent and a new property http://myontology.net/hasChild, although for brevity we will henceforth omit namespaces (i.e., parent, hasChild). Statements about classes can then be expressed by axioms, the most important of which are $C \subseteq D$ ($C$ is subsumed by $D$) and $C \equiv D$ (C is equivalent to D). For instance:
1. $\text{parent} \equiv \text{person} \cap \exists \text{hasChild}$
2. $\text{person} \subseteq \forall \text{hasChild}.\text{person}$
The meanings are probably obvious: (1) a parent is defined as a person with one or more children; (2) every person only has persons as children. Note that expressing these axioms in clear English is not trivial — for instance, in (2) we must take care not to imply that every person has children.
A collection of such axioms is called a TBox: intuitively, a TBox expresses concept definitions and generalisations. Description Logics also contain names for individual instances (e.g., Abraham, Isaac) and formulas expressing facts about individuals: thus father(Abraham) would express class membership (‘Abraham is a father’), and hasChild(Abraham, Isaac) a relationship between individuals (‘Isaac is Abraham’s child’). A collection of such assertions is called an ABox, and TBox and ABox together make up a Knowledge Base (KB).
### 1.2 Reasoning services
The reason for proposing Description Logic as the foundation for the Semantic Web is that it allows for efficient reasoning services. Much effort is still going into the mathematical task of proving decidability and efficiency results for increasingly expressive dialects. Informally, the standard reasoning services are as follows:
1. **Class Satisfiability**: Checking whether in a given KB it is possible for a class to have at least one member.
2. **Subsumption**: Checking whether a given KB implies a specified subsumption relationship between two classes.
3. **Consistency**: Checking whether a given KB is consistent.
4. **Instance Checking**: Checking whether a given KB implies a specified ABox assertion that an individual $a$ belongs to a class $C$.
Consider for instance the following miniature KB:
- man $\sqcup$ woman $\equiv$ person
- man $\subseteq \neg$woman
- man(Abraham)
In respect to this KB, a reasoning engine should be able to show (1) that the class man $\sqcup$ woman is unsatisfiable, (2) that man is subsumed by person (man $\subseteq$ person), (3) that the KB is consistent, and (4) that the assertion person(Abraham) holds.
The ability to perform these reasoning tasks efficiently can be exploited not only in applications that utilize knowledge in problem-solving, but in knowledge editing and natural language generation. For instance, when an ontology builder adds a new axiom to a KB, the editor can run the subsumption and consistency checks and give feedback on whether the axiom is informative, redundant, or inconsistent. Or when producing a natural language gloss for the class $\exists \text{hasChild}.$ female, the generator could choose between ‘something with at least one female child’ and ‘someone with at least one female child’ by checking the subsumption relationship $\exists \text{hasChild}.$ female $\subseteq$ person.
### 2 Aligning DL to CNL
We have explained informally the technical features of description logics. Briefly, they include rules for constructing classes, axioms, and assertions about individuals; the resulting expressions
are interpreted through a relatively simple model-theoretic semantics (Baader et al., 2005). They also include efficient algorithms for performing reasoning tasks. We now turn to issues in the design of Controlled Natural Languages (CNLs) which can be aligned with specific DLs, and thus serve as useful interfaces for working with complex formalisms like OWL and RDF.
As a provisional list of requirements, we would suggest the following:
1. **Completeness**: A sentence (or text) can be generated for any axiom permitted by the DL.
2. **Uniqueness**: Different sentences are generated for different axioms.
3. **Transparency**: Sentences in the CNL are accurately interpreted by human readers.
4. **Fluency**: Sentences in the CNL are interpreted easily by human readers and judged natural.
5. **Interpretability**: Sentences conforming to the CNL can be automatically interpreted to recover the corresponding DL axiom.
6. **Editability**: Interactive texts in the CNL can be manipulated by domain experts in order to extend and revise the KB.
7. **Extensibility**: Domain experts can extend the CNL by linking lexical entries to new individuals, classes or properties in the KB.
Note that these are essentially practical requirements, which concern the CNL’s role as an interface for a particular DL. We see no reason to insist that the alignment between DL and CNL should conform to general theories of natural language semantics.
### 2.1 Completeness
If we propose to use generated CNL as an interface to a knowledge base, it is important that generation should be reliable. A minimal test of reliability is that the grammar and lexicon are complete, in the sense that they produce a text for any well-formed semantic input. Elsewhere, we have described a generation method that allows completeness to be checked by a computer program (Hardcastle and Power, 2008). For any non-trivial DL the set of classes is infinite (e.g., through recursion on \( C \sqcap D \) or \( \exists R.C \)); however, completeness can be proved through an enumeration of all local contexts for which a linguistic realisation rule is needed. As well as guaranteeing reliability, completeness checking is obviously useful as an aid to grammar development.
### 2.2 Uniqueness
Although necessary, completeness is not a sufficient condition on the grammar of a CNL, since it could be trivially met by generating the same string (perhaps ‘Hallo World’) for any semantic input. It would also be useful to have an automatic check that the same sentence is not generated for two different semantic inputs — i.e., that every sentence in the CNL has a unique meaning. This seems a harder problem than completeness, and we have not seen any proposals on how it could be done.
To pose this problem precisely we would need to define what is meant by ‘different’ semantic inputs. Complex class descriptions can be manipulated by well-known logical equivalences like De Morgan’s laws: for instance, \( \neg (C \sqcap D) \) is equivalent to \( (\neg C) \sqcup (\neg D) \). Should these be treated as different inputs or the same input? We think users would probably prefer them to be treated as different, but the issue needs to be investigated further.
### 2.3 Transparency
Transparency is obviously at the heart of the enterprise: completeness and uniqueness proofs are no help if the generated texts are unclear to human readers. Unlike the preceding requirements, transparency is a matter of degree: we cannot expect, far less prove, that every sentence in the CNL will be accurately understood by all target users on all occasions. Transparency can only be assessed, and gradually improved, through experiments and user feedback.
### 2.4 Fluency
Fluency is another aspect of readability: whereas transparency concerns accuracy of interpretation, fluency concerns ease. These requirements potentially conflict. For instance, to express the axiom \( \text{parent} \sqsubseteq \exists \text{hasChild} \).\( \top \) fluently we could say ‘every parent has a child’, while for transparency we might prefer the pedantic ‘every parent has one or more children’. In a CNL designed for editing a KB, transparency will have priority, but one can imagine other purposes (e.g., an informal report) for which fluency would matter more.
2.5 Interpretablity
This is an essential requirement for knowledge editors that rely on automatic parsing and interpretation of texts typed in by human authors (Schwiter and Tilbrook, 2004; Bernstein and Kaufmann, 2006). A recent innovation has been to pursue the goal of ‘roundtripping’ (Davis et al., 2008), so that a CNL text can be generated from an existing ontology, revised in a text editor, and then interpreted automatically to obtain an updated ontology in the original format. For our approach, which relies entirely on generation, automatic interpretability is not essential (although one can imagine contexts in which it would be useful, for instance to allow knowledge encoding outside the NLG-based editing environment).
2.6 Editability
The key feature of Conceptual Authoring (WYSIWYM) is that editing operations are defined on the semantic input, not the text. This means that authors cannot produce a text in the normal way by typing in words from left to right. Some kind of non-specific initial configuration has to be gradually refined through semantic distinctions made by choices from menus (an example will be given later). To validate the approach, it has to be shown that this editing process is efficient and easily learned. Usability results from ABox editing applications have been encouraging (Hallett et al., 2007), but whether similar results can be achieved for KB editing (TBox as well as ABox) remains unproven.
2.7 Extensibility
Ontology development requires that authors should be able to introduce new terms for individuals, classes and properties. The designer of a CNL-based editor cannot foresee what these terms will be, and therefore cannot provide a mapping to suitable lexical entries. This must be done by the ontology developer, and take-up accordingly depends on making this task not only feasible but easy (Hielkema et al., 2007). We will explore two ideas on how this might be done: (a) providing a wide-coverage lexicon from which users can select words to extend the CNL, and (b) using conventions for controlling the naming of classes and properties, so that the two decisions (term name, CNL lexical entry) become essentially a single decision.
3 Editing process
As a first experiment we have written a Prolog program which allows a KB to be built up from scratch for a very simple DL with only one kind of statement ($C \subseteq D$), four class constructors ($A, \top, \exists R.C, \{a\}$), and one property constructor (property inversion, which will be explained shortly). Using just these resources we can formulate ABox assertions as well as TBox axioms by the trick of representing individuals through enumerated classes. For instance, man( Abraham) can be asserted through the axiom $\{Abraham\} \subseteq man$ (the class containing only Abraham is a subclass of the class of men).
A generic grammar is provided for realising axioms and complex class descriptions (a handful of rules suffices); the grammar assumes that the words for realising individuals, atomic classes and properties will conform to the following (very strict) regulations:
1. Individuals are realised by proper names
2. Atomic classes are realised by count nouns
3. Properties are realised either by transitive verbs or by count nouns
We also simplify by assuming that the name of every atomic term in the DL is identical to the root form of the word realising the term — for instance, the count noun realising the class $person$ will be ‘person’.
When the editor is launched there are no individuals, atomic classes or properties, and the only word in the lexicon is ‘thing’, which denotes the class $\top$ (i.e., the class containing all individuals). The KB is construed as a sequence of axioms, and to start the ball rolling it is seeded with a single vacuous axiom $\top \subseteq \top$. The program generates a sentence expressing this axiom and adds a list of editing options as follows:
1: Every thing/1 is a thing/2.
1. Add a new term
2. Add a new axiom
3. Edit class C in axiom A
4. Delete axiom A
Note that in every sentence expressing an axiom, the head word of every span denoting a class is given a numerical label; in a simple Prolog interface this allows the class to be selected for editing. There is no point in attempting any editing yet, since no terms have been introduced.
The user should therefore choose option to add a new term. This is done by specifying three things: a word (any string), a syntactic category (either name, noun, or verb), and a logical type (individual, class, or property). In this way the user might define the set of terms in figure 2 from the people-pets domain, which will be familiar to students of Description Logic.
Table 2: Lexical entries for terms
<table>
<thead>
<tr>
<th>Word</th>
<th>Syntax</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>Mary</td>
<td>name</td>
<td>individual</td>
</tr>
<tr>
<td>pet</td>
<td>noun</td>
<td>class</td>
</tr>
<tr>
<td>animal</td>
<td>noun</td>
<td>class</td>
</tr>
<tr>
<td>own</td>
<td>verb</td>
<td>property</td>
</tr>
</tbody>
</table>
Editing of the axiom \( T \subseteq T \) can now begin. Assuming that the target is \( pet \subseteq animal \), the user first selects the first class in the first axiom by typing 1/1 (in a GUI this would be done simply by clicking on the word). The program returns a menu of substitutions computed from the current ontology and expressed in English phrases adapted to the context of the selected class:
1. Mary
2. Every pet
3. Every animal
4. Everything that owns one or more things
5. Everything owned by one or more things
These phrases express respectively the classes \( \{Mary\}, pet, animal, \exists own.T \) and \( \exists own^{-1}.T \) which can be formed from the terms in figure 2. Note that the last class results from the inversion of the property \( own \): if \( own(a, b) \) means that \( a \) owns \( b \), the inverse \( own^{-1}(a, b) \) means that \( b \) owns \( a \) — a relationship that can conveniently be expressed by passivisation (\( a \) is owned by \( b \)).
When the user chooses option 2 (in a GUI this would of course be done by clicking on the menu item), the program updates the knowledge base and regenerates:
1: Every pet/1 is an animal/2
Selecting the second class by typing 1/2 now yields the same menu of options, differently phrased to suit the different context of the class in the axiom:
1. Mary
2. a pet
3. an animal
4. owns one or more things
5. is owned by one or more things
Choosing option 3 completes the first axiom, after which the user can use the option a (see above) to obtain a second default axiom for editing:
1: Every pet/1 is an animal/2
2: Every thing/1 is a thing/2
A similar series of operations on the second axiom (starting by selecting 2/1) might then yield the following:
1: Every pet/1 is an animal/2
2: Mary/1 owns/2 one or more pets/3
Even in such a simple example, we can see how editing could be supported by the reasoning services. For instance, if the user added a third axiom ‘Mary owns one or more animals’, the program could point out that this is redundant, since \( \{Mary\} \subseteq \exists own.animal \) can be deduced from \( pet \subseteq animal \) and \( \{Mary\} \subseteq \exists own.pet \).
4 Discussion
We have shown through a small prototype how a KB could be built up from scratch using an NLG-based authoring tool, with the lexicon almost entirely specified by the ontology developer. Although modest in scope, the prototype extends previous work on Conceptual Authoring (WYSIWYM) in several ways:
- It allows editing of the TBox as well as the ABox, by defining editing operations on classes rather than individuals (with individuals treated as singleton enumerated classes).
- It allows users to extend the CNL through the constrained choice of words/phrases to express new individuals, classes and properties.
- It allows feedback based on reasoning services (e.g., on whether a new axiom is inconsistent, informative or redundant).
An obvious objection to our approach is that we are increasing the load on users by requiring them to build not only a KB but also a CNL lexicon. Much will therefore depend on the tools that support users in the latter task. Ideally, the construction of a lexical entry would depend on making a single selection from a wide-coverage lexicon that has already been built by computational linguists. However, although this ideal is feasible for classes and properties like pet and own which can be mapped to single words, any encounter with real ontologies is likely to reveal terms like hasDietaryPreference that would have to be
expressed by a phrase. Probably there are solutions to this problem — one could imagine for instance an algorithm that builds new entries in a phrasal lexicon from examples — but they remain to be demonstrated and tested.
More generally, an important question is whether such a method will scale up. It seems to work reasonably well in the above example with a handful of class constructors, terms and axioms, but what happens when we tackle an expressive DL like OWL Full, and support the editing of a KB with thousands of terms and axioms?
As regards more expressive DLs, we have already cited promising work on developing CNLs for OWL. As one might expect, the Boolean class constructors \((C \cap D, C \cup D, \neg C)\) can lead to problems of structural ambiguity, e.g. in a description like old \((\text{man} \cup \text{woman})\). Here an NLG-based editor should have the advantage over one that requires human authoring of texts, since it can apply the best available aids of punctuation and formatting (Hallett et al., 2007), a task that would require great care and skill from human authors.
Increasing the number of terms would mean that during editing, classes had to be selected from thousands of alternatives; some kind of search mechanism would therefore be needed. A simple solution already used in WYSIWYM applications (Bouayad-Agha et al., 2002; Hallett et al., 2007; Evans et al., 2008) is a menu equipped with a text field allowing users to narrow the focus by typing in some characters from the desired word or phrase. In an ontology editor this search mechanism could be enhanced by using the ontology itself in order to pick options that are conceptual rather than orthographic neighbours — for instance on typing in ‘dog’ the user would obtain a focussed list containing ‘poodle’ and ‘pekingese’ as well as ‘doggerel’.
Increasing the number of axioms has no effect on the editing process, since we are assuming that axioms will be realised by separate sentences, each generated without regard to context. However, a text comprising a long list of unorganised axioms hardly makes for easy reading or navigation. There is therefore potential here for a more interesting application of NLG technology that would draw on topics like generation of referring expressions, pronominalisation, aggregation, discourse planning, and summarisation. Presenting a KB through a fluent and well-organised report would give users a valuable return on their efforts in linking terms to lexical entries, and would address a pressing problem in ontology building — how to maintain transparency in an ontology as it expands, possibly through contributions from multiple users.
In a word, the advantage of applying NLG in this area is flexibility. Once we have a mapping from logical terms to lexical entries in English or another natural language, we can tailor generated texts to different tasks in knowledge management, using fluent organised reports for purposes of overview and navigation, and short pedantically precise sentences for editing — backed up if necessary with footnotes explaining unintuitive logical implications in detail, or painstakingly formatted Boolean constructions that avoid potential structural ambiguities.
References
J. Pool. 2006. Can controlled languages scale to the web? In *5th International Workshop on Controlled Language Applications (CLAW’06)*, Boston, USA.
|
{"Source-Url": "http://oro.open.ac.uk/19326/1/ENLG2009-1.pdf", "len_cl100k_base": 5547, "olmocr-version": "0.1.49", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 24695, "total-output-tokens": 6978, "length": "2e12", "weborganizer": {"__label__adult": 0.0005483627319335938, "__label__art_design": 0.001049041748046875, "__label__crime_law": 0.0007882118225097656, "__label__education_jobs": 0.00677490234375, "__label__entertainment": 0.0004925727844238281, "__label__fashion_beauty": 0.00038552284240722656, "__label__finance_business": 0.0007596015930175781, "__label__food_dining": 0.0006747245788574219, "__label__games": 0.0012311935424804688, "__label__hardware": 0.0006356239318847656, "__label__health": 0.0014200210571289062, "__label__history": 0.0007486343383789062, "__label__home_hobbies": 0.00021338462829589844, "__label__industrial": 0.0007367134094238281, "__label__literature": 0.0080718994140625, "__label__politics": 0.0009393692016601562, "__label__religion": 0.0012073516845703125, "__label__science_tech": 0.447509765625, "__label__social_life": 0.0005536079406738281, "__label__software": 0.04913330078125, "__label__software_dev": 0.474365234375, "__label__sports_fitness": 0.0003843307495117187, "__label__transportation": 0.0009937286376953125, "__label__travel": 0.00031495094299316406}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28413, 0.03228]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28413, 0.68503]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28413, 0.89212]], "google_gemma-3-12b-it_contains_pii": [[0, 715, false], [715, 4347, null], [4347, 8669, null], [8669, 12975, null], [12975, 17317, null], [17317, 21487, null], [21487, 26187, null], [26187, 28413, null]], "google_gemma-3-12b-it_is_public_document": [[0, 715, true], [715, 4347, null], [4347, 8669, null], [8669, 12975, null], [12975, 17317, null], [17317, 21487, null], [21487, 26187, null], [26187, 28413, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28413, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28413, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28413, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28413, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28413, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28413, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28413, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28413, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28413, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28413, null]], "pdf_page_numbers": [[0, 715, 1], [715, 4347, 2], [4347, 8669, 3], [8669, 12975, 4], [12975, 17317, 5], [17317, 21487, 6], [21487, 26187, 7], [26187, 28413, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28413, 0.10323]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
faae8a2326a04d0e95fb6c632cade7a95e6d18a0
|
Action Selection in Bayesian Reinforcement Learning
Tao Wang
Background Perspective
- Be *Bayesian* about reinforcement learning
- Ideal representation of uncertainty for action selection
Why are Bayesian approaches not prevalent in RL?
- Computational barriers
My Work
- Practical algorithms for approximating Bayes optimal decision making
- Analogy to *game-tree search*
- on-line lookahead computation
- global value function approximation
(but here expecti-max vs. mini-max)
- Two key parts:
- build a lookahead tree (ICML 2005)
- approximate leaf values (AAAI 2006)
Sequential Decision Making
How to make an optimal decision?
"Planning"
Requires model $P(r, s'| s, a)$
\[ \max_a \]
This is: finite horizon, finite action, finite reward case
General case: Fixed point equations:
\[ V(s) = \sup_a Q(s, a) \quad Q(s, a) = E_{r, s'| s, a} [r + \gamma V(s')] \]
Reinforcement Learning
Do not have model $P(r, s' | s, a)$
Reinforcement Learning
Cannot Compute $E_{r,s'|s,a}$
Do not have model $P(r,s'|s,a)$
Reinforcement Learning
Standard approach: keep point estimate
e.g. via local Q-value estimates
Do not have model $P(r,s'|s,a)$
How to select action?
Greedy
Problem: greedy does not explore
Reinforcement Learning
How to explore?
Problem: do not account for uncertainty in estimates
Reinforcement Learning
Intuition:
greater uncertainty → greater potential
Interval estimation
How to use uncertainty?
Problem: $\delta$’s computed myopically: doesn’t consider horizon
Bayesian Reinforcement Learning
Prior $P(\theta)$ on model $P(r,s'|sa, \theta)$
Belief state $b = P(\theta)$
meta-level state
Choose action to maximize long term reward
Meta-level MDP
decision
a
outcome
Meta-level Model
$r, s', b'$
$P(r,s'b'|s b,a)$
decision
$a'$
outcome
Meta-level Model
$r', s'', b''$
$P(r',s''b''|s' b',a')$
Have a model for meta-level transitions!
- based on posterior update and expectations over base-level MDPs
Bayesian RL Decision Making
How to make an optimal decision?
Solve planning problem in meta-level MDP:
- Optimal Q,V values
Problem: meta-level MDP much larger than base-level MDP
Impractical
Bayesian RL Decision Making
Current approximation strategies:
Consider current belief state $b$
Greedy approach:
- Draw a base-level MDP
- $b \rightarrow \text{mean base-level MDP model}$
- $\rightarrow \text{point estimate for } Q, V$
- $\rightarrow \text{choose greedy action}$
But doesn’t consider uncertainty
Bayesian RL Decision Making
Current approximation strategies:
Consider current belief state \( b \)
Draw a base-level MDP
Thompson approach:
current \( b \) $\rightarrow$ sample a base-level MDP model
$\rightarrow$ point estimate for \( Q, V \)
(Choose action proportional to probability it is max \( Q \))
Exploration is based on uncertainty
But still myopic
Part 1
Bayesian Sparse Sampling
Bayesian Sparse Sampling for On-line Reward Optimization
Tao Wang Daniel Lizotte Michael Bowling Dale Schuurmans
ICML 2005
Sparse Sampling
(Kearns, Mansour, Ng 2001)
- Approximate values
- Enumerate action choices
- Subsample action outcomes
- Bound depth
- Back up approx values
+ Chooses approximately optimal action with high probability (if depth, sampling large enough)
- Achieving guarantees too expensive
+ But can control depth, sampling
Bayesian Sparse Sampling
Observation 1
• Do not need to enumerate actions in a Bayesian setting
– Given random variables $Q_1, \ldots, Q_K$
– and a prior $P(Q_1, \ldots, Q_K)$
– Can approximate $\max(Q_1, \ldots, Q_K)$
– Without observing every variable
(Stop when posterior probability of a significantly better Q-value is small)
Bayesian Sparse Sampling
Observation 2
- Action value estimates are not equally important
- Need better Q value estimates for some actions but not all
- Preferentially expand tree under actions that might be optimal
**Biased tree growth**
Use Thompson sampling to select actions to expand
Bayesian Sparse Sampling
Observation 3
Correct leaf value estimates to same depth
Use mean MDP Q-value multiplied by remaining depth
effective horizon N=3
Bayesian Sparse Sampling
Observation 4
Include greedy action at decision nodes (if not sampled)
Bayesian Sparse Sampling
Tree growing procedure
1. Sample prior for a model
2. Solve action values
3. Select the optimal action
- Descend sparse tree from root
- Thompson sample actions
- Sample outcome
- Until new node added
- Repeat until tree size limit reached
Control computation by controlling tree size
Application: Gaussian process bandits
- General action spaces
- Continuous actions, multidimensional actions
- Gaussian process prior over reward models
- Covariance kernel between actions
- Action rewards correlated
- Posterior is a Gaussian process
Robotic application: AIBO walking
Gaussian process experiments
- 2 dimensional continuous action space
- GP priors RBF kernel
- Sampled model from prior
- Run action selection strategies
- Repeat 3000 times
- Average accumulated reward per step
2-dimensional Continuous Gaussian Process
Average Reward per Step vs. Horizon
- eps-Greedy
- Boltzmann
- Interval Est.
- Thompson
- MVPI
2-dimensional Continuous Gaussian Process
Average Reward per Step
Horizon
eps-Greedy
Boltzmann
Interval Est.
Thompson
MVPI
Sparse Samp.
Bayes Samp.
Summary
Bayesian sparse sampling
• Flexible and practical technique for improving action selection
• Reasonably straightforward
• Bandit problems
– Planning is “easy”
(at least approximate planning is “easy”)
Question:
How to approximate leaf values?
:\hat{Q}
\hat{V}
Part 2
Approximate value function
Compact, Convex Upper Bound Iteration for Approximate POMDP Planning
Tao Wang Pascal Poupart Michael Bowling Dale Schuurmans
AAAI2006
POMDP model
Observation function
\[ p(o' \mid a, s') \]
Transition function
\[ p(s' \mid s, a) \]
Reward function
\[ R(s, a) = r_0 + \gamma r_1 + \gamma^2 r_2 + \cdots + \gamma^t r_t \]
Goal: choose actions to maximize long term reward
Belief state
- Probability distribution over underlying states
\[ b = \begin{bmatrix} p(s^1) \\ p(s^2) \\ \vdots \\ p(s^{|S|}) \end{bmatrix} \]
- Sufficient summary of history for decision making
\[ b(\bar{s}_t) = p(\bar{s}_t | b_0 a_1 o_1 a_2 o_2 \cdots a_t o_t) \]
POMDP solving
- Value function is expected total discounted future reward starting from each belief state
Optimal Value function
\[ V^*(b) = \max_a r(b, a) + \gamma \sum_{b'} p(b' | b, a) V^*(b') \]
- Hard to approximate
POMDP approximation approaches
• Value function approximation (Part 2)
– Hauskrecht 2000
– Spaan&Vlassis 2005
– Pineau et al. 2003
– Parr&Russell 1995
• Policy based optimization
– Ng&Jordan 00; Poupart & Boutilier 03,04; Amato et al. 06
• Stochastic sampling (Part 1)
– Kearns et al. 02; Thrun 00
Value function based approaches
- **Optimal value function**
(satisfies Bellman equation)
\[
V^*(b) = \max_a r(b, a) + \gamma \sum_{b'} p(b'|b, a)V^*(b')
\]
\[
= \max_a r(b, a) + \gamma \sum_{o'} p(o'|b, a)V^*(b'_{(b,a,o')})
\]
- **Difficulty:** belief space is continuous & high dimensional
Optimal 1-step decision
\[ V_1(b) = \max_a b \cdot r_a \]
\[ \Gamma_1 = \{ r_{a_1}, r_{a_2}, r_{a_3} \} = \{ \alpha_1, \alpha_2, \alpha_3 \} \]
Optimal value function is \textcolor{red}{\textbf{piecewise linear convex}}
Optimal n+1-step decision
Value function representation
\[ V_n(b) = \max_{\alpha_{\pi'} \in \Gamma_n} b \cdot \alpha_{\pi'} \]
\[
\begin{bmatrix}
p(s_1) \\
p(s_2) \\
\vdots \\
p(s_{|s|})
\end{bmatrix}
\]
\[
\begin{bmatrix}
v_{\pi'}(s_1) \\
v_{\pi'}(s_2) \\
\vdots \\
v_{\pi'}(s_{|s|})
\end{bmatrix}
\]
\[ \Gamma_n = \{ \alpha_{\pi'} : \pi' \in \Pi_n \} \]
Value function iteration
\[ V_{n+1}(b) = \max_a r(b, a) + \gamma \sum_{o'} p(o' | b, a) V_n\left(b'_{(b, a, o')}\right) \]
\[ = \max_{a, \{o' \rightarrow \pi'\}} b \cdot \alpha_{a, \{o' \rightarrow \pi'\}} \]
Current approximation strategies
• Grid based approach
– Gorden 95
– Hauskrecht 00
– Zhou & Hansen 01
– Bonet 02
• Belief point approach
– Pineau et al. 03
– Smith & Simmons 05
– Spaan & Vlassis 05
value function representation
\(\alpha\)-vectors
Our idea
Approximate $V^*(b)$ with a **convex quadratic** upper bound
- Maintain compact (bounded size) representation of value approximation
- Can still model multiple $\alpha$-vectors
- Can be optimized easily
Quadratic approximation
Value function representation
\[ \hat{V}(b) = b^\top W b + w^\top b + \omega \]
Would like to enforce
\[ \hat{V}_{n+1}(b) \geq \max_a \hat{q}_a(b) \]
Need action-value backup for each action
\[ \hat{q}_a(b) = r(b, a) + \gamma \sum_{o'} p(o' | b, a) \hat{V}_n(b'_{(b,a,o')}) \]
Quadratic approximation
Combine with belief update
\[ b'_{(b,a,o')} = \frac{M_{a,o'}b}{e^\top M_{a,o'}b} \]
\[ M_{a,o'}(s', s) = p(o'|a, s')p(s'|s, a) \]
Get action-value
\[ q_a(b) = r(b, a) + \gamma \sum_{o'} \frac{b^\top M_{a,o'}^\top W M_{a,o'}b}{e^\top M_{a,o'}b} + (w + \omega e)^\top M_{a,o'}b \]
**Theorem 1** \( q_a(b) \) is convex in \( b \).
**Corollary 1** \( \max_a q_a(b) \) is convex in \( b \).
Algorithm
\[ \hat{V}_n \quad \hat{q}_a(b) \quad \max_a \hat{q}_a(b) \quad \hat{V}_{n+1} \]
Maintain tight upper bound of the maximum of the action-values
Mathematically
Optimization problem
$$\min_{W,w,\omega} \int_b \left( b^\top W b + w^\top b + \omega \right) \mu(b) \, db$$
subject to
$$b^\top W b + w^\top b + \omega \geq q_a(b), \quad \forall \, a, b$$
$$W \succeq 0 \quad \text{(positive semi-definite)}$$
a measure over space of possible beliefs
ensure upper bound
ensure convexity
Two difficulties
- Integral in objective
- Infinite number of linear constraints
But it is a convex optimization problem (SDP plus infinitely many linear constraints)
Integral
Objective
\[ \int_b (b^T W b + w^T b + \omega) \mu(b) db \]
is equal to
\[ \langle W, E[bb^T] \rangle + w^T E[b] + \omega \] \hspace{1cm} \text{(linear)}
Assume measure \( \mu(b) \) is Dirichlet distribution on \( b \)
then \( E[bb^T] \) and \( E[b] \) have \textbf{closed form}
Infinite constraints
Have $b^\top W b + w^\top b + \omega \geq q_a(b), \quad \forall \ a, \ b$
ininitely many linear constraints on $Ww\omega$
**Optimal constraint generation:** most violated constraint
$$\min_b b^\top W b + w^\top b + \omega - q_a(b)$$
subject to $b \geq 0$, $\sum_s b(s) = 1$
*Unfortunately, not necessarily a convex minimization problem in $b$*
Experimental results
- Benchmark problems
- Mean discounted reward & Run time
- 10 runs
- 1000 trajectories
- Competitors
- Perseus (Pineau et al. 2003)
- PBVI (Spaan & Vlassis 2005)
## Problem characteristics
| Problems | $|S|$ | $|A|$ | $|O|$ |
|--------------|-----|-----|-----|
| Maze | 20 | 6 | 8 |
| Tiger-grid | 33 | 5 | 17 |
| Hallway | 57 | 5 | 21 |
| Hallway2 | 89 | 5 | 17 |
| Aircraft | 100 | 10 | 31 |
Mean discounted reward
<table>
<thead>
<tr>
<th>Avg. Reward</th>
<th>CQUB</th>
<th>Perseus</th>
<th>PBVI</th>
</tr>
</thead>
<tbody>
<tr>
<td>Hallway</td>
<td>0.58 ±0.14</td>
<td>0.51 ±0.06</td>
<td>0.53 ±0.03</td>
</tr>
<tr>
<td>Hallway2</td>
<td>0.43 ±0.25</td>
<td>0.34 ±0.16</td>
<td>0.35 ±0.03</td>
</tr>
<tr>
<td>Tiger-grid</td>
<td>2.16 ±0.02</td>
<td>2.34 ±0.02</td>
<td>2.25 ±0.06</td>
</tr>
<tr>
<td>Maze</td>
<td>45.35 ±3.28</td>
<td>30.49 ±0.75</td>
<td>46.70 ±2.00</td>
</tr>
<tr>
<td>Aircraft</td>
<td>16.70 ±0.58</td>
<td>12.73 ±4.63</td>
<td>16.37 ±0.42</td>
</tr>
</tbody>
</table>
Compact representation
<table>
<thead>
<tr>
<th>Size</th>
<th>CQUB</th>
<th>Perseus</th>
<th>PBVI</th>
</tr>
</thead>
<tbody>
<tr>
<td>Maze</td>
<td>231</td>
<td>460</td>
<td>1160</td>
</tr>
<tr>
<td>Tiger-grid</td>
<td>595</td>
<td>4422</td>
<td>15510</td>
</tr>
<tr>
<td>Hallway</td>
<td>1711</td>
<td>3135</td>
<td>4902</td>
</tr>
<tr>
<td>Hallway2</td>
<td>4095</td>
<td>4984</td>
<td>8455</td>
</tr>
<tr>
<td>Aircraft</td>
<td>5151</td>
<td>10665</td>
<td>47000</td>
</tr>
</tbody>
</table>
Summary
New approximation algorithm
- Quadratic value function approximator
- Compact representation
- Competitive approximation quality
- Provable upper bound on the optimal values
- Computational cost independent of iteration number
Contributions
• Use game-tree search ideas
✓ Bayesian sparse sampling
✓ Approximate POMDP planning
➢ To combine them to solve meta-level MDPs
• Exploit Bayesian modelling tools
– E.g. Gaussian processes
– Robotic & game applications
Future work on Bayesian sparse sampling
AIBO dog walking
Opponent modeling (Kuhn poker)
Vendor-bot (Pioneer)
Improve tree search?
Theoretical guarantees?
Cheaper re-planning?
Future work on approximate planning
• Set of quadratics
• Use belief state compression & factored models
• Combine with sampling
• Interpretation: $2^{nd}$ order Taylor expansion
Research questions
• How to choose actions during reinforcement learning?
• How to scale up solutions for realistic RL problems?
• How to combine Part 1 and Part 2?
– Challenge: infinite dimensionality
– Scale up Part 2 (run time)
Acknowledgments
Dale Schuurmans
Mike Bowling
Rich Sutton
Paul Messinger
Robert Holte
Pascal Poupart
Daniel Lizotte
Adam Milstein
|
{"Source-Url": "http://users.cecs.anu.edu.au/~twang/papers/DC06-AAAI_print.pdf", "len_cl100k_base": 4142, "olmocr-version": "0.1.49", "pdf-total-pages": 54, "total-fallback-pages": 0, "total-input-tokens": 77181, "total-output-tokens": 6157, "length": "2e12", "weborganizer": {"__label__adult": 0.00075531005859375, "__label__art_design": 0.0006594657897949219, "__label__crime_law": 0.0012569427490234375, "__label__education_jobs": 0.001987457275390625, "__label__entertainment": 0.0002753734588623047, "__label__fashion_beauty": 0.0004069805145263672, "__label__finance_business": 0.0007634162902832031, "__label__food_dining": 0.0008707046508789062, "__label__games": 0.010223388671875, "__label__hardware": 0.0021190643310546875, "__label__health": 0.0019588470458984375, "__label__history": 0.0007839202880859375, "__label__home_hobbies": 0.0003612041473388672, "__label__industrial": 0.0014829635620117188, "__label__literature": 0.0006594657897949219, "__label__politics": 0.0006122589111328125, "__label__religion": 0.0008130073547363281, "__label__science_tech": 0.458740234375, "__label__social_life": 0.00021529197692871096, "__label__software": 0.007801055908203125, "__label__software_dev": 0.50390625, "__label__sports_fitness": 0.0015249252319335938, "__label__transportation": 0.0015497207641601562, "__label__travel": 0.0004584789276123047}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 12891, 0.02577]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 12891, 0.2807]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 12891, 0.64785]], "google_gemma-3-12b-it_contains_pii": [[0, 62, false], [62, 266, null], [266, 590, null], [590, 888, null], [888, 948, null], [948, 1035, null], [1035, 1229, null], [1229, 1323, null], [1323, 1511, null], [1511, 1965, null], [1965, 2160, null], [2160, 2478, null], [2478, 2847, null], [2847, 3012, null], [3012, 3340, null], [3340, 3681, null], [3681, 3976, null], [3976, 4134, null], [4134, 4231, null], [4231, 4549, null], [4549, 4840, null], [4840, 5052, null], [5052, 5191, null], [5191, 5342, null], [5342, 5561, null], [5561, 5621, null], [5621, 5793, null], [5793, 6033, null], [6033, 6304, null], [6304, 6529, null], [6529, 6842, null], [6842, 7140, null], [7140, 7363, null], [7363, 7952, null], [7952, 8216, null], [8216, 8430, null], [8430, 8734, null], [8734, 9151, null], [9151, 9307, null], [9307, 9651, null], [9651, 9820, null], [9820, 10115, null], [10115, 10486, null], [10486, 10678, null], [10678, 10957, null], [10957, 11358, null], [11358, 11683, null], [11683, 11920, null], [11920, 12165, null], [12165, 12165, null], [12165, 12342, null], [12342, 12522, null], [12522, 12760, null], [12760, 12891, null]], "google_gemma-3-12b-it_is_public_document": [[0, 62, true], [62, 266, null], [266, 590, null], [590, 888, null], [888, 948, null], [948, 1035, null], [1035, 1229, null], [1229, 1323, null], [1323, 1511, null], [1511, 1965, null], [1965, 2160, null], [2160, 2478, null], [2478, 2847, null], [2847, 3012, null], [3012, 3340, null], [3340, 3681, null], [3681, 3976, null], [3976, 4134, null], [4134, 4231, null], [4231, 4549, null], [4549, 4840, null], [4840, 5052, null], [5052, 5191, null], [5191, 5342, null], [5342, 5561, null], [5561, 5621, null], [5621, 5793, null], [5793, 6033, null], [6033, 6304, null], [6304, 6529, null], [6529, 6842, null], [6842, 7140, null], [7140, 7363, null], [7363, 7952, null], [7952, 8216, null], [8216, 8430, null], [8430, 8734, null], [8734, 9151, null], [9151, 9307, null], [9307, 9651, null], [9651, 9820, null], [9820, 10115, null], [10115, 10486, null], [10486, 10678, null], [10678, 10957, null], [10957, 11358, null], [11358, 11683, null], [11683, 11920, null], [11920, 12165, null], [12165, 12165, null], [12165, 12342, null], [12342, 12522, null], [12522, 12760, null], [12760, 12891, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 12891, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 12891, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 12891, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 12891, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 12891, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 12891, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 12891, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 12891, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 12891, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 12891, null]], "pdf_page_numbers": [[0, 62, 1], [62, 266, 2], [266, 590, 3], [590, 888, 4], [888, 948, 5], [948, 1035, 6], [1035, 1229, 7], [1229, 1323, 8], [1323, 1511, 9], [1511, 1965, 10], [1965, 2160, 11], [2160, 2478, 12], [2478, 2847, 13], [2847, 3012, 14], [3012, 3340, 15], [3340, 3681, 16], [3681, 3976, 17], [3976, 4134, 18], [4134, 4231, 19], [4231, 4549, 20], [4549, 4840, 21], [4840, 5052, 22], [5052, 5191, 23], [5191, 5342, 24], [5342, 5561, 25], [5561, 5621, 26], [5621, 5793, 27], [5793, 6033, 28], [6033, 6304, 29], [6304, 6529, 30], [6529, 6842, 31], [6842, 7140, 32], [7140, 7363, 33], [7363, 7952, 34], [7952, 8216, 35], [8216, 8430, 36], [8430, 8734, 37], [8734, 9151, 38], [9151, 9307, 39], [9307, 9651, 40], [9651, 9820, 41], [9820, 10115, 42], [10115, 10486, 43], [10486, 10678, 44], [10678, 10957, 45], [10957, 11358, 46], [11358, 11683, 47], [11683, 11920, 48], [11920, 12165, 49], [12165, 12165, 50], [12165, 12342, 51], [12342, 12522, 52], [12522, 12760, 53], [12760, 12891, 54]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 12891, 0.05412]]}
|
olmocr_science_pdfs
|
2024-11-25
|
2024-11-25
|
36f7320f56798f641b7d2e1ff4b0ba90d73bdfe9
|
[REMOVED]
|
{"Source-Url": "https://cdn.uclouvain.be/public/Exports%20reddot/iag/documents/WP_60_bouillon.pdf", "len_cl100k_base": 4352, "olmocr-version": "0.1.50", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 21964, "total-output-tokens": 6695, "length": "2e12", "weborganizer": {"__label__adult": 0.00027108192443847656, "__label__art_design": 0.0008263587951660156, "__label__crime_law": 0.0002065896987915039, "__label__education_jobs": 0.0006685256958007812, "__label__entertainment": 5.984306335449219e-05, "__label__fashion_beauty": 0.00012683868408203125, "__label__finance_business": 0.00012886524200439453, "__label__food_dining": 0.00019657611846923828, "__label__games": 0.00036978721618652344, "__label__hardware": 0.0006685256958007812, "__label__health": 0.00023567676544189453, "__label__history": 0.00019049644470214844, "__label__home_hobbies": 5.4895877838134766e-05, "__label__industrial": 0.00022590160369873047, "__label__literature": 0.0002256631851196289, "__label__politics": 0.00011742115020751952, "__label__religion": 0.0003037452697753906, "__label__science_tech": 0.01092529296875, "__label__social_life": 5.3048133850097656e-05, "__label__software": 0.01154327392578125, "__label__software_dev": 0.97216796875, "__label__sports_fitness": 0.0001544952392578125, "__label__transportation": 0.0002617835998535156, "__label__travel": 0.00013458728790283203}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26808, 0.03316]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26808, 0.51162]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26808, 0.86163]], "google_gemma-3-12b-it_contains_pii": [[0, 1465, false], [1465, 4761, null], [4761, 8033, null], [8033, 10311, null], [10311, 12836, null], [12836, 16590, null], [16590, 18766, null], [18766, 22485, null], [22485, 26808, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1465, true], [1465, 4761, null], [4761, 8033, null], [8033, 10311, null], [10311, 12836, null], [12836, 16590, null], [16590, 18766, null], [18766, 22485, null], [22485, 26808, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26808, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26808, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26808, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26808, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26808, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26808, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26808, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26808, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26808, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26808, null]], "pdf_page_numbers": [[0, 1465, 1], [1465, 4761, 2], [4761, 8033, 3], [8033, 10311, 4], [10311, 12836, 5], [12836, 16590, 6], [16590, 18766, 7], [18766, 22485, 8], [22485, 26808, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26808, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-01
|
2024-12-01
|
ff5d091479e76cecd81f506f9bf53ab2f71773be
|
ADAPTING to Agile
Mike Cohn
mike@mountaingoatsoftware.com
June 7, 2010
Mike Cohn
- Founding member and director of Agile Alliance and Scrum Alliance
- Founder of Mountain Goat Software
- Doing Scrum since 1995
- Started my career as a programmer
Agenda
- Why transitioning to agile is hard
- ADAPTing to agile development
- Iterating toward agility
- The role of leadership
- Overcoming resistance
Change is not top-down or bottom-up; it’s both
- Two simplistic views of change:
- Top down: Powerful leader shares a vision
- Bottom-up: A team starts and everyone else sees the benefits of the new approach
- But, transitioning to agile is neither top-down nor bottom-up
- It’s both at the same time
Best practices are tempting
- It is tempting to codify things that work in a given context into best practices
- This leads to inflexible processes‡
- Once we know what’s “best” we stop adapting
- Or even thinking about what we’re doing
- Once we’ve stopped inspecting and adapting we’re not agile, or won’t be for long
‡Anderson, P. “Seven Layers for Guiding the Evolving Enterprise” in The Biology of Business.
The transition process must be congruent with the development process
Part of the move to agile is a move to self-organizing teams
Moving to self-organization requires self-organization!
4
Organizations are unpredictable, living systems
- Traditional view of the organization is as a machine
- We can dissemble it, study its part, put it back together
- Once we set it in motion, it will continue in motion
A flawed view of organizational change
We need a different mental model
The organization as a **Complex Adaptive System** (CAS)
- A dynamic network of many agents
- acting in parallel
- acting and reacting to what other agents are doing
- Control is highly dispersed and decentralized
- Overall system behavior is the result of a huge number of decisions made constantly by many agents
John Holland in *Complexity: The Emerging Science at the Edge of Order and Chaos* by Mitchell Waldrop
Local goals and gaps
Local agents (individuals, project teams, discipline coworkers) identify local gaps based on their goals
Vision
Differing views of success
**Newtonian View of Success**
Closing the gap with the desired state
**CAS View of Success**
Achieving a good fit with the environment
---
- Each paired statement below and on the next slide describes either the traditional or CAS view of how to change an organization
- Put an X in the appropriate column to indicate which describes the traditional view and which the CAS view
<table>
<thead>
<tr>
<th></th>
<th>Traditional view</th>
<th>CAS view</th>
</tr>
</thead>
<tbody>
<tr>
<td>Behavior is predictable and controllable</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Behavior is unpredictable and uncontrollable</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Direction is determined through emergence and by many people</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Direction is determined by a few leaders.</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Every effect is also a cause</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Every effect has a cause</td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>Traditional view</td>
<td>CAS view</td>
</tr>
<tr>
<td>-------------------------------</td>
<td>------------------</td>
<td>----------</td>
</tr>
<tr>
<td>Relationships are directive</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Relationships are empowering</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Responsiveness to the environment is the measure of value</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Efficiency and reliability are measures of value</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Decisions are based on facts and data</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Decisions are based on patterns and tensions</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Leaders are experts and authorities</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Leaders are facilitators and supporters</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
**Agenda**
- Why transitioning to agile is hard
- ADAPTing to agile development
- Iterating toward agility
- The role of leadership
- Overcoming resistance
"I’m the ScrumMaster and ..."
...the developers are not meeting expectations for code quality.
One of our challenges is that we’re still hacking our way through lots of legacy code that isn’t unit-testable or automated yet. This code is mission-critical and the person who has been working mostly on that area of code consistently leaves holes in the design and implementation of new pieces of that code.
We also have the issue with at least one other developer as well.
?
1. Is this a problem of Awareness, Desire or Ability?
• Why?
2. Thinking about ADAPT, what might you try?
Individual and group change
- All individuals will need to move through the Awareness, Desire, and Ability stage
- But will do so at different rates
- Early adapters and leaders:
- Use the Promote stage to build Awareness and Desire in later adopters
- Need to Transfer the impact of agile to groups like Human Resources or the transition will fail
Tools for building...
**Awareness**
- Communicate that there’s a problem
- Use metrics
- Provide exposure to new people and experiences
- Focus attention on the most important reason or two for changing
On the following slides, identify at least five ways to build desire, create ability, promote the transition, and transfer its implications.
Stop!
My thoughts on desire, ability, transfer and promote are on the following pages. You don’t want to see them before you think about your own.
Tools for building...
Desire
- Communicate that there’s a better way
- Create a sense of urgency
- Build momentum
- Get the team to take agile for a test drive
- Align incentives (or, at least, remove disincentives)
- Focus on addressing any fears
- Help people let go
- Don’t discredit the past
- Engage everyone in the transition
Ability
- Provide coaching and training
- Hold individuals accountable
- Share information
- Set reasonable targets
- Just do it
Promote
- Publicize success stories
- Host an agile safari
- Attract attention
Transfer
• Transfer the effects of agile beyond the current group
• A team transfers to its department
• A department transfers to its division
• etc.
• If you don’t transfer, the transition will eventually and inevitably fail
• Too much organizational gravity pulling us back toward the status quo
• Example:
• If you don’t align promotions, raises, annual reviews, those will work against you
Agenda
- Why transitioning to agile is hard
- ADAPTing to agile development
- Iterating toward agility
- The role of leadership
- Overcoming resistance
Iterating toward agility
Enterprise Transition Community (ETC)
- Creates a culture in which passion and desire to improve thrive
- Does not direct the transition effort
- Provides energy, resources, support and guidance
- Removes organizational impediments to agility
- Encourages Improvement Communities to form
ETC members
- Sponsor
- From highest level at which change is supported
- Not a checkbook-only commitment
- Others
- From any level but driven by desire to improve
- Disbands when the “transition” part of adopting agile is over
ETC responsibilities
- Articulate the reasons for adopting agile
- Stimulate conversation
- Provide resources
- Engage everyone
- Set appropriate aspirations
- Anticipate and address people issues and other impediments
- Encourage simultaneous focus on practices and principles
An ETC’s improvement backlog
<table>
<thead>
<tr>
<th>Item</th>
<th>Who</th>
<th>Note</th>
</tr>
</thead>
<tbody>
<tr>
<td>Create an “Agile Office” where teams can get help.</td>
<td>Jim (CTO)</td>
<td>talk this up at monthly development meeting. Let’s see if there’s any interest.</td>
</tr>
<tr>
<td>Establish an internal program for developing ScrumMasters.</td>
<td></td>
<td>How do we identify good internal candidates? How do we develop them?</td>
</tr>
<tr>
<td>Collect and disseminate Scrum success stories in our company.</td>
<td>SC</td>
<td>Savannah has expressed interest in this.</td>
</tr>
<tr>
<td>Resolve dispute with facilities over rearranging second floor cubicles.</td>
<td>JS</td>
<td>Jim to talk to Ursula in facilities</td>
</tr>
<tr>
<td>Get more teams to do continuous integration.</td>
<td>AR</td>
<td>Arie will summarize metrics from his project and see how many teams he can motivate.</td>
</tr>
</tbody>
</table>
Improvement communities (ICs)
- Form around the passion of a small number of people
- Expand from there
- Do the real work of improving how the organization implements agile
- Focus on goals with practical relevance
- Examples:
- ScrumMaster, Testing, Product Owner, Continuous Integration
Working with an IC
- An IC works with a project team
- Work is not done in an ivory tower
- Most ICs work in 2–4-week iterations
- Disband or refocus when goal has been achieved
ETC Improvement
Backlog
…
Establish an internal program for developing ScrumMasters.
…
An IC Improvement Backlog
Figure out how to identify good candidates to become ScrumMasters (in addition to those who ask to participate in this program).
Establish an internal mentoring program.
Develop some internal classroom training. Which courses? Who can teach them? Can we license courses?
Get budget for next year for external coaching. How many days? At what expected daily rate?
Not everything on an IC’s improvement backlog needs to tie back to the ETC’s backlog.
Improvement backlogs
1. Write some items that you would like an on your organization’s initial improvement backlogs.
2. What improvement communities would you like to see form that could help with some of these improvements?
3. What obstacles are in the way of making these improvements?
4. What obstacles are in the way of forming an ETC or improvement community to get started?
Agenda
- Why transitioning to agile is hard
- ADAPTing to agile development
- Iterating toward agility
- The role of leadership
- Overcoming resistance
Leading an agile transition
- Transition team and other formal leaders must lead the transition
- but cannot do so in the usual ways
- Self-organizing groups still require leadership
- Lead through example, questions, and focus
- “Nudge” the organization; Poke and prod;
- See how the organization responds
Container
- A boundary within which self-organization occurs
- Company, project, team, city, role, nationality
Differences
- There must be differences among the agents acting in our system
- Technical knowledge, domain knowledge, education, experience, power, gender
Transforming Exchanges
- Agents in the system interact and exchange resources
- Information, money, energy (vision)
Using the CDE model
- You can influence how a team self-organizes by altering the:
- **Containers**
- formal teams, informal teams, clarify (or not) expectations
- **Differences**
- Dampen or amplify them within or between containers
- **Exchanges**
- Insert new exchanges, new people, new techniques or tools
Containers
- Enlarge or shrink teams
- Enlarge or shrink the responsibility boundary of teams
- Change team membership
- Create new teams or groups
Differences
- Don’t require consensus
- Creativity comes from tension
- Quiet disagreement is not as good as fierce debate that leads to behavior change
- Ask hard questions
- Then expect teams to find solutions
Transforming exchanges
- Encourage communication between teams and groups
- Who isn’t talking who should?
- Add or remove people from exchanges
- Change reporting relationships
- Relocate people
- Compliance with external groups
- Encourage learning
You are the ScrumMaster or coach...
- The next slides describes some teams with some trouble spots. Think about how you might help them by changing their Cotrainers, amplifying or dampening Differences, or changing their Exchanges.
- For each case, identify at least one thing you’d do.
- Note whether you are tweaking their Container, Differences, or Exchanges. (You might be affecting more than one.)
---
1. The team consists of four developers, two testers, a database engineer and you. The developers and testers are not working well together. Developers work in isolation until two days are left in the iteration. They then throw code “over the wall” to the testers.
2. The team is failing to deliver potentially shippable software at the end of each iteration. None of the items they start are 100% finished. They’re close but work is always left to be done in the next iteration.
3. The team seems to be consistently undercommitting during iteration planning. They finish the work they commit but it doesn’t seem like much. The product owner hasn’t complained yet but you’re worried she will soon.
4. Your organization has 20 different agile teams. Each team has its own testers who are starting to go in different directions in terms of preferred tools and approaches.
5. Jeff, a senior developer, is very domineering. During iteration planning the team defers to him on every decision even though he is a horrible estimator. You notice glances that other team members exchange when he suggest very low estimates on some tasks.
6. You are responsible for two teams. Team members on one discuss all sides of various issues before making a decision. This has been working well. On the other team, discussions drag on endlessly because they pursue absolute consensus in all cases.
Self-organization is not something that happens one time
- A team is never done doing it
- The team continually re-organizes in a sense-and-respond manner to its environment
- As you see the team self-organize you can influence, but not control or direct, its path
- We can view this as the evolution of a team
Self-organization proceeds from the premise that effective organization is evolved, not designed. It aims to create an environment in which successful divisions of labor and routines not only emerge but also self-adjust in response to environmental changes. This happens because management sets up an environment and encourages rapid evolution toward higher fitness, not because management has mastered the art of planning and monitoring workflows.
~Philip Anderson
†Anderson, P. “Seven Layers for Guiding the Evolving Enterprise” in The Biology of Business.
Variation, selection & retention
- Evolution is the result of three elements:
- Variation, selection and retention
- Consider a giraffe:
- **Variation**: A random mutation that leads to a longer neck
- **Selection**: The long neck helps it reach food others can’t; so it it more likely to survive and breed
- **Retention**: The mutation is passed to its descendants
Three ways to influence team evolution
1. Define performance
2. Manage meaning
3. Evolve vicarious selection systems
Define performance
- The principle of selection tells us that the traits that help us survive will be the ones retained
- Managers and leaders send messages about which traits should survive
- What message is your organization sending about the relative importance of short vs. long-term performance?
- What messages are sent if the organization:
- Provides training
- Supports working at a sustainable pace
- Allows employees time to explore wild ideas
- Doesn’t exchange meeting a deadline for unmaintainable code
Manage meaning
- Individuals in a CAS respond to the messages they receive; e.g.,
- bees responding to a “danger” message
- ants responding to a “food found over here” message
- Leaders can push messages into the system
- e.g., putting the the team in touch with customers
- Or keep messages out
- Meaning often comes from the stories, myths and rituals that are repeated
- “We will become profitable this quarter.”
- “Our GM counts the cars in the lot every day at 5 PM”
3 Evolve vicarious selection systems
- Variation—Selection—Retention
- Selection was determining which variations will be retained
- Can take a long time
- So we often use vicarious selection systems
- This is an animal that can smell that a food is poisonous, rather than eating it
- Using only the marketplace as our selection mechanism takes too long
- Organizations also evolve vicarious selection systems
- Retrospectives, Google’s 20% policy, improvement communities
Agenda
- Why transitioning to agile is hard
- ADAP Ting to agile development
- Iterating toward agility
- The role of leadership
- Overcoming resistance
### Handling resistance
- Pick one type of resistor. (Or two if you have time.)
- Identify some underlying reasons for the behavior and some things you could try to overcome it.

Why They Resist
Like status quo Dislike agile
Why They Resist
Passive Active
Diehard Saboteur
Skeptic Follower
Skeptics
- Let time run its course
- Provide training
- Solicit peer anecdotes
- Appoint a champion skeptic
- Push the issue
- Build awareness
Saboteurs
- Success
- Reiterate and reinforce the commitment
- Move them
- Fire them
- Encourage a thriving set of communities
Why They Resist
Like status quo Dislike agile
Passive Active
Diehard Saboteur
Follower Skeptic
Diehards
- Align incentives
- Create dissatisfaction with the status quo
- Acknowledge and confront fear
Followers
- Change team composition
- Praise the right behavior
- Model the right behavior
- Involve them
- Identify the true barrier (awareness, desire, ability)
### Upcoming public classes
<table>
<thead>
<tr>
<th>Date</th>
<th>What</th>
<th>Where</th>
</tr>
</thead>
<tbody>
<tr>
<td>July 19–20</td>
<td>Certified ScrumMaster</td>
<td>Orlando</td>
</tr>
<tr>
<td>July 21–22</td>
<td>Certified Scrum Product Owner</td>
<td></td>
</tr>
<tr>
<td>August 23–24</td>
<td>Certified ScrumMaster</td>
<td>Dallas</td>
</tr>
<tr>
<td>August 25–26</td>
<td>Succeeding with Agile</td>
<td></td>
</tr>
<tr>
<td>September 13–14</td>
<td>Certified ScrumMaster</td>
<td>Cupertino</td>
</tr>
<tr>
<td>September 15–16</td>
<td>Certified Scrum Product Owner</td>
<td></td>
</tr>
<tr>
<td>October 11</td>
<td>User Stories for Agile Requirements</td>
<td>Boulder</td>
</tr>
<tr>
<td>October 12–13</td>
<td>Certified ScrumMaster</td>
<td></td>
</tr>
<tr>
<td>October 14</td>
<td>Agile Estimating & Planning</td>
<td></td>
</tr>
<tr>
<td>November 8–9</td>
<td>Certified ScrumMaster</td>
<td>San Diego</td>
</tr>
<tr>
<td>November 10–11</td>
<td>Succeeding with Agile</td>
<td></td>
</tr>
</tbody>
</table>
See [mountaingoatsoftware.com](http://mountaingoatsoftware.com) for details.
|
{"Source-Url": "https://www.mountaingoatsoftware.com/uploads/presentations/ADAPTing-Agile-Agile-Development-Practices-2010.pdf", "len_cl100k_base": 4426, "olmocr-version": "0.1.48", "pdf-total-pages": 31, "total-fallback-pages": 0, "total-input-tokens": 46927, "total-output-tokens": 5184, "length": "2e12", "weborganizer": {"__label__adult": 0.0005288124084472656, "__label__art_design": 0.0005388259887695312, "__label__crime_law": 0.0004265308380126953, "__label__education_jobs": 0.0208740234375, "__label__entertainment": 7.987022399902344e-05, "__label__fashion_beauty": 0.00024306774139404297, "__label__finance_business": 0.0033893585205078125, "__label__food_dining": 0.0005960464477539062, "__label__games": 0.0007410049438476562, "__label__hardware": 0.00045371055603027344, "__label__health": 0.0006775856018066406, "__label__history": 0.0002923011779785156, "__label__home_hobbies": 0.0002639293670654297, "__label__industrial": 0.0005564689636230469, "__label__literature": 0.0003268718719482422, "__label__politics": 0.0003504753112792969, "__label__religion": 0.0005698204040527344, "__label__science_tech": 0.00206756591796875, "__label__social_life": 0.00038814544677734375, "__label__software": 0.00986480712890625, "__label__software_dev": 0.95458984375, "__label__sports_fitness": 0.0011882781982421875, "__label__transportation": 0.0007085800170898438, "__label__travel": 0.0004992485046386719}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 18605, 0.00691]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 18605, 0.24653]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 18605, 0.92409]], "google_gemma-3-12b-it_contains_pii": [[0, 249, false], [249, 711, null], [711, 1315, null], [1315, 1581, null], [1581, 2173, null], [2173, 3132, null], [3132, 4014, null], [4014, 4606, null], [4606, 5166, null], [5166, 5307, null], [5307, 5455, null], [5455, 5998, null], [5998, 6558, null], [6558, 6877, null], [6877, 7392, null], [7392, 8706, null], [8706, 9457, null], [9457, 9995, null], [9995, 10698, null], [10698, 11177, null], [11177, 11646, null], [11646, 12536, null], [12536, 13438, null], [13438, 14312, null], [14312, 14806, null], [14806, 15825, null], [15825, 16474, null], [16474, 16775, null], [16775, 17169, null], [17169, 17538, null], [17538, 18605, null]], "google_gemma-3-12b-it_is_public_document": [[0, 249, true], [249, 711, null], [711, 1315, null], [1315, 1581, null], [1581, 2173, null], [2173, 3132, null], [3132, 4014, null], [4014, 4606, null], [4606, 5166, null], [5166, 5307, null], [5307, 5455, null], [5455, 5998, null], [5998, 6558, null], [6558, 6877, null], [6877, 7392, null], [7392, 8706, null], [8706, 9457, null], [9457, 9995, null], [9995, 10698, null], [10698, 11177, null], [11177, 11646, null], [11646, 12536, null], [12536, 13438, null], [13438, 14312, null], [14312, 14806, null], [14806, 15825, null], [15825, 16474, null], [16474, 16775, null], [16775, 17169, null], [17169, 17538, null], [17538, 18605, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 18605, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 18605, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 18605, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 18605, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 18605, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 18605, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 18605, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 18605, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 18605, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 18605, null]], "pdf_page_numbers": [[0, 249, 1], [249, 711, 2], [711, 1315, 3], [1315, 1581, 4], [1581, 2173, 5], [2173, 3132, 6], [3132, 4014, 7], [4014, 4606, 8], [4606, 5166, 9], [5166, 5307, 10], [5307, 5455, 11], [5455, 5998, 12], [5998, 6558, 13], [6558, 6877, 14], [6877, 7392, 15], [7392, 8706, 16], [8706, 9457, 17], [9457, 9995, 18], [9995, 10698, 19], [10698, 11177, 20], [11177, 11646, 21], [11646, 12536, 22], [12536, 13438, 23], [13438, 14312, 24], [14312, 14806, 25], [14806, 15825, 26], [15825, 16474, 27], [16474, 16775, 28], [16775, 17169, 29], [17169, 17538, 30], [17538, 18605, 31]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 18605, 0.10468]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
dba4ac984a9ed2d0672638bf70b37f87046e4105
|
TECHNICAL ARCHITECTURE REVIEW
<table>
<thead>
<tr>
<th>Project Name:</th>
<th>Web Content Management</th>
</tr>
</thead>
<tbody>
<tr>
<td>Requestor:</td>
<td>Randy Hughes</td>
</tr>
<tr>
<td>Date of Initial Request:</td>
<td>January 18, 2008</td>
</tr>
<tr>
<td>Request Description:</td>
<td>Review Web Content Management (WCM) solutions and make recommendations for suitability on an agency and/or enterprise level. GOED and USTAR are in need of both content management and Web collaboration tools. The GOPB Balanced Scorecard approach needs to be automated at the presentation layer level, and this type of tool, used in conjunction with a BI component may provide a good method for both roll-up and publication of appropriate materials using dashboard capabilities.</td>
</tr>
<tr>
<td>Agency or Agencies:</td>
<td>GOED, Enterprise</td>
</tr>
<tr>
<td>Reviewers:</td>
<td>Bob Woolley and Dave Fletcher</td>
</tr>
<tr>
<td>ARB Acceptance Date:</td>
<td></td>
</tr>
<tr>
<td>Agency Requestor Acceptance Date:</td>
<td></td>
</tr>
</tbody>
</table>
Introduction and Definitions
Web Content Management (WCM) began in the mid-1990s. Businesses and government agencies built Web sites to service the information demands of customers and citizens. Web site administrators soon concluded that their ability to manage collections of electronic documents and Web sites diminished with increasing size and scale. A number of vendors responded to market demand by creating WCM systems.
The need for WCM systems is applicable to all sizes of enterprises. All types of enterprises face similar issues of content control and currency. Many enterprises were averse to the large licensing prices demanded by the WCM pure-play vendors, such as Interwoven and Vignette, and as a result, they put together in-house solutions based on platforms like ColdFusion.
WCM has changed substantially over the last several years. Pure-play WCM companies like Interwoven and Vignette have been forced to diversify to compete with new market entrants to the enterprise space. The market for small to
medium sized enterprise solutions, and the realization that even in a large enterprise one solution may not fit, has enabled an emerging WCM battleground for market presence. As the established vendors struggle to change their pricing structures a new range of vendors has emerged to service smaller enterprises. Their products mimic the extant WCM functionality, but the prices are dramatically lower.
The other dynamic vector of evolution for small to medium enterprise (SME) WCM is the popularization of open-source solutions such as Plone and DotNetNuke. While these products offer enticing features they present a quandary to many IT managers and buyers. The price is right, but the lack of traditional support, presents challenges and uncertainties for IT management.
Regardless of solution type or licensing conditions, one thing is certain in this market. The explosive growth of information is driving renewed interest in WCM. A small to medium sized organization in 2008 must manage the same amount of data that a large enterprise may have done in the late 1990s. WCM has become a critical success factor for making Web information available and current, and with some degree of organizational control over content.
A Web CMS\(^1\) provides the following key features:
**Automated Templates**
Create standard output templates (usually HTML and XML) that can be automatically applied to new and existing content, creating one central place to change that look across a group of content on a site.
**Easily Editable Content**
Once your content is separate from the visual presentation of your site, it usually becomes much easier and quicker to edit and manipulate. Most CMS software includes WYSIWYG editing tools, allowing non-technical individuals to create and edit content.
**Scalable Feature Sets**
Most CMS have plug-ins or modules that can be easily installed to extend an existing site’s functionality.
**Web Standards Upgrades**
Active CMS solutions usually receive regular updates that include new feature sets and keep the system up to current Web standards.
\(^1\) Wikipedia, Web Content Management System,
Workflow Management
Workflow is the process of creating cycles of sequential and parallel tasks that must be accomplished in the CMS. For example, a content creator submits a story but it is not published on the Web site until the copy editor cleans it up, and the editor-in-chief approves it.
Document Management
CMS solutions may provide a means of managing the life cycle of a document from initial creation time, through revisions, publication, archive, and document destruction.
Content Virtualization
CMS systems may provide a means of allowing each user to work within a virtual copy of the entire Web site, document set, and/or code base. This enables changes to multiple interdependent resources to be viewed and/or executed in-context prior to submission.
Objectives and Scope of Review
The purpose of this review is to look at comparisons of WCM systems and identify functional recommendations for WCM implementation at the agency and enterprise level where applicable.
Current Vendor Alternatives and Evaluations
A cursory overview of available WCM options reveals the following:
- Open Source: 73.3%
- Proprietary: 26.7%
The CMS matrix\(^2\) lists over 190 WCM solutions, most of which are open source.
In 2007 InfoTech did a comprehensive and detailed review of WCM solutions. Data from these in depth reviews has been utilized in making product comparisons and recommendations. The InfoTech research is particularly useful since it looked at both open source and proprietary solutions. Forrester Research also released several relevant studies in this area, but excluded most open source vendor solutions.
Analysis and comparisons consider solutions that have a department or workgroup scope and implementation as illustrated in Figure 1, and enterprise scope as illustrated in Figure 2.
\(^2\) CMS Matrix [www.cmsmatrix.org](http://www.cmsmatrix.org).
Nine of the leading vendors in this market segment were analyzed in depth, with Ektron, Sitecore, and DotNetNuke as the top players. Ektron, Sitecore, and DotNetNuke all placed in the Leader Zone. Ektron and Sitecore are commercial solutions. Ektron is the overall leader, in terms of pricing, ease of use, and availability of features. Sitecore also scored well in terms of pricing, ease of use, and features, but suffered for its relatively poor support history.
DotNetNuke is an open source solution that runs on Microsoft’s .NET platform. It offers a wide range of features and is very well integrated with the .NET architecture. DotNetNuke’s greatest strength is the wide availability of commercial support and published books and manuals. This commercial interest separates DotNetNuke from the other open source products.
From a State perspective, the implementation of .NET is somewhat limited, so alternative solutions such as Contribute and some of the Java based WCM solutions such as Alfresco and OpenCMS may initially be more attractive. OpenCMS is currently in use by the Department of Workforce Services.
Enterprise class solutions are dominated by large commercial vendors. These solutions assume availability of substantial and centrally controlled Web hosting and WCM infrastructure within the enterprise. Solutions tend to be costly and effective use requires a high level of disciplined buy in by the enterprise.
Figure 2. Small Enterprise WCM Solutions (Enterprise and Multi-Agency)
Tridion combines robust WCM functionality with a good vision of the future direction of WCM. Basic content management and content editing features are strong, but Tridion’s advanced features are noteworthy. Tridion provides ongoing product developments for integrating content generated from transactional applications.
FatWire offers robust basic content management and authoring features. FatWire has substantial strength when it comes to analytics and the creation of personalized content for segmented Web browsers. This functionality gives FatWire a feature advantage over competitors with a traditional Enterprise Content Management (ECM) orientation.
“The Competitor Zone is dominated by two different types of WCM vendors: the recent roll-ups and the walking dead.”
The roll-ups include Oracle Stellent and Open Text RedDot. Both vendors represent a situation where a much larger company has acquired a former best-of-breed WCM provider. Both vendors offer mature and robust WCM solutions.
According to one analyst, “Vignette and Interwoven are the walking dead. Both companies are experiencing little organic growth and have acquired functionality in an effort to expand. The future of these companies is therefore far from certain.”
Baseline of Current Architecture
Aside from very small open source implementations such as Zope, which have not been consistently identified, the State has relatively few WCM solutions in actual production environments. Contribute is the most frequently used WCM platform and its use is limited to a few agencies. Most WCM activity focuses on getting content changes from business users with IT or other information analysts making the content revisions. Current installations of Documentum and Alfresco are primarily focused on Document Management (DM) and have either not utilized, or made minimal use of, the content management capabilities of the applications.
Best Practices Review
Forrester has identified five major pitfalls with corresponding best practices for use and implementation of WCM systems. These include:
- **WCM must be a business-driven project.** IT managers who drive these initiatives from a technology perspective may have difficulty getting buy-in from the business units, find they are unable to finalize feature sets when forced to mediate between groups with differing needs, and solely bear the burden of responsibility when the inevitable problems arise. The lack of buy-in from the business can be particularly vexing to IT managers, as it may result in “renegade” WCM implementations that were initially implemented by the business but whose support eventually falls to IT staff.
- **User involvement is essential when designing and implementing a successful UI and content approval workflow.** Even when business drives content management, workflow, in practice, is often different from the original. Designing and implementing a content-editing application without enough input from users can result in increased support and
---
4. Ibid.
training time, as well as high frustration levels. If users do not like the workflow, they may not like the system, and perceive it as a failure.
- **Content contributors and template designers must be able to master the WCM system.** The system must support the needs of casual users as well as regular users with minimal retraining requirements. Undue complexity and richness of features can actually become an obstacle. A system that is difficult to use will result in IT support staff doing extra work, as they will have to perform tasks that should be done by those in the lines of business.
- **Avoid excessively complex requirements.** IT staff can easily get caught in the trap of trying to define every single feature of the current site, regardless of its importance to the business. This adds complexity that may add only limited value to the business.
- **Do not place IT in the middle of content workflows.** IT support staff should not be in the critical path of daily operations. Some systems require WCM administrators to make content live, remove content from the site, or add categories to taxonomies. IT managers often make the mistake of positioning Web site developers to do content template maintenance, and routine site content changes.
- **Sell a business sponsor on the importance of WCM.** An executive sponsor from the business needs to champion the project and help to define and prioritize the feature set.
- **Watch end users at work.** Do not just gather requirements from conversations with the users. Observe users at work. Examine and understand their day-to-day workflow. Use collaboration software to get a better view into user content creation, content approval, and content delivery processes.
- **Understand that WCM success is about ease of use.** One of the biggest issues that WCM vendors have yet to really address is the difficulty that end users have with mastering systems that are not easy to use, intuitive, or designed for content contributors who use the system on an infrequent basis.
- **Think big but start small and plan on incremental improvements.** Perform a content audit on your Web site to determine your current needs from a high level, and work with business managers and users to anticipate future needs. Start by focusing on a small site or a self-contained section of a site that can be launched under the new WCM within the context of the current site.
• **Make sure that IT implements and then gets out of the way.** Ensure that the content contributors become self-sufficient. Give users the ability to control the look and feel of their content with minimal help from IT.
**Emerging Technologies and Trends**
The key trend in this market space is the dominance of open source solutions and WCM applications that are easily adaptable to specialized business needs. Web 2.0 hosted content solutions and tool sets are also growing rapidly. The concept and need for a comprehensive one size fits all solution is losing acceptance in favor of specific implementations, albeit in many cases of the same product, to meet specialized business needs for WCM. Content centric WCM solutions with a strong focus on users are being directly supported by most vendors from enterprise to workgroup WCM providers.
**Web 2.0 and Content Management**
Although content management systems can improve the way content is managed on a large portal, new tools have been introduced over the past two to three years as Web 2.0, which in many cases races past the traditional CMS in facilitating the management of content on a Web site. Many CMS vendors have included these tools in their content management systems.
A brief look at some of the tools freely available as Web 2.0 includes:
- **RSS**—All news content should be made available as RSS in addition to text. Many tools are available for doing this painlessly. For example, the content can be generated through a blog which automatically creates the RSS feed. The blog can be set up as a template, with the same look and feel as the overall Web site, or it can simply be a content management tool that creates the RSS feed that is used to port the content to wherever it is presented.
- **GIS Content**—One of the most effective e-government uses was the creation of dynamic maps during the southern California fires. Tools like Google Maps and Microsoft Live allow multiple users to contribute content to dynamic maps in real time. Users were able to use these maps to identify evacuation routes, fire boundaries, traffic incidents, and other critical information in a very granular way and apply that information to their own individual situations.
- **Multimedia**—Multimedia content is an increasingly important part of digital government. Web 2.0 offers many tools to introduce and manage multimedia content on the Web that exceed the capabilities of many traditional content management systems. Podcast tools allow users to generate portable audio content from their phone or a variety of other endpoints. Tools like Viddler make it easy to upload video content to the Web and embed it in a Web site. Access to the video content also
becomes dynamic when the contributor can tag and comment at specific markers within the streaming video file.
- **Portability**—With Web 2.0, content contributors are no longer tied to a particular platform. Content can be provided with tools as diverse as e-mail, SMS texting, or just a simple phone call.
- **Dynamic Linking**—Del.icio.us and other Web tools make it easy to manage dynamic reference lists.
- **Tag Clouds and Custom Search**—Content management systems often provide ways to categorize and catalog content. Web 2.0 offers even more dynamic ways for prioritizing content based on user preferences. A tag cloud that is based on use patterns dynamically identifies content that is of most interest and presents it in a way that makes it easy for the users to navigate directly to the most commonly accessed information and services.
- **Gadgets and Widgets**—These tools offer an easy way to embed all kinds of content into a Web site, almost effortlessly.
- **Mashups**—Mashups combine data from oftentimes existing sources with presentation tools to create new and interesting understanding of the data at the presentation layer.
Web 2.0 tools offer some of the most relevant and dynamic new WCM capabilities and are in high demand and use on Web sites on a worldwide basis. These tools and their outputs are becoming a part of Web user expectations for content.
**Internal Content-Specific Management Tools**
Over time, various State agencies have developed or adapted content management solutions for specific types of content. These include photo galleries for visual images, multimedia databases, and news database tools to manage dynamic news-oriented content. These tools are often easy-to-use and adapted to specific government needs.
**Financial Analysis**
No detailed financial analysis has been provided on a product level. Licensing and support costs are either relatively small or, in the case of open source solutions, are usually non-existent. The primary cost drivers for WCM are initial installation and setup and ongoing maintenance and upgrades. Standard DTS hosting and storage rates will apply to WCM implementations.
Security Review and Analysis
Both commercial and open source solutions generally integrate with LDAP based directory structures. Rights and access control issues are either integral to the environment or managed through master directory resources such as the Utah Master Directory (UMD). No significant security issues have been identified.
Operational and Infrastructure Analysis
Hosting and storage issues are the principle operational concerns, as is directory integration and management of roles and privileges. The goal of operations will generally be one of transparency to the WCM user. Most of the major solutions run in standard server environments, either as a stand alone WCM server or as a service integrated within an agency site. All WCM environments provide robust access to a range of database alternatives that are currently supported by DTS.
Solution Delivery Impact and Analysis
WCM is critical to the effective and timely ability of the agency business to update and add information content. Solution delivery should integrate WCM practice into site design for agencies with the overall goal of producing the initial site design and enabling agency owners to easily add content and maintain currency. Issues of IT involvement on an ongoing basis need to be considered and limited by leveraging WCM.
Agency Services Impact and Analysis
Perhaps the biggest impact to an effective WCM implementation is empowerment of the agency to rapidly impact content on agency Web sites. This results in an overall improvement of information quality, and places IT in an enabling role that supports agency business requirements.
Summary and Recommendations
The State of Utah is in reality an aggregation of many different business units with varying requirements for WCM. An enterprise solution seems unlikely to be successful in adding meaningful value to agencies. A common implementation of one or more products is likely to be much more effective and accepted by the business. WCM is about enabling content creation and business participation in preference to the historical use of WCM as a control mechanism. Specific recommendations for the State include the following:
- Understand business needs before making WCM solution recommendations.
- Favor simplicity of use over breadth of features.
- Let agency business users drive the WCM selection and implementation based on business need with advice from IT.
- Identify a small set of recommended WCM tool alternatives for agency use.
Perform an in-depth review of solutions (such as Alfresco, Tridion, and FatWire) from the enterprise or large agency solutions.
Perform an in-depth review of solutions (such as Alfresco (all platforms), DotNetNuke (.NET), OpenCMS, and others) for agencies or smaller work groups.
- At the conclusion of the in-depth reviews, make recommendations for supported WCM platforms to agencies.
- Identify Web 2.0 WCM toolsets that may be appropriate for agency use.
- Create a matrix of sharable State-created and adapted content-specific tools.
- Integrate recommended WCM solutions with Utah Interactive Web site implementations for agencies so that there is a common approach to WCM implementation.
- Provide ongoing user training and support on the selected WCM platforms.
- Establish requirements for archiving and versioning of Web content. In today’s environment, a lot of content is developed specifically for the Web and only resides there. Content management solutions should address the issue of maintaining historical information over time.
- Standardize authentication and approval processes where possible. Keep these processes simple and easy to use.
- Identify preferred standards for Web content types and presentation; i.e., KML, XML, Flash video, etc.
Effective WCM is business driven with ITY playing an enabling, rather than controlling, role. Identification of a limited number of supported environments that can support core agency and specialized requirements is in the best interest of the State. Web 2.0 toolsets need to be identified and clearly integrated into any WCM platform environment.
References
|
{"Source-Url": "http://www.utahta.wikispaces.net/file/view/TA+Review+WCM+2.25.08fs2fs.pdf", "len_cl100k_base": 4329, "olmocr-version": "0.1.53", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 23233, "total-output-tokens": 5459, "length": "2e12", "weborganizer": {"__label__adult": 0.0002453327178955078, "__label__art_design": 0.0017995834350585938, "__label__crime_law": 0.00067138671875, "__label__education_jobs": 0.0030994415283203125, "__label__entertainment": 0.00024139881134033203, "__label__fashion_beauty": 0.0001614093780517578, "__label__finance_business": 0.0112152099609375, "__label__food_dining": 0.00025582313537597656, "__label__games": 0.000568389892578125, "__label__hardware": 0.0011606216430664062, "__label__health": 0.0002448558807373047, "__label__history": 0.0004982948303222656, "__label__home_hobbies": 0.0001780986785888672, "__label__industrial": 0.0005559921264648438, "__label__literature": 0.0002865791320800781, "__label__politics": 0.0004901885986328125, "__label__religion": 0.0002932548522949219, "__label__science_tech": 0.02178955078125, "__label__social_life": 0.0001779794692993164, "__label__software": 0.335693359375, "__label__software_dev": 0.61962890625, "__label__sports_fitness": 0.00015497207641601562, "__label__transportation": 0.0003571510314941406, "__label__travel": 0.0003218650817871094}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24586, 0.01293]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24586, 0.04219]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24586, 0.91717]], "google_gemma-3-12b-it_contains_pii": [[0, 1892, false], [1892, 4150, null], [4150, 6027, null], [6027, 7148, null], [7148, 8193, null], [8193, 10833, null], [10833, 13260, null], [13260, 15990, null], [15990, 18153, null], [18153, 20654, null], [20654, 22814, null], [22814, 24586, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1892, true], [1892, 4150, null], [4150, 6027, null], [6027, 7148, null], [7148, 8193, null], [8193, 10833, null], [10833, 13260, null], [13260, 15990, null], [15990, 18153, null], [18153, 20654, null], [20654, 22814, null], [22814, 24586, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 24586, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24586, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24586, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24586, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24586, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24586, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24586, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24586, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24586, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24586, null]], "pdf_page_numbers": [[0, 1892, 1], [1892, 4150, 2], [4150, 6027, 3], [6027, 7148, 4], [7148, 8193, 5], [8193, 10833, 6], [10833, 13260, 7], [13260, 15990, 8], [15990, 18153, 9], [18153, 20654, 10], [20654, 22814, 11], [22814, 24586, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24586, 0.06618]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
3758896a595a703af50de680e43022092e7fc2a2
|
This document defines best practices for the intelligent design of Jabber protocols and other XMPP extensions.
Legal
Copyright
This XMPP Extension Protocol is copyright © 1999 – 2020 by the XMPP Standards Foundation (XSF).
Permissions
Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.
Warranty
## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##
Liability
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.
Conformance
This XMPP Extension Protocol has been contributed in full conformance with the XSF’s Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).
Contents
1 Introduction 1
2 Guidelines 1
2.1 XMPP is Sacred .................................................. 1
2.2 Keep Clients Simple .............................................. 2
2.3 Re-Use Existing Protocols ....................................... 3
2.4 Modular is Better .................................................. 4
2.5 Know Your Strengths .............................................. 4
2.6 Be Explicit ......................................................... 5
2.7 Stay Flexible ....................................................... 6
2.8 Privacy and Security Matter ..................................... 6
3 Security Considerations 7
4 IANA Considerations 7
5 XMPP Registrar Considerations 7
1 Introduction
The Extensible Messaging and Presence Protocol (XMPP) provides a solid, flexible foundation for a wide variety of applications on top of XMPP’s core XML streaming technology. With the advancement of XMPP Core and XMPP IM within the Internet Standards Process, interest in building XMPP-based applications and extensions has accelerated even further. Unfortunately, not everyone who wants to build public or private XMPP extensions is familiar with the key design criteria that motivated the original developers of the Jabber technologies or that guide successful XMPP-based protocol design today. Thus there is value in attempting to translate the often-implicit knowledge held by long-time Jabber developers and protocol designers into more explicit policies and principles to which others can adhere. (For more general insights into Internet protocol design, see RFC 3117.) The end result of explicating “The Jabber Way” will hopefully be a wider and deeper understanding of good protocol design practices within the Jabber/XMPP community.
2 Guidelines
2.1 XMPP is Sacred
Background
When the XMPP Standards Foundation (XSF) submitted the XMPP Core and XMPP IM specifications to the Internet Engineering Task Force (IETF), it ceded change control over the core XML streaming technology developed by the Jabber community. However, the XSF has reserved the right to define extensions to XMPP; furthermore, that right is not exclusive to the XSF, since anyone can define their own public or private extensions to XMPP. These extensions are usually in the form of structured XML data that is qualified by a unique namespace other than those currently reserved by the IETF or the XSF.
Meaning
When we say that "XMPP is Sacred", we mean that good protocol design must work within the context of XMPP and not require changes to the core protocols. For one thing, any such changes would need to be pursued within the IETF. Further, the core semantics most likely provide everything that a protocol designer needs. If you think that you need to define a new kind of top-level stanza (other than <message/>, <presence/>, and <iq/>) or a new value of the 'type' attribute for any stanza kind, then you need to think again. Treat XMPP as a transport
---
4 The XMPP Standards Foundation (XSF) is an independent, non-profit membership organization that develops open extensions to the IETF’s Extensible Messaging and Presence Protocol (XMPP). For further information, see <https://xmpp.org/about/xmpp-standards-foundation>.
5 The Internet Engineering Task Force is the principal body engaged in the development of new Internet standard specifications, best known for its work on standards such as HTTP and SMTP. For further information, see <http://www.ietf.org>.
layer and build extensions on top of that layer (among other things, this implies that you must
not modify the foundation when you are working on higher-level structures, for example by
adding elements and attributes to the XMPP schemas on the theory that if applications will
ignore them; define your own extensions in a separate namespace). A further implication
of respecting XMPP is using structured data formats (e.g., applications of XML 1.0 6 rather
than binary or plaintext formats) whenever possible. Finally, as explained in XMPP Core, the
<presence/> stanza exists to broadcast network and communications availability only; for
more advanced information publishing, use Publish-Subscribe (XEP-0060) 7.
Examples
A good example of honoring the XMPP specifications is Invisibility (XEP-0126) 8; while the
Jabber community had informally defined <presence type='invisible'/> at one point, that
protocol was abandoned in favor of an XMPP-compliant approach. Another example is
XHTML-IM (XEP-0071) 9, which re-uses XHTML 1.0 10 (a structured format that shares with
XMPP a common root in XML) rather than Rich Text Format (RTF) 11 (an unstructured format
that does not derive from XML). Further examples are the "extended presence" specifications
(see Extended Presence Protocol Suite (XEP-0119) 12), which are built on top of XEP-0060
rather than overloading the <presence/> stanza.
2.2 Keep Clients Simple
Background
Almost all Jabber technologies are implemented in a client-server architecture. While
that’s not necessary (and there do exist some peer-to-peer applications of XMPP), it usually
makes good sense. Among other things, a client-server architecture has enabled the Jabber
community to force most of the complexity onto servers and components, thus keeping
clients relatively simple. This principle has served the Jabber community well since the very
beginning, and forms an important basis for further innovation.
Meaning
The principle of "keep clients simple" has many implications, among them:
- Don’t multiply protocols beyond necessity (the more protocols you define, the harder it
is to write a client).
- Degrade gracefully so that simpler or older clients can still participate in the network.
- If intensive processing is required, make a server or component do it.
---
6Extensible Markup Language (XML) 1.0 (Fourth Edition) <http://www.w3.org/TR/REC-xml/>.
10XHTML 1.0 <http://www.w3.org/TR/xhtml1>.
html/rtfspec.asp>.
• Don’t force additional requirements (such as XSLT processors) onto clients unless absolutely necessary.
Examples
One good example of keeping clients simple is the presence stanza: the client has only to send <presence/> and the server takes care of presence probes, broadcasts, and appropriate routing decisions. Another example is Multi-User Chat (XEP-0045): although the protocol involves some complexity, it was written so that older clients can join and participate in MUC rooms even if they don’t understand the more advanced MUC extensions.
2.3 Re-Use Existing Protocols
Background
The Jabber community has been developing wire protocols for XML streaming, presence, and instant messaging since 1999. In that time, members of the community have defined a number of building blocks that can be used as the basis for further development. Furthermore, many smart people have created open protocols within other standards development organizations, including the IETF, the World Wide Web Consortium (W3C), OASIS, the International Telecommunication Union (ITU) and the Dublin Core Metadata Initiative (DCMI).
Meaning
Good protocol designers ”stand on the shoulders of giants” by re-using protocols that have been defined within the XSF and within other standards development organizations. That does not mean we don’t define new protocols, because sometimes that is necessary. However, we are aware of work completed by others and we make use of it, especially when that work is outside the Jabber community’s core competence areas (e.g., security or multimedia data formats rather than XML streaming, presence, and real-time messaging). Furthermore, the XSF prefers to re-use open protocols wherever possible. Finally, just as with XMPP, so also with XMPP extensions defined through the XSF: do not modify existing schemas (e.g., adding new elements and attributes) except through the XMPP extension process; instead, define extensions in a separate namespace).
Examples
Examples of re-using existing Jabber protocols include Stream Initiation (XEP-0095) which re-uses Feature Negotiation (XEP-0020) and XEP-0126: Invisibility (which re-uses the privacy lists protocol defined in XMPP IM). Examples of re-using non-Jabber protocols include
---
14 The World Wide Web Consortium defines data formats and markup languages (such as HTML and XML) for use over the Internet. For further information, see <http://www.w3.org/>.
15 OASIS is a not-for-profit, international consortium that drives the development, convergence and adoption of e-business standards. For further information, see <http://www.oasis-open.org/>.
16 The International Telecommunication Union develops technical and operating standards (such as H.323) for international telecommunication services. For further information, see <http://www.itu.int/>.
17 The Dublin Core Metadata Initiative (DCMI) is an organization dedicated to promoting the widespread adoption of interoperable metadata standards. For further information, see <http://www.dublincore.org/>.
SOCKS5 Bytestreams (XEP-0065) \(^{20}\) (which makes use of RFC 1928 \(^{21}\)) and Common Alerting Protocol (CAP) over XMPP (XEP-0127) \(^{22}\) (which defines a way to send Common Alerting Protocol \(^{23}\) data via Jabber). Here again XEP-0071 provides an example: it re-uses XHTML 1.0 (an open protocol developed by a recognized standards development organization) rather than RTF (a closed protocol under the control of the Microsoft Corporation).
2.4 Modular is Better
*Background*
Most Jabber implementations are built using modular architectures, wherein pieces of functionality are coded as separate components and then assembled into larger wholes, with core routing logic that integrates the system (examples include clients that enable the development of plugins and servers that enable the attachment of external components). We can view many Jabber protocols the same way: each one specifies a well-defined domain of functionality that is loosely connected to other domains and integrated by the core transport layer provided by XMPP.
*Meaning*
The best Jabber protocols are quite focused and provide limited but powerful functionality that can be applied in a specific domain or, sometimes, re-used by other Jabber protocols. Even if the domain is more complex, a protocol that addresses it needs to clearly define its scope, limit that scope as much as possible, and specify only the protocols necessary to meet the core requirements.
*Examples*
Service Discovery (XEP-0030) \(^{24}\) and Data Forms (XEP-0004) \(^{25}\) are good examples of focused, single-purpose protocols. By contrast, Multi-User Chat is more complex, but it limits itself to the domain of text conferencing in the context of virtual rooms (e.g., it does not address service-level administration) and consists of separate namespaces for end-user, moderator, and room owner functionality. A good example of a protocol that is focused on a smaller domain is Roster Item Exchange (XEP-0144) \(^{26}\).
2.5 Know Your Strengths
*Background*
The core strength of Jabber technologies is the streaming of relatively small XML fragments between presence-aware network endpoints. As is usually the case, our greatest strength
is also our greatest weakness. Thus XMPP is not optimized for binary data, large XML files, multimedia streaming, or other such applications.
Meaning
It’s not a bad thing that we don’t solve the problems of exchanging binary data, streaming multimedia, or transferring large XML files, because other protocols and technologies have addressed those domains. But it’s important to recognize what we do well and what we don’t. For example, sending base64-encoded binary data, streaming voice or video, or consistently large stanzas in the Jabber band 27 is probably not a good idea, and applications that would depend on such behavior are better designed to communicate their data out of band.
Examples
SI File Transfer (XEP-0096) 28 is a good example of respecting the strengths and weaknesses of XMPP, since it specifies that going out of band is the preferred mechanism for bandwidth-heavy data transfers.
2.6 Be Explicit
Background
In the beginning was the code (mainly jabberd 29). Although code is explicit in its own way, not everyone reads code, and detailed specifications are necessary in order to make functionality reproducible in different codebases. The Jabber community has learned that lesson the hard way.
Meaning
Detailed, explicit specifications are good specifications. Define your terms. Use conformance terminology such as MUST and SHOULD rather than loose English words such as ”does” and ”will”. Follow the Guidelines for Authors of XMPP Extension Protocols (XEP-0143) 30. Specify error conditions. Include lots of examples. Restrict the allowable XML via schemas and datatypes as specified in XML Schema Part 1 31 and XML Schema Part 2 32.
Examples
27 There are no hard-and-fast rules regarding a reasonable upper limit on the average XML stanza. (Note the use of both ‘reasonable’ and ‘average’ in that sentence.) In reality, there is a continuum of stanza sizes, and different sizes may be appropriate for different types of XMPP applications and deployments. While sending 2 gigabyte or 2 megabyte stanzas is wrong in the current context of Jabber technologies, we cannot legitimately say that a 2 kilobyte, 20 kilobyte, or even 200 kilobyte stanza is unreasonable. Is the stanza sent over an open network with current server implementations, or over a closed network with specially tuned servers and clients? Does the application generate one such stanza every second, every minute, every hour? Considerations of this kind help us determine if the use of XMPP is ”reasonable” in some sense. However, when protocol extensions are defined in XMPP Extension Protocols, the XMPP Council will require clear explanation of design choices and reasonable stanza size limits if the extension will generally require what might be considered larger than normal stanzas.
29 The jabberd server is the original server implementation of the Jabber/XMPP protocols, first developed by Jeremie Miller, inventor of Jabber. For further information, see <http://jabberd.org/>.
XMPP Core and XMPP IM are large documents that define the Extensible Messaging and Presence Protocol in excruciating detail. Although such specifications are not fun to write, they provide a model for good protocol design and documentation.
### 2.7 Stay Flexible
**Background**
The need for explicit definition must be balanced against the need for flexibility. A completely rigid protocol may break under stress or when conditions change, whereas a more flexible protocol may bend and adapt. Knowing when to be explicit and when to be flexible is a key to good protocol design.
**Meaning**
In general, a protocol needs to define the skeleton of functionality, but not necessarily specific parameters or values to be used within a certain domain. In order to allow for growth and change, it often makes sense to specify that the XMPP Registrar shall keep track of certain parameters and values, rather than to explicitly limit them in the protocol itself.
**Examples**
Whereas the old Agent Information (XEP-0094) and Jabber Browsing (XEP-0011) protocols defined certain hardcoded values for entity types and categories, Service Discovery has left that function up to the XMPP Registrar. Similarly, Stream Initiation (XEP-0095) defines a registry for its profiles, Advanced Message Processing (XEP-0079) defines registries for processing conditions and actions, and a number of XMPP Extension Protocols register FORM_TYPE values as specified in Field Standardization for Data Forms (XEP-0068).
### 2.8 Privacy and Security Matter
**Background**
Since the beginning, privacy and security have been important priorities within the Jabber community. That must not change.
**Meaning**
Good protocols respect the confidentiality of data generated or communicated by users and applications as well as the security of the system or network as a whole. Although privacy and security considerations have been dealt with at the core XMPP layer, application-level protocols must not compromise privacy and security. Attention to these matters, along with rigorous cross-area review and close scrutiny by protocol designers (in the form of the XMPP Registrar), will ensure that privacy and security are maintained.
---
31 The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see [https://xmpp.org/registrar/](https://xmpp.org/registrar/).
Council 39 and Standards SIG 40), will help ensure that the protocols we develop will provide a strong foundation for communication over the Internet.
Examples
As is well-known, the presence subscription model developed by the Jabber community and specified in XMPP IM requires approval before a contact can view a user’s presence. Similarly, Jabber has always included strong authentication methods, which have been further improved through the use of SASL (RFC 4422 41).
3 Security Considerations
There are no security features or concerns directly related to this proposal, which is informational in nature. However, as discussed above, protocols that are developed following these guidelines should appropriately address privacy and security considerations. Helpful guidelines for security in relation to Internet protocol design can be found in RFC 3552 42.
4 IANA Considerations
This document requires no interaction with the Internet Assigned Numbers Authority (IANA) 43.
5 XMPP Registrar Considerations
This document requires no interaction with the XMPP Registrar.
39 The XMPP Council is a technical steering committee, authorized by the XSF Board of Directors and elected by XSF members, that approves of new XMPP Extensions Protocols and oversees the XSF’s standards process. For further information, see <https://xmpp.org/about/xmpp-standards-foundation#council>.
40 The Standards SIG is a standing Special Interest Group devoted to development of XMPP Extension Protocols. The discussion list of the Standards SIG is the primary venue for discussion of XMPP protocol extensions, as well as for announcements by the XMPP Extensions Editor and XMPP Registrar. To subscribe to the list or view the list archives, visit <https://mail.jabber.org/mailman/listinfo/standards/>.
43 The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.
|
{"Source-Url": "https://xmpp.org/extensions/xep-0134.pdf", "len_cl100k_base": 4430, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 23453, "total-output-tokens": 5941, "length": "2e12", "weborganizer": {"__label__adult": 0.0004565715789794922, "__label__art_design": 0.00040841102600097656, "__label__crime_law": 0.0028018951416015625, "__label__education_jobs": 0.0010805130004882812, "__label__entertainment": 0.00018787384033203125, "__label__fashion_beauty": 0.0001672506332397461, "__label__finance_business": 0.0019664764404296875, "__label__food_dining": 0.0002663135528564453, "__label__games": 0.0007524490356445312, "__label__hardware": 0.00359344482421875, "__label__health": 0.00035309791564941406, "__label__history": 0.0005435943603515625, "__label__home_hobbies": 7.730722427368164e-05, "__label__industrial": 0.0006103515625, "__label__literature": 0.00058746337890625, "__label__politics": 0.0008029937744140625, "__label__religion": 0.0004982948303222656, "__label__science_tech": 0.130859375, "__label__social_life": 0.00011652708053588869, "__label__software": 0.09991455078125, "__label__software_dev": 0.7529296875, "__label__sports_fitness": 0.0003006458282470703, "__label__transportation": 0.0006875991821289062, "__label__travel": 0.0002524852752685547}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 23934, 0.03719]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 23934, 0.49355]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 23934, 0.84567]], "google_gemma-3-12b-it_contains_pii": [[0, 111, false], [111, 2646, null], [2646, 3391, null], [3391, 6493, null], [6493, 9352, null], [9352, 12615, null], [12615, 15459, null], [15459, 18780, null], [18780, 21695, null], [21695, 23934, null]], "google_gemma-3-12b-it_is_public_document": [[0, 111, true], [111, 2646, null], [2646, 3391, null], [3391, 6493, null], [6493, 9352, null], [9352, 12615, null], [12615, 15459, null], [15459, 18780, null], [18780, 21695, null], [21695, 23934, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 23934, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 23934, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 23934, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 23934, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 23934, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 23934, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 23934, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 23934, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 23934, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 23934, null]], "pdf_page_numbers": [[0, 111, 1], [111, 2646, 2], [2646, 3391, 3], [3391, 6493, 4], [6493, 9352, 5], [9352, 12615, 6], [12615, 15459, 7], [15459, 18780, 8], [18780, 21695, 9], [21695, 23934, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 23934, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
003e133ac6b7c6d11ecc9780319fdd397f1058c9
|
VU Entwurf und Programmierung einer Rendering-Engine
Scene Representation
Our overall motivation...
- Use common rendering lib for many rendering applications

- Abstract interfaces:
- IRenderer
- IResourceManager
- Concrete implementations:
- RenderingGLES.dll
- RenderingD3D.dll
- Rendering application 1
- Rendering application 2
Applications use Abstract API
Easy, isn't it?
Many application areas...
Flooding simulation
Industrial CT Scan Visualization
Infrastructure Visualization/Planning: GearViewer
Geological annotations on surfaces
Versatile scene representation needed
- Each application has its own domain “language”
- Common task: describe static or dynamic 2D/3D scenes
- We look for a description language which works for a wide range of applications.
How could we model different scenes?
- Domain specific notation with built-in entities such as
- Bridges, bones, buildings, dip-and-strike tools for geospatial applications etc.
- This notation we will later call the semantic scene graph
- Notation for 3D objects, interaction etc.
- Talk about geometries, transformations
- This notation we will later call the rendering scene graph
- no domain logic
Design space is huge
- How to represent the scene?
- How to expose an API to the application programmer?
- How to make the library extensible?
- How to do resource management (e.g., GPU buffers)?
- How to do GPU optimizations?
- Aardvark had several solutions
- Many approaches failed.
- This lecture summarizes some facets of the above questions.
Scene description in OpenGL
- Example: old school OpenGL
- OpenGL had abstraction mechanisms built in:
- Matrix stack
- Next level of abstraction:
- Move OpenGL code into utility functions.
- Additional utility functions can be used to modify graphics state.
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glPushMatrix();
glTranslatef (-1.0, 0.0, 0.0);
glRotatef ((GLfloat) shoulder, 0.0, 0.0, 1.0);
glTranslatef (1.0, 0.0, 0.0);
glPushMatrix();
glScalef (2.0, 0.4, 1.0);
glutWireCube (1.0);
glPopMatrix();
glTranslatef (1.0, 0.0, 0.0);
glRotatef ((GLfloat) elbow, 0.0, 0.0, 1.0);
glTranslatef (1.0, 0.0, 0.0);
glPushMatrix();
glScalef (2.0, 0.4, 1.0);
glutWireCube (1.0);
glPopMatrix();
glPopMatrix();
glutSwapBuffers();
}
Scene decomposition
```c
void RenderRobotArm()
{
RenderArm(lowerArmTransform);
RenderArm(upperArmTransform);
RenderHand(handTransform);
}
void RenderArm() {..}
void RenderHand()
{
RenderFinger(trafo);
...
}
```
Attributes for scene graphs
Towards an explicit data representation of scenes
- Represent each geometric entity as node
- Special purpose nodes for changing appearance
- Transformation nodes
- Shader nodes
- Material nodes
- Specify light etc…
- Nodes can be composed together in order to make more powerful nodes
- Scene description can be modified by rendering application
- e.g. nodes can be stored in variables, modified, used at various points etc.
The traditional rendering scene graph
- When using explicit data representation for entities and state-changing nodes, we arrive at a simple scene graph.
- The scene can be rendered by traversing the scene graph.
`traverse with sideeffects`
```java
Graphics.setViewTrafo (...)
Graphics.setShader (...)
Graphics.render (...)
Graphics.setViewTrafo (...)
...
```
Traverse with sideeffects means: walk over structure and issue appropriate commands to the underlying graphics hardware.
Scene graphs ‘most general’ description
- Maya for example uses node based scene description: Hypergraph.
- Most other engines as well
- Most scene exchange formats are some sort of scene graph
- VRML, SVG, COLLADA, X3d,...
- A simple object list is a (rather boring) scene graph as well
- Techniques mentioned here carry over to other areas
- Most UI frameworks use some sort of scene graph (e.g. WPF)
- Modelling tools often use graph structure for defining materials etc.
Html as scene graph
Example: Maya Hypergraph
- Helps to structure scene
- Transformation hierarchy
Example: Renderman scene description language
- Hierarchical scene description
- Various attributes and node types
- ConcatTransform
- Transform
- But also light properties
- ASCII description
https://community.renderman.pixar.com/article/400/cornell-box.html?l=r
Option "statistics" "endofframe" [1]
Exposure 1.0 1.0
Display "cornell_box.exr" "openexr" "rgba"
Display "cornell_box.exr" "it" "rgba"
Integrator "PxrPathTracer" "handle" "int numLightSamples" [4]
"int numBxdfSamples" [4]
Hider "raytrace"
"constant string integrationmode" ["path"]
"constant int incremental" [1]
"int minsamples" [32]
"int maxsamples" [1032]
Integrator "PxrVCM" "PxrVCM"
"int maxPathLength" [10]
"int mergePaths" [1]
"int connectPaths" [1]
PixelVariance .007
Format 500 500 1.0
ShadingRate 1.0
Projection "perspective" "fov" [ 39.14625166082039 ] # lens 45.0,
aspect 1.0
Rotate 180 0 1 0 # right handed
Scale -1 1 1 # right handed
WorldBegin
Other boxes and light omitted....
# cornell_box
Attribute "identifier" "name" "cornell_box"
AttributeBegin
ConcatTransform [
-1.0 -1.5099580252808664e-07 0.0 0.0....
]
# cbox_green [2]
Opacity [1.0 1.0 1.0]
Color [0.0 0.5 0.0]
Bxdf "PxrLMDiffuse" "cbox_green2" "color frontColor" [0.0 0.5 0.0]
PointsPolygons
[ 4 ]
[ 0 1 2 3 ]
"P" [
0.0 0.0 0.0
0.0 548.7999877929688 0.0
0.0 548.7999877929688 559.2000122070312
0.0 0.0 559.2000122070312
]
AttributeEnd
WorldEnd
(Open)Inventor
- Idea: functionality first
- Support for animations
- Transformation hierarchy
- Nodes can be defined and reused
- Event nodes for interactions
```
DEF Blade Separator { # Blade geometry and properties
Transform { # Blade interior
translation 0.45 2.9 0.2
rotation 0 1 0 0.3
}
Separator {
Transform {
scaleFactor 0.6 2.5 0.02
}
Material {
diffuseColor 0.5 0.3 0.1
transparency 0.3
}
Cube {
}
}
Separator { # Blade frame
# .... (Details omitted)
}
}
```
[The Inventor Mentor]
Virtual Reality Modeling Language (VRML)
- Similar to inventor.
- Default geometry nodes
- Complex geometry nodes use IndexedFaceSet etc.
- Trafo stack
- Materials, animations via interpolators
- portable
- Dune editor
How to define scene graphs
- Many tools use GUIs for defining scene graphs
- There are **external domain-specific languages** for defining scene graphs
- VRML
- X3d
- Renderman scene description
- Alternatively, there are **internal domain-specific languages**
- Scene graph API or library, exposed by rendering lib
- Can be written and transformed by general purpose programming language
- Most flexible specification technique. When serializing the internal structure we (might) arrive at an external domain-specific language.
Goals of a scene graph implementation
- The core features:
- Scene graph can be used to **efficiently render** the described scene
- We need some mechanisms to **update scene data**
- A reusable modular system
- We often want to write a scene graph library
- We want an **extensible/flexible system** (can not anticipate every possible use case)
Scene graph implementation techniques
- Simple traversal based implementation should be easy, right?
- Nope
- In fact most scene graph implementations have implementation problems
- Let’s look at various implementation techniques
Any implementation ideas?
Towards a scene graph implementation
- Object-Oriented Implementation obvious.
```java
public interface Sg {
void Render();
}
```
```
public class Group : Sg {
... public void Render()
{
foreach(var c in children){c.Render();}
}
}
```
```
public class Renderable : Sg {
public void Render()
{
GL.Draw();
}
}
```
An Interface for scene graphs.
Implementation of node types.
Extending the object oriented approach
- Transformations can be implemented directly.
```csharp
public class Transform : Sg
{
Sg child; Trafo t;
public Transform(Trafo t, Sg child) {
// ..
}
public void Render()
{
GL.PushMatrix();
GL.MultMatrix(t);
child.Render();
child.Render();
GL.PopMatrix();
}
}
```
Where to bind pipeline/shader inputs
- In plain OpenGL/D3D/Vulkan/GLES we know where to bind pipeline/shader inputs.
- However, this behaviour is not appropriate for a general scene graph.
- We don’t know the shaders in advance
- Geometry can be reused for multiple sub scene graphs
- We cannot provide input assignment for shaders.
- Thus, we need to resolve this situation when the information is present
- Immediately before the draw call we know the shader and all its values
- The only viable solution to this is to use semantic identifiers.
How to define geometries
- In rendering applications there are often sophisticated mesh data-structures for specifying geometries.
- In this part of the rendering engine it is beneficial to work with flat (indexed) geometries.
- For binding geometries to arbitrary shaders, we typically want to use semantic -> Array mappings.
```csharp
class IndexedGeometry
{
public IndexedGeometryMode Mode { get; set; }
public Array IndexArray { get; set; }
public Dictionary<string, Array> IndexedAttributes { get; set; }
public Dictionary<string, object> SingleAttributes { get; set; }
}
```
The need for a traversal state
- Nodes have direct translation to graphics states? Two problems:
- Nodes which have no direct graphics API representation
- Nodes only the combination of which have graphics API representations -> need mechanism for communication (e.g. uniform buffers and binding locations)
- Thus: we need a place to store intermediate values.
- Solution: Equip the traversal function with a traversal state.
```java
public class TraversalState {
public Shader Shader;...
}
public interface Sg {
void Render(TraversalState state);
}
```
Demo
In the lecture we show the implementation of a simple scene graph system.
Dynamic data
- Dynamism
- Either modify fields directly
- Problem: we always need to track references directly into scene graph
- Or explicitly model changeability
- For structural changes we still need references
```csharp
public class Changeable<T> {
public T Value { get; set; }
}
public class Transform2 : Sg
{
Changeable<Sg> child; Changeable<Trafo> t;
public Transform2(Changeable<Trafo> t, Changeable<Sg> child)
{
// ..
}
public void Render()
{
GL.PushMatrix();
GL.MultMatrix(t.Value);
child.Value.Render();
GL.PopMatrix();
}
}
```
Common operations for scene graphs
- So far, we can render the scene graph.
- What if we would like to do other stuff like
- Computing levels of detail
- Writing the scene graph to disk
- Computing the bounding box for a scene graph
- How about we add another interface member:
```java
public interface Sg3
{
void Render(TraversalState state);
Box3d ComputeBoundingBox(TraversalState state);
}
```
On extensibility
How to add a new node type:
- Simply add a new subclass of the interface Sg
How to add a new Operation:
- Simply (?) add a member to the interface
Problem:
- We want to provide a reusable library
- Sg is defined in the core library
- Each user would need to edit this base interface in order to add new features !!!!
Suggestions?
The visitor pattern
```java
public interface SgVisitor {
void Visit(Renderable2 r);
void Visit(Group g);
void Visit(Transform2 t);
}
public interface ISg {
void Accept(SgVisitor visitor);
}
public class Renderable2 : ISg {
public void Accept(SgVisitor visitor) {
visitor.Visit(this);
}
}
public class RenderVisitor : SgVisitor {
public void Visit(Transform2 t) { }
public void Visit(Group g) { }
public void Visit(Renderable2 r) { }
}
User code can add visitors, by subclassing the SgVisitor class:
public class ComputeBoundingBoxVisitor : SgVisitor { }
```
You win some, you lose one:
How to add node types now?
The expression problem (1)
- The OOP approach:
- Easy to add **nodes** (subclasses)
- Hard to add new **operations** (all other nodes need to be changed)
- The Visitor approach:
- Easy to add new **operations** (visitor implementations and subclasses)
- Hard to add new **nodes**
- Apparently both approaches have their drawbacks
The expression problem (2)
- Formulated by Wadler in 1998 (see further reading)
- Informally: Extensibility in both, data variants and operations while maintaining static type-safety, i.e. the compiler tells us if a node misses important implementation.
- The expression problem is a common ‘benchmark’ for programming language expressiveness
- Definition:
- Define a datatype by cases (node types) and functions operating on them
- Cases can be added at any time
- Functions operating on those cases can be added at any time
- After adding additional cases or operations, no module needs to be adapted or recompiled.
- Many non-solutions and also solutions
- Often of limited use for us :(
The expression problem in practice
- Two approaches
- Cut back on functionality
- Cut back on static type-safety
- Most scene graph implementations use visitors anyways.
- e.g. OpenSceneGraph
- There are other solutions
- Object Algebras [Oliveira and Cook 2012]
- Look nice at first glance but hard to work with in practice.
- Excellent paper on that topic:
■ The expression problem revisited, Torgersen 2004:
http://www.daimi.au.dk/~madst/ecoop04/index.html
A critical view on rendering scene graphs
- Each application has its own domain “language”
- Example: geologists use special tools in geospatial visualization (dip and strike)
- From an application developer's view, higher level of abstraction desired
- Talk about domain entities (e.g. building, measurement tool, Flamingo, ...) instead of rendering specific entities such as renderable, trafo or shaders.
- Robert F. Tobler's *Semantic Scene Graph* Implementation
- Solves extensibility problem
- ... and provides clean separation of rendering state from conceptual state.
Research Paper 1:
Separating semantics from rendering: a scene graph based architecture for graphics applications
Analysis of the semantic scene graph approach
● Provides extensibility
○ New nodes can be implemented easily (subclass of instance)
○ New traversal can be implemented easily (subclass of traversal)
○ strictly speaking not typesafe since rule binding could fail at runtime
● Support for high-level scene description
○ via semantic scene graph
● The abstract implementation has its cost: We quickly run into performance problems!
What is the cost of scene graph traversal?
Result: Even fastest virtual call implementation can be problematic
[i7-4790, lightweight example, might be much worse in real-world scenarios]
On the performance of scene graphs....
- The more flexible the scene graph implementation is, the more overhead we have.
- Observation: Performance is proportional to the number of nodes visited.
- Thus, the structure/factorization of the scene graph has impact on performance.
- This is not desirable.
- There is quite some research in the field of scene graph optimization....
Optimizations for scene graph systems
Common optimizations
- Reduce scene graph size
- Optimize scene graph for faster rendering
Two types
- Persistent transformations
- Apply persistent transformation to the scene graph (commonly before runtime)
- Alternate runtime representation
- Maintain and additional, optimized runtime representation
Example: Scene Graph Transformation
Pull up costly state changes [patent, Strauss 1999]
- Pull up and merge nodes which apply the same state.
- Find semantically equal scene graph with less nodes resulting in fewer state changes.
Assumption: A is more costly than B
Before: Set A 4 times, Set B 2 times
After optimization: Set A 3 times, change B 2 times
[Wörister 2012]
More optimizations….
- Removing redundancies
- Creating meta nodes, which apply multiple states at once
- Example: Texture atlas creation for removing texture switches
[Wörister 2012] Removing ‘useless’ group nodes
Example: OpenSceneGraph’s optimizations
<table>
<thead>
<tr>
<th>Optimization</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>REMOVE_REDUNDANT_NODES</td>
<td>Collapse Hierarchy and Flatten Hierarchy (p. 9)</td>
</tr>
<tr>
<td>MERGE_GEOMETRY</td>
<td>Collapse Geometry (p. 10)</td>
</tr>
<tr>
<td>TRISTRIP_GEOMETRY</td>
<td>Converting geometry to triangle strips (p. 7)</td>
</tr>
<tr>
<td>SHARE_DUPLICATE_STATE</td>
<td>Share Attributes (p. 9)</td>
</tr>
<tr>
<td>FLATTEN_STATIC_TRANSFORMS_DUPLICATING_SHARED_SUBGRAPHS</td>
<td>Push transformations into vertices (p. 6)</td>
</tr>
<tr>
<td>FLATTEN_STATIC_TRANSFORMS</td>
<td>Same as above but without subgraph duplication</td>
</tr>
<tr>
<td>SPATIALIZE_GROUPS</td>
<td>Spatial Partition (p. 10) using a quadtree or octree</td>
</tr>
<tr>
<td>TEXTURE_ATLAS_BUILDER</td>
<td>Generate Macro Texture (p. 10)</td>
</tr>
</tbody>
</table>
[Wörister 2012]
Geometric optimizations
- Triangle rendering vs triangle strips
- Vertex shader cache locality: Fast Triangle reordering for vertex locality and reduced overdraw [Sander et al. 2007]
- Carefully do your profiling work: papers on that topic might build on wrong assumption for your target hardware
- More on those topics later...
A critical view on persistent scene graph optimizations
- Scene graph optimizations defeat the purpose of scene graphs:
- A clean, and understandable description of the scene
- Alternative optimization data-structures more attractive.
- Hard to implement - will see details in paper later
[Wörister 2012] Streamlined array, used at shortcut at runtime
Practical problems with optimization steps
- Most optimizations require a scene graph rewrite, or the scene graph needs to be analyzed for optimization informations.
- Observation: if we use traversal state to capture all state, the traversal state at leaf nodes contains all data we need.
- Therefore, we only need to query the leaf nodes for further use in optimization steps.
Practical problems with optimization steps
- **Idea:** Capture traversal states which are present at leaf nodes
- **Problem:** the traversal state object mutates while traversing !!!
- -> just capturing the traversal state variable useless
- We need to perform a deep copy of the traversal state -> expensive
General problem: optimization conflicts with dynamism....
Research Paper 2:
Lazy Incremental Computation for Efficient Scene Graph Rendering.
Resource management - approach 1
- GPU resources live in scene graph nodes directly
- Whenever we construct a rendering scene graph node (or visit it the first time), we construct the resource
Resource management
- Two options:
- **The precise way:** If node is about to be removed, immediately start traversal which collects the graph's resources and destroy them
- is this even possible? What if the inner state of the graph has been changed and we can’t reconstruct the original traversal?
- **The lazy way:** Each time a resource is used, add it to least recently used queue. Old elements can be removed.
- Both options are problematic
- Consider high-frequency switching between two variants: Here we want to be lazy
- Consider high memory pressure: Often we don’t want to wait for resources to eventually go away.
Resource management - approach 1
Resources: {Buffer_1..Buffer_4}
To be destroyed: {Buffer_2..Buffer_4}
Concurrent (or batch) modification
Resources: \{Buffer_1..Buffer_4\}
Right child removed from root node.
Right most node removed as well
Buffer_4 is not found during \textit{DisposeTraversal}
Resources: \{Buffer_1\}
To be destroyed: \{Buffer_2..Buffer_4\}
Concurrent (or batch) modification
- Need to be processed in nesting order:
- First dispose inner nodes
- This requirement makes the thing really complex!
Collecting renderable things
Renderable thing
A different view
- Use notion of **renderables**
- Graphics code assembles renderables
- Renderable objects interpreted by render loop
- Render object contains all graphics state
```python
list { RenderObject_1, RenderObject_2, ... }
```
```python
for ro in renderObjects:
Graphics.setViewTrafo ro.Trafo
Graphics.setShader ro.Shader
Graphics.render ro.Geometry
```
Resource management - approach 2
- Decouple resource management from scene graph structure
- Instead of traversing the scene graph to collect resources, cache resources per renderable object
- No silver bullet, but easier in practice
From scene graphs to render objects
- There is not a single canonical scene graph structure
- Different views to structure a scene
- Spatially
- Semantically
- High-performance view
- Optimizations should be carried out in separate data structures
- Example: Scene graph and culling structure is often not the same ->
Culling should be performed in a specialized geometry grid/hierarchy
- Scene graphs are fine as user API
Render objects for specific applications
- Application dictates what to include in render object
- ‘game object’
- We focus on simpler objects which don’t capture full state, making some problems easier
- Render objects could have:
- Transformation
- Material
- Mesh
- Render objects allow for optimization:
- Game objects can be executed fast (tight loop)
- Can be compared efficiently (good for state sorting)
Render objects in a general framework
- Very flexible representation required.
- Render objects consist of:
- Rasterizer state
- BlendState
- Viewport
- Shader
- Uniform values
- Vertexbuffers*
- Indexbuffer
- Instancebuffer*
- Draw call description
- ....
- What is the cost?
- Similar to Vulkan pipeline
Example: hierarchical transformations in unity
Transform.parent
```csharp
public Transform parent;
```
Description
The parent of the transform.
Changing the parent will modify the parent-relative position, scale and rotation but keep the world space position, rotation and scale the same.
See Also: `SetParent`.
Takeaways
- Scene graphs are a common way to represent scenes
- If we want extensibility, the implementation becomes more difficult
- Remember the *expression problem*
- The *semantic scene graph* approach provides:
- A separation of semantic scene description and concrete graphics scene graphs
- Rule objects can be used to capture dynamism. This way we don’t need to modify all visual states from outside of the scene graph.
Takeaways (2)
● The more flexible the implementation, the more overhead we have
○ Overheads can be significant (and performance much weaker than GPU throughput)
● Common problems of scene graph implementations (to think of)
○ Extensibility
○ Efficiency
○ Optimizations are particularly hard if traversal state can be modified arbitrarily
○ In presence of arbitrary modifications, resource management often becomes a burden
Takeaways (3)
- There are several optimization techniques for scene graphs
- Most approaches try to reduce overheads by reducing the graph’s size
- When looking at the problem it is easy to choose the wrong path
- It is better not to squeeze in various different ‘views’ into scene graphs!
- Better approach: compute render objects and perform optimizations on those...
- A fundamental problem arises
- We need to constantly translate scene graphs to render objects
- Is there a better way?
- Could we just compute the set of render objects once, and update them accordingly to the changes?
What’s next?
- How to update render objects efficiently
- How to squeeze out performance of our graphics hardware
- How to implement high performance renderers....
Further reading
Further Reading (2)
- The Inventor Mentor, [https://webdocs.cs.ualberta.ca/~graphics/books/mentor.pdf](https://webdocs.cs.ualberta.ca/~graphics/books/mentor.pdf)
|
{"Source-Url": "https://www.cg.tuwien.ac.at/courses/RendEng/slides/02-RendEng-Representation.pdf", "len_cl100k_base": 5770, "olmocr-version": "0.1.53", "pdf-total-pages": 66, "total-fallback-pages": 0, "total-input-tokens": 71984, "total-output-tokens": 8965, "length": "2e12", "weborganizer": {"__label__adult": 0.0004284381866455078, "__label__art_design": 0.0007171630859375, "__label__crime_law": 0.0003046989440917969, "__label__education_jobs": 0.0004684925079345703, "__label__entertainment": 8.45193862915039e-05, "__label__fashion_beauty": 0.0001436471939086914, "__label__finance_business": 0.00011157989501953124, "__label__food_dining": 0.00033664703369140625, "__label__games": 0.0006775856018066406, "__label__hardware": 0.0011758804321289062, "__label__health": 0.00036406517028808594, "__label__history": 0.0002727508544921875, "__label__home_hobbies": 7.236003875732422e-05, "__label__industrial": 0.0003845691680908203, "__label__literature": 0.00020396709442138672, "__label__politics": 0.0001989603042602539, "__label__religion": 0.0005183219909667969, "__label__science_tech": 0.01316070556640625, "__label__social_life": 6.99758529663086e-05, "__label__software": 0.004665374755859375, "__label__software_dev": 0.974609375, "__label__sports_fitness": 0.00031375885009765625, "__label__transportation": 0.00047969818115234375, "__label__travel": 0.0002257823944091797}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26354, 0.02057]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26354, 0.39139]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26354, 0.77837]], "google_gemma-3-12b-it_contains_pii": [[0, 75, false], [75, 438, null], [438, 606, null], [606, 1246, null], [1246, 1596, null], [1596, 2387, null], [2387, 2621, null], [2621, 2695, null], [2695, 3132, null], [3132, 3628, null], [3628, 4135, null], [4135, 4215, null], [4215, 4487, null], [4487, 5166, null], [5166, 5658, null], [5658, 6218, null], [6218, 6438, null], [6438, 6982, null], [6982, 7338, null], [7338, 7596, null], [7596, 8019, null], [8019, 8398, null], [8398, 8952, null], [8952, 9551, null], [9551, 10120, null], [10120, 10200, null], [10200, 10808, null], [10808, 11222, null], [11222, 11562, null], [11562, 11575, null], [11575, 12240, null], [12240, 12581, null], [12581, 13290, null], [13290, 13771, null], [13771, 14355, null], [14355, 14470, null], [14470, 14909, null], [14909, 15098, null], [15098, 15481, null], [15481, 15831, null], [15831, 16206, null], [16206, 16425, null], [16425, 17800, null], [17800, 18130, null], [18130, 18486, null], [18486, 18866, null], [18866, 19235, null], [19235, 19320, null], [19320, 19514, null], [19514, 20155, null], [20155, 20260, null], [20260, 20520, null], [20520, 20678, null], [20678, 20725, null], [20725, 21105, null], [21105, 21340, null], [21340, 21777, null], [21777, 22202, null], [22202, 22529, null], [22529, 22848, null], [22848, 23283, null], [23283, 23718, null], [23718, 24320, null], [24320, 24485, null], [24485, 25406, null], [25406, 26354, null]], "google_gemma-3-12b-it_is_public_document": [[0, 75, true], [75, 438, null], [438, 606, null], [606, 1246, null], [1246, 1596, null], [1596, 2387, null], [2387, 2621, null], [2621, 2695, null], [2695, 3132, null], [3132, 3628, null], [3628, 4135, null], [4135, 4215, null], [4215, 4487, null], [4487, 5166, null], [5166, 5658, null], [5658, 6218, null], [6218, 6438, null], [6438, 6982, null], [6982, 7338, null], [7338, 7596, null], [7596, 8019, null], [8019, 8398, null], [8398, 8952, null], [8952, 9551, null], [9551, 10120, null], [10120, 10200, null], [10200, 10808, null], [10808, 11222, null], [11222, 11562, null], [11562, 11575, null], [11575, 12240, null], [12240, 12581, null], [12581, 13290, null], [13290, 13771, null], [13771, 14355, null], [14355, 14470, null], [14470, 14909, null], [14909, 15098, null], [15098, 15481, null], [15481, 15831, null], [15831, 16206, null], [16206, 16425, null], [16425, 17800, null], [17800, 18130, null], [18130, 18486, null], [18486, 18866, null], [18866, 19235, null], [19235, 19320, null], [19320, 19514, null], [19514, 20155, null], [20155, 20260, null], [20260, 20520, null], [20520, 20678, null], [20678, 20725, null], [20725, 21105, null], [21105, 21340, null], [21340, 21777, null], [21777, 22202, null], [22202, 22529, null], [22529, 22848, null], [22848, 23283, null], [23283, 23718, null], [23718, 24320, null], [24320, 24485, null], [24485, 25406, null], [25406, 26354, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26354, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26354, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26354, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26354, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26354, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26354, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26354, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26354, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26354, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26354, null]], "pdf_page_numbers": [[0, 75, 1], [75, 438, 2], [438, 606, 3], [606, 1246, 4], [1246, 1596, 5], [1596, 2387, 6], [2387, 2621, 7], [2621, 2695, 8], [2695, 3132, 9], [3132, 3628, 10], [3628, 4135, 11], [4135, 4215, 12], [4215, 4487, 13], [4487, 5166, 14], [5166, 5658, 15], [5658, 6218, 16], [6218, 6438, 17], [6438, 6982, 18], [6982, 7338, 19], [7338, 7596, 20], [7596, 8019, 21], [8019, 8398, 22], [8398, 8952, 23], [8952, 9551, 24], [9551, 10120, 25], [10120, 10200, 26], [10200, 10808, 27], [10808, 11222, 28], [11222, 11562, 29], [11562, 11575, 30], [11575, 12240, 31], [12240, 12581, 32], [12581, 13290, 33], [13290, 13771, 34], [13771, 14355, 35], [14355, 14470, 36], [14470, 14909, 37], [14909, 15098, 38], [15098, 15481, 39], [15481, 15831, 40], [15831, 16206, 41], [16206, 16425, 42], [16425, 17800, 43], [17800, 18130, 44], [18130, 18486, 45], [18486, 18866, 46], [18866, 19235, 47], [19235, 19320, 48], [19320, 19514, 49], [19514, 20155, 50], [20155, 20260, 51], [20260, 20520, 52], [20520, 20678, 53], [20678, 20725, 54], [20725, 21105, 55], [21105, 21340, 56], [21340, 21777, 57], [21777, 22202, 58], [22202, 22529, 59], [22529, 22848, 60], [22848, 23283, 61], [23283, 23718, 62], [23718, 24320, 63], [24320, 24485, 64], [24485, 25406, 65], [25406, 26354, 66]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26354, 0.01567]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
8f8c9fbc69d7a0cacf6358787c01b1d80e1df26e
|
[REMOVED]
|
{"Source-Url": "http://cs.gmu.edu/~setia/cs700-F09/slides/lecture4.pdf", "len_cl100k_base": 5771, "olmocr-version": "0.1.50", "pdf-total-pages": 34, "total-fallback-pages": 0, "total-input-tokens": 71256, "total-output-tokens": 7245, "length": "2e12", "weborganizer": {"__label__adult": 0.0005712509155273438, "__label__art_design": 0.0006918907165527344, "__label__crime_law": 0.0005359649658203125, "__label__education_jobs": 0.0016078948974609375, "__label__entertainment": 0.00014126300811767578, "__label__fashion_beauty": 0.000255584716796875, "__label__finance_business": 0.0004715919494628906, "__label__food_dining": 0.0004761219024658203, "__label__games": 0.00164794921875, "__label__hardware": 0.0270233154296875, "__label__health": 0.000812530517578125, "__label__history": 0.0005440711975097656, "__label__home_hobbies": 0.0003893375396728515, "__label__industrial": 0.0013942718505859375, "__label__literature": 0.00044918060302734375, "__label__politics": 0.0003299713134765625, "__label__religion": 0.0005769729614257812, "__label__science_tech": 0.231201171875, "__label__social_life": 0.0001056194305419922, "__label__software": 0.0137481689453125, "__label__software_dev": 0.71484375, "__label__sports_fitness": 0.0006604194641113281, "__label__transportation": 0.0010986328125, "__label__travel": 0.0002720355987548828}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 20804, 0.02351]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 20804, 0.57408]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 20804, 0.75914]], "google_gemma-3-12b-it_contains_pii": [[0, 140, false], [140, 526, null], [526, 883, null], [883, 1381, null], [1381, 1690, null], [1690, 2037, null], [2037, 2354, null], [2354, 2997, null], [2997, 3306, null], [3306, 4215, null], [4215, 5098, null], [5098, 5601, null], [5601, 6401, null], [6401, 7039, null], [7039, 7782, null], [7782, 8741, null], [8741, 9661, null], [9661, 10640, null], [10640, 11390, null], [11390, 12167, null], [12167, 12929, null], [12929, 13699, null], [13699, 14117, null], [14117, 14703, null], [14703, 15149, null], [15149, 15642, null], [15642, 15965, null], [15965, 16087, null], [16087, 17015, null], [17015, 18077, null], [18077, 19604, null], [19604, 19897, null], [19897, 20517, null], [20517, 20804, null]], "google_gemma-3-12b-it_is_public_document": [[0, 140, true], [140, 526, null], [526, 883, null], [883, 1381, null], [1381, 1690, null], [1690, 2037, null], [2037, 2354, null], [2354, 2997, null], [2997, 3306, null], [3306, 4215, null], [4215, 5098, null], [5098, 5601, null], [5601, 6401, null], [6401, 7039, null], [7039, 7782, null], [7782, 8741, null], [8741, 9661, null], [9661, 10640, null], [10640, 11390, null], [11390, 12167, null], [12167, 12929, null], [12929, 13699, null], [13699, 14117, null], [14117, 14703, null], [14703, 15149, null], [15149, 15642, null], [15642, 15965, null], [15965, 16087, null], [16087, 17015, null], [17015, 18077, null], [18077, 19604, null], [19604, 19897, null], [19897, 20517, null], [20517, 20804, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 20804, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 20804, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 20804, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 20804, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 20804, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 20804, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 20804, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 20804, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 20804, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 20804, null]], "pdf_page_numbers": [[0, 140, 1], [140, 526, 2], [526, 883, 3], [883, 1381, 4], [1381, 1690, 5], [1690, 2037, 6], [2037, 2354, 7], [2354, 2997, 8], [2997, 3306, 9], [3306, 4215, 10], [4215, 5098, 11], [5098, 5601, 12], [5601, 6401, 13], [6401, 7039, 14], [7039, 7782, 15], [7782, 8741, 16], [8741, 9661, 17], [9661, 10640, 18], [10640, 11390, 19], [11390, 12167, 20], [12167, 12929, 21], [12929, 13699, 22], [13699, 14117, 23], [14117, 14703, 24], [14703, 15149, 25], [15149, 15642, 26], [15642, 15965, 27], [15965, 16087, 28], [16087, 17015, 29], [17015, 18077, 30], [18077, 19604, 31], [19604, 19897, 32], [19897, 20517, 33], [20517, 20804, 34]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 20804, 0.05461]]}
|
olmocr_science_pdfs
|
2024-11-28
|
2024-11-28
|
68f56ed9d9cfd157550f7c527a81146e13a41587
|
New Algorithms for Large-Scale Support Vector Machines
PhD Thesis Defense
Thesis advisor: Patrick Gallinari
Antoine Bordes
LIP6 - Université Pierre et Marie Curie - DGA
Roadmap
I. Large-Scale Machine Learning.
II. Linear Support Vector Machines.
III. Non-linear Support Vector Machines.
IV. Support Vector Machines for Structured Outputs.
V. Conclusion.
Part I
Large-Scale Machine Learning
## Rough Estimates
<table>
<thead>
<tr>
<th>Platform</th>
<th>Quantity</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr>
<td>YouTube</td>
<td>> 45 Terabytes of videos</td>
<td>(early 2007)</td>
</tr>
<tr>
<td>Wikipedia</td>
<td>> 13 millions articles</td>
<td>(mid 2009)</td>
</tr>
<tr>
<td>Facebook</td>
<td>> 200 millions active users</td>
<td>(mid 2009)</td>
</tr>
<tr>
<td>Flickr</td>
<td>> 3 billions photos</td>
<td>(end 2008)</td>
</tr>
<tr>
<td>Google</td>
<td>> 1,000 billions indexed pages</td>
<td>(mid 2008)</td>
</tr>
</tbody>
</table>
**Huge data quantities** to be indexed, classified, transformed, ...
**Problem:** Intractable for human operators.
**Solution:** Employ machine learning (ML) to build automatic tools.
Can ML handle such large data quantities?
Antoine Bordes
Orders of Magnitude
Data quantities **outgrow** computing power!
Most ML algorithms require **resources larger than data dimensions**.
ML needs **outgrow** ML capabilities!
Motivation:
A deep need for ML methods that learn on large-scale databases.
Goal:
Propose new learning algorithms reducing training time and memory requirements with no loss in accuracy.
Scope:
Focus on Support Vector Machines, popular classification methods showing great performances in numerous domains.
Support Vector Machines
Training set \((x_i, y_i)_{i=1,\ldots,n} \in \mathbb{R}^d \times \{-1; 1\}\) and kernel \(k(x, \bar{x}) = \Phi(x)\top\Phi(\bar{x})\).
Primal Problem (MaxMargin)
\[
\min_w \mathcal{P}(w) = \frac{1}{2} w^2 + C \sum_{i=1}^{n} \ell(y_i, w\top\Phi(x_i) + b)
\]
with the hinge loss \(\ell(y, \hat{y}) = \max\{0, 1 - y\hat{y}\}\)
Dual Problem (QP)
\[
\max_{\alpha} \mathcal{D}(\alpha) = \sum_{i=1}^{n} \alpha_i - \frac{1}{2} \sum_{i,j} y_i y_j \alpha_i \alpha_j k(x_i, x_j)
\]
subject to \(0 \leq \alpha_i \leq C\) and \(\sum_i y_i \alpha_i = 0\)
Strong Duality: \(\mathcal{P}(w^*) = \mathcal{D}(\alpha^*)\)
Training goal: learn the parameters \(w^*\) and \(b^*\) (or \(\alpha^*\)).
Batch Training
All training examples are known beforehand and stored in memory.
**PROS:**
- optimization methods stopping at convergence.
- good generalization performances.
**CONS:**
- costly optimization.
- high memory requirements and data streams forbidden.
Antoine Bordes
PhD Thesis Defense
Online/Stochastic Training
Training examples arrive in stream and are seen one by one.
**PROS:**
- fast and cheap in memory needs.
- interesting in a large-scale setup.
**CONS:** in practice, worse in generalization than batch methods.
Contributions
**Direction:** combine online speed with batch accuracy.
New state-of-the-art algorithms for training SVMs:
- Linear SVMs: **SGD-QN**.
- Non-linear SVMs: **LASVM**.
- SVMs for structured output prediction: **LaRank**.
Not in this presentation:
- Study of active learning for SVMs.
- Learning under ambiguous supervision.
- Original work for natural language disambiguation.
Part II
Large-Scale Linear SVMs
Part II
Context:
Linear SVMs are very powerful for text applications, for example.
Ex: data mining/indexing, spam filtering, ...
Goal:
Accelerate their training to allow them to handle more data.
Outline:
1. Solve the primal problem efficiently with SGD.
2. Improve SGD using $2^{nd}$ order information: SGD-QN.
Linear Support Vector Machines
SVMs for binary classification using a linear kernel \( k(x, \bar{x}) = x^T \bar{x} \).
Efficient methods to learn linear SVMs solve the Primal:
**Primal Problem (no bias)**
\[
\min_w \mathcal{P}(w) = \frac{1}{2} \|w\|^2 + C \sum_{i=1}^{n} \ell(y_i, w^T x_i)
\]
with \( \ell(y, \hat{y}) = \max \{0, 1 - y \hat{y}\} \)
How to solve this problem efficiently with a lot of data?
Antoine Bordes
1st Order Stochastic Gradient
Simple and efficient way of learning large-scale linear SVMs.
Ex: SVMSGD2 (Bottou, 07), Pegasos (Shalev-Shwartz et al., 07), . . .
**SGD algorithm:**
1. Randomly pick a training instance \((x_t, y_t)\).
2. Update the parameter vector \(w\) with,
\[
w_{t+1} = w_t - \frac{1}{t+t_0} \frac{1}{\lambda} g(w_t, x_t)
\]
where \(g(w_t, x_t) = \lambda w_t + \ell'(y_t w_t^\top x_t) y_t x_t\)
3. Iterate.
**PROS:** Fast on large-scale data.
**CONS:**
- Suffer from ill-conditioned data \(\rightarrow\) slow it down.
- Bad optimization method (although good in generalization).
2\textsuperscript{nd} Order Stochastic Gradient
2\textsuperscript{nd} order SGD reaches the learning optimum after a single pass.
(Murata et al., 99; Bottou et al., 05)
The parameter update uses the inverse of the Hessian matrix $H^{-1}$:
(supposing that $\mathcal{P}(w)$ is twice-differentiable)
$$w_{t+1} = w_t - \frac{1}{t + t_0} H^{-1} g(w_t, x_t)$$
**PROS:** Very good generalization abilities.
**CONS:** Intractable to compute and store the dense matrix $H^{-1}$.
→ Must use estimates of $H^{-1}$.
Antoine Bordes 15 PhD Thesis Defense
Estimation with Low Rank Matrices
**Batch methods:** Ex: L-BFGS (Nocedal et al., 80)
Low rank estimate formed by the last updates of the full gradient $G(w)$.
$\Rightarrow$ But in stochastic setup: $G(w)$ is unavailable.
**Online method:** oLBFGS (Schraudolph et al., 07)
Replace $G(w_t)$, $G(w_{t+1})$ with $g(w_t, x_t)$, $g(w_{t+1}, x_t)$ on the same example $(x_t, y_t)$.
**PROS:** Good stochastic low rank estimation of $H^{-1}$.
**CONS:** Many additional computations compared to SGD.
Estimation with Diagonal Matrices
Our idea: Estimate $H^{-1}$ with a diagonal matrix $D$.
Inspired by (Becker & LeCun, 89).
Online diagonal estimation:
1. Initialize $D$ with parameters of 1st order SGD.
2. Update $D$ on-the-fly approximating $H^{-1}$:
Taylor expansion of $P(w) +$ estimation of $G(w_t)$ and $G(w_{t+1})$ as in oLBFGS.
**PROS:** fast and cheap process (few extra computation).
**CONS:** coarser estimation of $H^{-1}$ than oLBFGS.
Algorithm:
1. Randomly pick a training instance \((x_t, y_t)\)
2. Update \(w_{t+1} = w_t - \frac{1}{t+t_0} D \ell'(y_t w_t^T x_t) y_t x_t\)
3. Every \(T\) iteration:
a. Update \(w_{t+1} = w_t - \frac{\lambda T}{t+t_0} D w_t\)
b. Update \(D\) (requires an extra gradient computation)
4. Iterate.
Operations scheduling:
- Update can be split and scheduled differently:
Operation 2. \(=\) cheap and Operation 3. \(=\) costly.
- \(T\) depends on the sparsity of the training instances.
Experiments
**Task:** Binary classification from (PASCAL LSChallenge, 08).
**Data:** ALPHA dataset (synthetic, ill-conditioned).
<table>
<thead>
<tr>
<th>Classes</th>
<th>Train. Ex.</th>
<th>Tst. Ex.</th>
<th>Features</th>
<th>Kernel</th>
</tr>
</thead>
<tbody>
<tr>
<td>2</td>
<td>100,000</td>
<td>50,000</td>
<td>500</td>
<td>Linear</td>
</tr>
</tbody>
</table>
**Comparisons:** SVMMSGD2, oLBFGS and SGD-QN.
Summary Part II
**Motivation:** Accelerate SGD training to handle more data.
**Achievement:** The new SGD-QN algorithm.
1. It requires less iterations than SGD.
2. It is finally faster than SGD for linear problems.
**Highlight:**
SGD-QN won the Pascal Large Scale Learning Challenge in 2008. (equal 1\textsuperscript{st} over 40 international competitors).
Part III
Large-Scale Non-linear SVMs
Context:
– Limited applicative range for linear SVMs → non-linearity.
Ex: image recognition, vision, . . .
– Non-linearity complicates the model → dual optimization
Goal:
Propose a new learning algorithm saving time and memory.
Outline:
1. Solve the dual SVM problem with gradient ascent.
2. Combine online & batch with Process/Reprocess: **LASVM**.
Non-linear SVMs
Binary classification using a non-linear kernel \( k(x, \bar{x}) = \Phi(x)^\top \Phi(\bar{x}) \).
Limitations of SGD-QN (and SGD):
For non-linear SVMs, solving the dual problem is more efficient:
**Dual Problem (QP)**
\[
\max_{\alpha} \quad D(\alpha) = \sum_{i=1}^{n} y_i \alpha_i - \frac{1}{2} \sum_{i,j} \alpha_i \alpha_j \ k(x_i, x_j) \\
\text{subject to} \quad 0 \leq \alpha_i \leq C \quad \text{and} \quad \sum_i \alpha_i = 0
\]
**Support Vectors (SV):** all \( x_i \) with \( \alpha_i \neq 0 \).
**Parameter vector:** \( \mathbf{w}^* = \sum_i \alpha_i^* \Phi(x_i) \)
New optimization problem → new algorithm.
Solving the Dual QP
Dual ascent with direction search:
1. Pick a direction in the dual space defined by $\alpha$.
2. Perform the best possible step in that direction.
3. Iterate.
Properties:
- Analytical computation of the gradient step (+ box constraints).
- Always progress towards the solution.
How to choose the successive ascent directions?
Antoine Bordes
Choosing Directions
**Batch strategy:**
All examples known beforehand → follow the highest full gradient.
Ex: SMO (Platt, 99), LibSVM (Chang et al., 05), ... → accurate but costly in training time.
**Online strategy:**
Stream of examples → directions imposed by the new example.
Ex: AvgPerceptron (Freund et al., 99), Passive-Aggressive (Crammer et al., 06). → cheap and fast but less accurate.
**Our strategy:**
Mix direction choices to combine online speed with batch accuracy.
Process/Reprocess
Online alternation of directions defined by:
- a fresh example → Process.
- the memory-stored SV with the highest gradient → Reprocess.
Equivalent view:
- Time management: computation cost vs dual increase.
- Memory management: online insertion and removal of SVs.
**Algorithm:**
1. **Initialization** with few examples of each class.
2. **Online iterations:** repeat a predefined number of times,
- Randomly pick a training instance \((x_t, y_t)\).
- Perform \(\text{Process}(x_t, y_t)\).
- Perform \(\text{Reprocess()}\) once.
3. **Finishing:** \(\text{Reprocess()}\) until convergence (optional).
**Theoretical properties:**
- **Convergence:** to the batch SVM solution.
- **Tracking guarantee:** \(\text{Process/Reprocess}\) allows to track the SVM batch optimum on the course of learning.
Experiments
**Task:** Handwritten digits recognition.
![Handwritten digits]
**Data:** MNIST dataset treated in “One-vs-All”.
<table>
<thead>
<tr>
<th>Classes</th>
<th>Train. Ex.</th>
<th>Tst. Ex.</th>
<th>Features</th>
<th>Kernel</th>
</tr>
</thead>
<tbody>
<tr>
<td>10</td>
<td>60,000</td>
<td>10,000</td>
<td>780</td>
<td>Gaussian</td>
</tr>
</tbody>
</table>
**Stopping:** one epoch ([LASVMx1](#)).
MNIST “One-vs-All”
Caching often-used kernel values is essential for tractability.
LASVM depends less on the kernel cache size than LibSVM.
→ Using Process/Reprocess saves memory usage.
Motivation: Accelerate non-linear SVMs training.
Achievement: The new LASVM algorithm.
1. It reaches the batch accuracy after a fast single epoch.
2. It converges towards the batch SVM solution.
3. It makes a sparse use of memory.
Highlight:
LASVM has been used to train SVMs on 8M examples on a single CPU (in 20h with 6Go of RAM) (Loosli et al., 06).
Part IV
Structured Output Prediction
Many problems are more complex than binary classification.
Application: natural language processing, bioinformatics, . . .
In such cases, instances consist in couples (input ; output) which can both involve structures, such as sequences, trees, . . .
Part IV
Context:
- Structured output prediction → more elaborate problems.
- Dealing with structured objects worsen scaling issues.
Goal:
Propose a new learning algorithm combining the speed of online methods and the accuracy of batch ones.
Outline:
1. Express structured output prediction as a SVM problem.
**Kernels Ideas** (Taskar et al.; Altun et al., 2003)
**Problem 1:** dependencies within input and output structures.
**Joint kernel encoding:**
- A joint kernel $K$ encodes correlations of a pair (input; output).
- A cost $\Delta$ measures the errors between two output structures.
**Problem 2:** large output spaces, intractable enumeration.
**Ranking formulation:**
- We learn a function $S$ scoring any pair (input; output).
- Constraints: score of a correct pair $> \text{score of any incorrect}$.
- Combined with an efficient prediction $\rightarrow$ bypass enumeration.
SVM Formulation (Tsochantaridis et al., 05)
We can derive a SVM formulation with training examples \((x_i, y_i)\).
**Primal problem:**
\[
\min_w \frac{1}{2} \|w\|^2 + C \sum_{i=1}^{n} \xi_i \quad \text{subject to} \quad \begin{cases}
\forall i \xi_i \geq 0 \\
\forall i \forall y \neq y_i \quad S(x_i, y_i) \geq S(x_i, y) + \Delta(y, y_i) - \xi_i
\end{cases}
\]
**Dual problem:**
\[
\max_{\beta} - \sum_{i,y} \Delta(y, y_i) \beta_y^i - \frac{1}{2} \sum_{i,j,y,\bar{y}} \beta_y^i \beta_{\bar{y}}^j K(x_i, y, x_j, \bar{y}) \quad \text{subject to} \quad \begin{cases}
\forall i \forall y \beta_y^i \leq C \delta_{yy} \\
\forall i \sum_y \beta_y^i = 0
\end{cases}
\]
**Limitation:** Exponential number of constraints.
**Consequence:** any method must add them incrementally.
\[
\rightarrow \text{batch methods are very slow (full gradient intractable).}
\]
1. **Online alternation of 3 optimizations steps:**
- *Process*: on a new example $\rightarrow$ **add** constraints.
- Two types of *Reprocess*:
1. *ProcessOld*: previously seen ex $\rightarrow$ **add**/ **remove** constraints.
2. *Optimize*: only on existing constraints $\rightarrow$ **remove** constraints.
2. **Operations scheduling:**
- *Fixed*: alternation of a predefined number.
- *Adaptive*: sampling according to a distribution of efficiency.
3. **Tractability**: LaRank never uses the full gradient.
4. **Complexity**: Convergence after at most $O(n)$ iterations.
App. #1: MultiClass Classification
**Goal:** for any input $x$ predict its atomic label $y$.
**Components:**
- **Kernel:** $K(x, y, \bar{x}, \bar{y}) = \delta_{y\bar{y}} k(x, \bar{x})$
- **Cost:** $\Delta(y, \bar{y}) = 1 - \delta_{y\bar{y}}$
**Observations:**
- Simplest structured output task on which test LaRank.
- No real input or output structure.
- But many comparisons in the literature.
Antoine Bordes
**Experiments**
**Task:** Handwritten digits recognition.
![Handwritten digits images]
**Data:** MNIST dataset.
<table>
<thead>
<tr>
<th>Classes</th>
<th>Train. Ex.</th>
<th>Test. Ex.</th>
<th>Features</th>
<th>Kernel</th>
</tr>
</thead>
<tbody>
<tr>
<td>10</td>
<td>60,000</td>
<td>10,000</td>
<td>780</td>
<td>Gaussian</td>
</tr>
</tbody>
</table>
**Stopping:** one epoch (LaRankx1).
Antoine Bordes
MNIST
App. #2: Sequence Labeling
**Goal:** Given an input sequence $x$ of tokens, predict the corresponding sequence $y$ of labels.
**Inference scheme:** Process that recovers the output sequence given an input, assigning a label $y_t$ to each token $x_t$.
**Structured modeling hypothesis:**
1. **Conditional independence:** a label $y_t$ is only function of neighborhoods.
2. **Invariance:** this function does not depend on the time index $t$.
Antoine Bordes
Inference Schemes
1. **Exact inference:** global maximization over the whole sequence.
\[ \rightarrow \text{solved with dynamic programming (Viterbi)}. \]
Kernel:
\[
K(x, y, \bar{x}, \bar{y}) = \sum_{s,t} \delta_{y_s, \bar{y}_t} k(x_s, \bar{x}_t) + \sum_{s,t} \delta_{y_s, \bar{y}_t} \delta_{y_{s+1}, \bar{y}_{t+1}}.
\]
Cost: *Hamming* loss.
2. **Greedy inference:** local dependencies on a token and few past labels.
\[ \rightarrow \text{fast and can use longer Markov interactions}. \]
Kernel:
\[
K(x, y, \bar{x}, \bar{y}) = \delta_{y\bar{y}} \left[ k(x, \bar{x}) + \sum_{j \in J} \delta_{y_j, \bar{y}_j} \right].
\]
Cost:
\[ \Delta(y, \bar{y}) = 1 - \delta_{y\bar{y}}. \]
Experiments
Task: Part-Of-Speech tagging.
– Associate its grammar label to each word of a sentence.
– Example:
```
PRP VBD DT NN
| | | |
He opened the window
```
Data: Wall Street Journal dataset.
<table>
<thead>
<tr>
<th>Labels</th>
<th>Train</th>
<th>Test</th>
<th>Features</th>
<th>Kernel</th>
</tr>
</thead>
<tbody>
<tr>
<td>44</td>
<td>42,466 sequences</td>
<td>2,155 sequences</td>
<td>> 130,000</td>
<td>Linear</td>
</tr>
<tr>
<td></td>
<td>(≈ 1,000,000 tokens)</td>
<td>(≈ 53,000 tokens)</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
Stopping: one epoch (LaRankExact and LaRankGreedy).
Antoine Bordes
Summary Part IV
**Motivation:** Accelerate learning of SVMs for structured outputs.
**Achievement:** The new LaRank algorithm.
1. Compared to batch methods, it is:
- much faster in training.
- as accurate in generalization.
2. Compared to online methods, it is:
- almost as fast in training.
- much more accurate in generalization.
**Highlight:**
LaRankGreedy reaches state-of-the-art accuracy after training only 3 min. on 42,000 WSJ sentences on a single CPU.
Antoine Bordes
Part V
Conclusion
Conclusion
A broad range of methods sharing desirable properties:
- fast;
- cheap in memory;
- competitive accuracies;
- theoretical guarantees: convergence, complexity, ...
Generic tools which can be applied to numerous applications:
- active learning: LASVM (Ertekin et al., 07);
- bioinformatics: LASVM (Morgado et al., 09);
- webpage ranking: LaRank (Usunier et al., 09);
- semi-supervised ranking: LaRank (Truong, 09);
- ...
Thank You for your Attention
|
{"Source-Url": "https://www.hds.utc.fr/~bordesan/dokuwiki/_media/en/bordes10phdthesis-slides.pdf", "len_cl100k_base": 5222, "olmocr-version": "0.1.49", "pdf-total-pages": 49, "total-fallback-pages": 0, "total-input-tokens": 76299, "total-output-tokens": 7091, "length": "2e12", "weborganizer": {"__label__adult": 0.00042510032653808594, "__label__art_design": 0.0008635520935058594, "__label__crime_law": 0.0005664825439453125, "__label__education_jobs": 0.005161285400390625, "__label__entertainment": 0.00020265579223632812, "__label__fashion_beauty": 0.0002989768981933594, "__label__finance_business": 0.0005650520324707031, "__label__food_dining": 0.0004494190216064453, "__label__games": 0.00102996826171875, "__label__hardware": 0.0015811920166015625, "__label__health": 0.0012235641479492188, "__label__history": 0.0003857612609863281, "__label__home_hobbies": 0.0001804828643798828, "__label__industrial": 0.0006480216979980469, "__label__literature": 0.0004398822784423828, "__label__politics": 0.0004839897155761719, "__label__religion": 0.0006642341613769531, "__label__science_tech": 0.3701171875, "__label__social_life": 0.0002058744430541992, "__label__software": 0.0220947265625, "__label__software_dev": 0.59130859375, "__label__sports_fitness": 0.00039458274841308594, "__label__transportation": 0.000492095947265625, "__label__travel": 0.00022721290588378904}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 17046, 0.01325]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 17046, 0.41904]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 17046, 0.7157]], "google_gemma-3-12b-it_contains_pii": [[0, 197, false], [197, 387, null], [387, 424, null], [424, 1094, null], [1094, 1270, null], [1270, 1579, null], [1579, 2288, null], [2288, 2589, null], [2589, 2829, null], [2829, 3222, null], [3222, 3255, null], [3255, 3573, null], [3573, 4002, null], [4002, 4616, null], [4616, 5164, null], [5164, 5661, null], [5661, 6118, null], [6118, 6611, null], [6611, 6958, null], [6958, 6958, null], [6958, 7318, null], [7318, 7356, null], [7356, 7713, null], [7713, 8352, null], [8352, 8718, null], [8718, 9201, null], [9201, 9488, null], [9488, 10029, null], [10029, 10369, null], [10369, 10388, null], [10388, 10557, null], [10557, 10912, null], [10912, 10950, null], [10950, 11202, null], [11202, 11566, null], [11566, 12147, null], [12147, 13010, null], [13010, 13610, null], [13610, 14026, null], [14026, 14368, null], [14368, 14374, null], [14374, 14835, null], [14835, 15567, null], [15567, 16072, null], [16072, 16072, null], [16072, 16567, null], [16567, 16586, null], [16586, 17018, null], [17018, 17046, null]], "google_gemma-3-12b-it_is_public_document": [[0, 197, true], [197, 387, null], [387, 424, null], [424, 1094, null], [1094, 1270, null], [1270, 1579, null], [1579, 2288, null], [2288, 2589, null], [2589, 2829, null], [2829, 3222, null], [3222, 3255, null], [3255, 3573, null], [3573, 4002, null], [4002, 4616, null], [4616, 5164, null], [5164, 5661, null], [5661, 6118, null], [6118, 6611, null], [6611, 6958, null], [6958, 6958, null], [6958, 7318, null], [7318, 7356, null], [7356, 7713, null], [7713, 8352, null], [8352, 8718, null], [8718, 9201, null], [9201, 9488, null], [9488, 10029, null], [10029, 10369, null], [10369, 10388, null], [10388, 10557, null], [10557, 10912, null], [10912, 10950, null], [10950, 11202, null], [11202, 11566, null], [11566, 12147, null], [12147, 13010, null], [13010, 13610, null], [13610, 14026, null], [14026, 14368, null], [14368, 14374, null], [14374, 14835, null], [14835, 15567, null], [15567, 16072, null], [16072, 16072, null], [16072, 16567, null], [16567, 16586, null], [16586, 17018, null], [17018, 17046, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 17046, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 17046, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 17046, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 17046, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 17046, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 17046, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 17046, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 17046, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 17046, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 17046, null]], "pdf_page_numbers": [[0, 197, 1], [197, 387, 2], [387, 424, 3], [424, 1094, 4], [1094, 1270, 5], [1270, 1579, 6], [1579, 2288, 7], [2288, 2589, 8], [2589, 2829, 9], [2829, 3222, 10], [3222, 3255, 11], [3255, 3573, 12], [3573, 4002, 13], [4002, 4616, 14], [4616, 5164, 15], [5164, 5661, 16], [5661, 6118, 17], [6118, 6611, 18], [6611, 6958, 19], [6958, 6958, 20], [6958, 7318, 21], [7318, 7356, 22], [7356, 7713, 23], [7713, 8352, 24], [8352, 8718, 25], [8718, 9201, 26], [9201, 9488, 27], [9488, 10029, 28], [10029, 10369, 29], [10369, 10388, 30], [10388, 10557, 31], [10557, 10912, 32], [10912, 10950, 33], [10950, 11202, 34], [11202, 11566, 35], [11566, 12147, 36], [12147, 13010, 37], [13010, 13610, 38], [13610, 14026, 39], [14026, 14368, 40], [14368, 14374, 41], [14374, 14835, 42], [14835, 15567, 43], [15567, 16072, 44], [16072, 16072, 45], [16072, 16567, 46], [16567, 16586, 47], [16586, 17018, 48], [17018, 17046, 49]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 17046, 0.05469]]}
|
olmocr_science_pdfs
|
2024-11-25
|
2024-11-25
|
f482d4d6ee0d711abe4308d955b0a71027653bee
|
[REMOVED]
|
{"Source-Url": "http://www.cs.ucsb.edu/~suri/cs130b/NewDynProg.pdf", "len_cl100k_base": 5429, "olmocr-version": "0.1.50", "pdf-total-pages": 41, "total-fallback-pages": 0, "total-input-tokens": 73053, "total-output-tokens": 7283, "length": "2e12", "weborganizer": {"__label__adult": 0.00041604042053222656, "__label__art_design": 0.0005445480346679688, "__label__crime_law": 0.0005636215209960938, "__label__education_jobs": 0.0014200210571289062, "__label__entertainment": 0.0001201629638671875, "__label__fashion_beauty": 0.00022602081298828125, "__label__finance_business": 0.0004088878631591797, "__label__food_dining": 0.0005755424499511719, "__label__games": 0.001445770263671875, "__label__hardware": 0.0018453598022460935, "__label__health": 0.0010623931884765625, "__label__history": 0.0005235671997070312, "__label__home_hobbies": 0.00029850006103515625, "__label__industrial": 0.0010461807250976562, "__label__literature": 0.0002903938293457031, "__label__politics": 0.00034356117248535156, "__label__religion": 0.000667572021484375, "__label__science_tech": 0.1917724609375, "__label__social_life": 0.00012695789337158203, "__label__software": 0.00893402099609375, "__label__software_dev": 0.78564453125, "__label__sports_fitness": 0.0007252693176269531, "__label__transportation": 0.0009317398071289062, "__label__travel": 0.0003376007080078125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 14028, 0.04004]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 14028, 0.61003]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 14028, 0.61574]], "google_gemma-3-12b-it_contains_pii": [[0, 312, false], [312, 703, null], [703, 1079, null], [1079, 1392, null], [1392, 1714, null], [1714, 2144, null], [2144, 2524, null], [2524, 2944, null], [2944, 3239, null], [3239, 3606, null], [3606, 3955, null], [3955, 4228, null], [4228, 4632, null], [4632, 4733, null], [4733, 5085, null], [5085, 5440, null], [5440, 5947, null], [5947, 6265, null], [6265, 6639, null], [6639, 6881, null], [6881, 7198, null], [7198, 7637, null], [7637, 7909, null], [7909, 8612, null], [8612, 8784, null], [8784, 9293, null], [9293, 9515, null], [9515, 9830, null], [9830, 10075, null], [10075, 10243, null], [10243, 10595, null], [10595, 11059, null], [11059, 11223, null], [11223, 11528, null], [11528, 11701, null], [11701, 12148, null], [12148, 12604, null], [12604, 13074, null], [13074, 13241, null], [13241, 13667, null], [13667, 14028, null]], "google_gemma-3-12b-it_is_public_document": [[0, 312, true], [312, 703, null], [703, 1079, null], [1079, 1392, null], [1392, 1714, null], [1714, 2144, null], [2144, 2524, null], [2524, 2944, null], [2944, 3239, null], [3239, 3606, null], [3606, 3955, null], [3955, 4228, null], [4228, 4632, null], [4632, 4733, null], [4733, 5085, null], [5085, 5440, null], [5440, 5947, null], [5947, 6265, null], [6265, 6639, null], [6639, 6881, null], [6881, 7198, null], [7198, 7637, null], [7637, 7909, null], [7909, 8612, null], [8612, 8784, null], [8784, 9293, null], [9293, 9515, null], [9515, 9830, null], [9830, 10075, null], [10075, 10243, null], [10243, 10595, null], [10595, 11059, null], [11059, 11223, null], [11223, 11528, null], [11528, 11701, null], [11701, 12148, null], [12148, 12604, null], [12604, 13074, null], [13074, 13241, null], [13241, 13667, null], [13667, 14028, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 14028, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 14028, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 14028, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 14028, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 14028, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 14028, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 14028, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 14028, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 14028, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 14028, null]], "pdf_page_numbers": [[0, 312, 1], [312, 703, 2], [703, 1079, 3], [1079, 1392, 4], [1392, 1714, 5], [1714, 2144, 6], [2144, 2524, 7], [2524, 2944, 8], [2944, 3239, 9], [3239, 3606, 10], [3606, 3955, 11], [3955, 4228, 12], [4228, 4632, 13], [4632, 4733, 14], [4733, 5085, 15], [5085, 5440, 16], [5440, 5947, 17], [5947, 6265, 18], [6265, 6639, 19], [6639, 6881, 20], [6881, 7198, 21], [7198, 7637, 22], [7637, 7909, 23], [7909, 8612, 24], [8612, 8784, 25], [8784, 9293, 26], [9293, 9515, 27], [9515, 9830, 28], [9830, 10075, 29], [10075, 10243, 30], [10243, 10595, 31], [10595, 11059, 32], [11059, 11223, 33], [11223, 11528, 34], [11528, 11701, 35], [11701, 12148, 36], [12148, 12604, 37], [12604, 13074, 38], [13074, 13241, 39], [13241, 13667, 40], [13667, 14028, 41]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 14028, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
9030771c03371c84c96d1e780e92cc439dc18d3e
|
규칙기반시스템에서의 퍼지정보처리
Fuzzy Information Processing in Rule-Based Systems
이건명° 조충호° 이광형°
°대전시 유성구 구성동 한국과학기술원 전산학과
°충남 연기군 조치원읍 고려대학교 전산학과
요 약
예제한 정보를 이용하고 처리하기 위해 퍼지기법을 전문가시스템 분야에 도입하려는 시도가 최근 활발히 진행되어 왔다. 이러한 연구결과로 몇몇 퍼지기법을 사용한 전문가시스템들과 퍼지 전문가시스템 개발도구들이 개발되어 보고되고 있다. 현재 전문가시스템에서 여러가지 방법으로 퍼지기법이 적용되고 있음에도 불구하고 아직 체계적인 응용방법이 제안되지 않은 상황이다. 본 논문에서는 규칙과 사실에 확신도(certainty factor)가 부여되고 속성(attribute)값에 퍼지값(fuzzy value)을 허용하는 규칙기반(rule-based) 전문가시스템에서 발생하는 문제점을 살펴보고 해결방법의 한가지를 제시한다.
일반적인 규칙기반 시스템에서는 정합(matching)연산의 결과가 정합과 비정합으로 명확하게 나타나지만, 규칙과 사실에 퍼지값이 사용될 수 있도록하면, 퍼지값과 보 통값(crisp value), 퍼지값과 퍼지값 간의 정합을 해야 하는 문제가 생긴다. 또한 퍼지값을 해석함으로써 퍼지값과 퍼지값, 퍼지값과 보통값간의 비교연산을 해야 하는 문제가 발생한다. 한편, 퍼지값이 규칙과 사실에서 사용되고 확신도를 사용할때 퍼지추론을 어떻게 수행할 것인가도 논란의 대상이다.
본 논문에서는 퍼지값이 도입됨으로써 생기는 퍼지정합과 퍼지비교의 경우에는 살펴보고, 이들 연산에 대해 적합도를 계산하는 방법을 제안하고, 이를 추론에 이용하는 방법을 제시한다. 한편, 합성추론방법(compositional rule of inference)에 기반한 퍼지추론 뿐만 아니라 일반적인 규칙의 추론도 제공할 수 있는 방법을 제시한다. 또한 법정 전문가시스템 개발도구인 OPS5를 확장하여 제안된 방법들을 수용하도록한 FOPS5(Fuzzy extended OPS5)에 대해서도 기술한다.
1 Introduction
There have been many researches which introduce fuzzy techniques in the expert systems [1][3-5][7-16], and several fuzzy expert system shells have been developed such as: REVEAL, LEONARDO, FRIL, ARIES[1], FLOPS[3], FESS II[4], Z-II[10], ES/KERNEL/W[14], STIM[16].
It has been pointed out that those fuzzy expert system shells suffer from some weak points[8]. Some shells excessively emphasize the role of fuzzy inferencing and thus fail to fully support the functions of conventional expert system shells. Some shells provide insufficient function for fuzzy inferencing though they use fuzzy techniques.
In the application domains, generally most of knowledge is certain and a small portion of knowledge remains uncertain. In this sense, it may be desirable that we have a conventional expert system shell which is extended to process fuzzy information. In this paper, we present a rule-based forward-chaining fuzzy expert system shell, called FOPS5, which is an extension of the conventional expert system shell OPS5[2] to accommodate fuzzy information processing. We take OPS5 as the platform since it is familiar, easy to use and widely used. We aim that FOPS5 is equipped with the same functions as OPS5 and in addition it can process uncertain knowledge.
In the literature, we can find other fuzzy expert system shells[3][4] based on OPS5. FOPS5 has different strategies for fuzzy information processing from them : It uses different methods for fuzzy matching and comparison, and different representation for fuzziness and uncertainty. In addition, it can fully support fuzzy inferencing and provide flexible services for fuzzy information processing.
FOPS5 uses certainty factor (CF) whose value is in [0,9] to represent uncertainty of rules and working memory elements(WMEs, facts). A WME has only one CF(i.e., each attribute of WME does not have its own CF).
To represent fuzzy concepts, fuzzy values can be used as attribute values of rules and WMEs. In FOPS5, fuzzy values are restricted to fuzzy sets defined in the number domains(e.g. real numbers, integers). Here, fuzzy values indicate linguistic terms defined by possibility distribution[17].
Knowledge base is composed of rules and WMEs. Rules can be grouped into conventional production rules(p rules in OPS5) and fuzzy production rulebases. Fuzzy production rulebase consists of a collection of fuzzy rules whose all antecedent(left hand side, LHS) and consequent(right hand side, RHS) attributes have only fuzzy values.
The paper is organized as follows. Section 2 presents fuzzy knowledge processing of FOPS5 such as fuzzy matching, fuzzy comparison, uncertainty propagation, and memory update. Section 3 describes the design and implementation of FOPS5. Finally, section 4 draws a conclusion.
2 Fuzzy Information Processing
2.1 Fuzzy Matching and Fuzzy Comparison
By introducing fuzzy values and certainty factors in the knowledge representation, we have some problems to be solved: fuzzy matching, fuzzy comparison, uncertainty propagation.
Since the attributes can have fuzzy values, the possible combinations of rules and WMEs can be shown in Table 1, according to the properties of attribute values in LHS and RHS of rule and WMEs to be matched.
Among the eight possible combinations, the conventional expert system shells support only the case 8 (crisp rule: crisp WME). For other cases but the case 6, some special treatments are needed to process the matching between fuzzy values and between fuzzy value and crisp value.
The cases 5 and 7 are the special cases (rule with crisp LHS: fuzzy WME) to which there has been as yet no expert system shell to tackle. In spite of that, these cases are prone to happen in the real world. Suppose a rule that if height is 170cm then clothes size is L type and a fact that Kim is tall. In this situation, it makes sense to infer that it is highly possible that Kim's clothes size is L type.
<table>
<thead>
<tr>
<th>case</th>
<th>LHS of rule</th>
<th>RHS of rule</th>
<th>matched WME</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>fuzzy</td>
<td>fuzzy</td>
<td>fuzzy</td>
</tr>
<tr>
<td>2</td>
<td>fuzzy</td>
<td>fuzzy</td>
<td>crisp</td>
</tr>
<tr>
<td>3</td>
<td>fuzzy</td>
<td>crisp</td>
<td>fuzzy</td>
</tr>
<tr>
<td>4</td>
<td>fuzzy</td>
<td>crisp</td>
<td>crisp</td>
</tr>
<tr>
<td>5</td>
<td>crisp</td>
<td>fuzzy</td>
<td>fuzzy</td>
</tr>
<tr>
<td>6</td>
<td>crisp</td>
<td>fuzzy</td>
<td>crisp</td>
</tr>
<tr>
<td>7</td>
<td>crisp</td>
<td>crisp</td>
<td>fuzzy</td>
</tr>
<tr>
<td>8</td>
<td>crisp</td>
<td>crisp</td>
<td>crisp</td>
</tr>
</tbody>
</table>
FOPPS5 is developed to handle the above all cases. The combinations of the cases 1 and 2 can be processed by the fuzzy inference method such as the compositional rule of inference (CRI) method [17], etc. In the practical knowledge representation, fuzzy values, crisp values and relational comparisons may be mixed up in the LHS of rules. Consider the following rule and WMEs excerpted from a cow-bull mating knowledge base used in the milk producing farms.
IF (X.sex is cow) and (Y.sex is bull) and (X.height is short) and (Y.height is tall) and (X.age is 5) and (X.strength < Y.strength) THEN (X.mate is Y) and (Y.fitness is good)
(X: sex is cow, age is young, height is 160cm, strength is weak) (Y: sex is bull, age is 7, height is middle, strength is normal)
Figure 1: An example of fuzzy knowledge base
In the above, the linguistic terms short, tall, good, young, weak, middle and normal are fuzzy values. The LHS of the rule consists of a crisp part (X: mate is Y) and a fuzzy part (Y: fitness is good). When the two WMEs are given to the rule, the inference engine has to perform three fuzzy matching (short: 160 [case 2,4], tall: middle [case 1,3], 5: young [case 5,7]) and a fuzzy comparison (weak < normal). Here, we can apply the CRI type fuzzy inference to the rule since it has fuzzy values in both its LHS (short, tall) and RHS (good). In this situation, it is doubtful whether it is meaningful to modify the value of Y: fitness by fuzzy inferencing.
In the situation that fuzzy values, crisp values and relational comparison predicates are mixed, thus, FOP5 reflects only the matching degree of the LHS to the certainty of the inferred results (i.e., results produced by the RHS of fired rule) without applying fuzzy inferencing to such rules.
Meanwhile, for the purpose of fuzzy inferencing, FOP5 has a mechanism to handle a collection of fuzzy rules whose LHS and RHS attributes have only fuzzy values in a module. It makes it possible to define a set of fuzzy rules as a module and to apply fuzzy inference to the module. On fuzzy inferencing, all fuzzy rules of the module are executed in parallel.
2.2 Measures for Fuzzy Matching
To evaluate the matching degree of fuzzy LHS and fuzzy/crisp WMEs as in the cases 1 to 4, we propose the following measures. The measures have a value within the interval [0,1]. The value 0 indicates the mismatch, whereas 1 indicates the full match. The more closely WME matches LHS, the greater the value of measure is. Here, A is a fuzzy value of LHS, and B and c are a fuzzy value and a crisp value of WMEs, respectively. \( A^\alpha \) is the \( \alpha \)-cut [17] of A and \( |A^\alpha| \) is the interval length of \( A^\alpha \).
- Matching degree \( M(A, B) \) of fuzzy LHS value A and fuzzy WME value B :
\[
M(A, B) = \int_0^1 \frac{|A^\alpha \cap B^\alpha|}{|B^\alpha|} d\alpha
\]
The measure \( M(A, B) \) embodies the entailment principle [17]. That is, when \( A \equiv B \) or \( A \supset B \), \( M(A, B) \) is equal to 1.
- Matching degree \( M(A, c) \) of fuzzy LHS value A and crisp WME value c :
\[
M(A, c) = \mu_A(c)
\]
For the cases 5 and 7, we use the measure \( M(c, A) \) to estimate the matching degree of crisp LHS c and fuzzy WME A. In the following formula, \( X \) denotes the universe of discourse for the fuzzy value A, \( Supp(A) \) denotes the support of the fuzzy value A, and \( \mu_A(c) \) is the membership degree of c against A.
\[
M(c, A) = (1 - \frac{|Supp(A)|}{|X|})(1 - \frac{\int_{-\infty}^{c} \mu_A(x) dx}{|Supp(A)|})\mu_A(c)
\]
The measure \( M(c, A) \) gives more larger value as the \( |Supp(A)| \) is shorter, the shape of A is thinner and \( \mu_A(c) \) is larger.
2.3 Measures for Fuzzy Comparison
To allow the fuzzy comparisons in the LHS of rules, we propose the following measures for the comparison between fuzzy values and between fuzzy value and crisp value. The measures take as their range the interval $[0,1]$, and gives larger value as the satisfaction degree of comparison grows. In the formula, $I_{B>A}^o$ denotes the part of $B^o$ which is greater than $\max\{A^o\}$ and $I_{A>c}^o$ denotes the part of $A^o$ greater than $c$.
- Fuzzy comparisons between fuzzy value $A$ and fuzzy value $B$ :
$$M(A > B) = \int_0^1 \frac{|f_{A>B}^o| + 0.5|A^o \cap B^o|}{|A^o| + |I_{B>A}^o|} \, d\alpha$$
$$M(A \geq B) = \int_0^1 \frac{|f_{A\geq B}^o| + |A^o \cap B^o|}{|A^o| + |I_{B>A}^o|} \, d\alpha$$
$$M(A < B) = \int_0^1 \frac{|f_{A<B}^o| + 0.5|A^o \cap B^o|}{|B^o| + |I_{B<A}^o|} \, d\alpha$$
$$M(A \leq B) = \int_0^1 \frac{|f_{A\leq B}^o| + |A^o \cap B^o|}{|B^o| + |I_{B<A}^o|} \, d\alpha$$
$$M(A = B) = \int_0^1 \frac{|A^o \cap B^o|}{|A^0 \cup B^0|} \, d\alpha$$
$$M(A <> B) = 1 - M(A = B)$$
- Fuzzy comparisons between fuzzy value $A$ and crisp value $c$ :
$$M(A > c) = M(A \geq c) = \int_0^1 \frac{|f_{A>c}^o|}{|A^o|} \, d\alpha$$
$$M(A < c) = M(A \leq c) = \int_0^1 \frac{|f_{A<c}^o|}{|A^o|} \, d\alpha$$
$$M(A = c) = (1 - \frac{1}{|\text{Supp}(A)|}) \int_{-\infty}^{\infty} \frac{\mu_A(x) \, dx}{\text{Supp}(A)} = \mu_A(c)$$
$$M(A <> c) = 1 - M(A = c)$$
2.4 Uncertainty Propagation
Each rule and WME have a certainty factor to represent uncertainty. To determine the certainty factor of the inferred result, the certainty factors of rule and WMEs and the matching degree of LHS are combined.
We take as the matching degree $\beta$ of LHS the minimum value among the matching degrees of fuzzy matchings and fuzzy comparisons and the certainty factors $\lambda$ of matched WMEs. We regard the certainty factor $\gamma$ of the inferred result as the multiplication of the matching degree $\beta$ and the certainty factor $\tau$ of rule.
Each rule has a threshold value $\Gamma$. So only the rules whose matching degree $\beta$ is greater than or equal to the threshold $\Gamma$, can be fired.
2.5 Memory Update
There are three commands make, modify, delete in the RHS of rule that can change working memory(WM). When these commands are met in the course of inferencing, they are managed in the following way.
make When the certainty factor $\gamma$ of inferred result is greater than or equal to the threshold $\Gamma$ of its corresponding rule, we create a new WME with the certainty factor $\gamma$.
modify When a non-assigned attribute is modified, the attribute is assigned with the inferred result and the certainty factor of its corresponding WME is updated with the minimum value of the original certainty factor and the inferred certainty factor $\gamma$.
When we intend to modify an already assigned attribute, we can modify it only if the certainty factor $\gamma$ of inferred result is greater than or equal to that of its corresponding WME.
delete When the certainty factor of WME is greater than or equal to that of inferred result, we remove the WME from WM.
3 FOPS5 (Fuzzy extended OPS5)
3.1 Syntax
The syntax of FOPS5 is taken after that of OPS5 and extended to represent fuzzy values and certainty factors. Thus the application programs written in OPS5 can be recognized in FOPS5.
(p select_mate [0.9]
{<num> (cow "strength <A> "height short "N-candidate <val>)
(bull "strength > <A> "height tall)
--->
(modify <num> "status marked "N-candidate (compute <val> + 1))
(make candidate "name <N> "fitness good)
)
(make cow [1.0] "name Gerritt "age 4 "height 160 "N-candidate 0
"status unmarked "strength strong)
Figure 2: Examples of FOPS5 syntax
In the above example, the terms short, tall, good, strong and good indicate fuzzy values, and [0.9] and [1.0] indicate certainty factors.
By introducing fuzzy values, FOPS5 has to provide some functions for membership function definition of fuzzy values (linguistic terms), linguistic term registration to attributes, definition of fuzzy proposition rulebase, usage of fuzzy proposition rulebase, and so on.
3.2 Definition of membership function
Fuzzy values are defined by parameterized membership functions (triangular(tri) / trapezoidal(trap) fuzzy numbers) or paired(paired) representation as follows:
(tri 1 2.5 3) : triangular fuzzy number
(trap 1 2 3 4) : trapezoidal fuzzy number
(paired (1 0.2) (2 0.4) (3 0.8) (4 0.6)) : paired representation
Figure 3: Examples of membership function definition
3.3 Linguistic term registration to attribute
To register linguistic terms to attributes, the top-level command fzterm is provided as follows:
(fzterm class-name ~attribute-name
(fzterm1 membership-function-defn)
(fzterm2 membership-function-defn))
In the above, class-name and attribute-name indicate the class of WME and attribute to which linguistic terms are registered, fzterm1 and fzterm2 denote the name of linguistic terms and membership-function-defn the membership function definition given in the above example.
3.4 Definition of fuzzy production rulebase
To define fuzzy production rulebases, FOPS5 provides the command fzrule. The following example shows an example of fuzzy production rulebase.
(fzrule heath-estimate-RB
(inference Max-Min-CRI) ; inference method
(defuz COG) ; defuzzification method
(4 : weight height : health) ; # of rules : input var's : output var's
(fzterm ; definition of fuzzy terms
(weight (light (trap 0 0 50 70))
(heavy (trap 50 70 100 100)))
(height (short (trap 0 0 155 175))
(tall (trap 155 175 200 200)))
(health (bad (trap 0 0 4 6))
(good (trap 4 6 10 10))))
(rules ; rule bases
(~weight heavy ~height short --> ~health bad)
(~weight heavy ~height tall --> ~health good)
(~weight light ~height tall --> ~health good)
(~weight light ~height short --> ~health bad))
Figure 4: Example of fuzzy production rulebase definition
3.5 Usage of fuzzy production rulebase
To invoke fuzzy inferencing for fuzzy production rulebase, the command \texttt{fzinfer} is provided which can be used at the top-level and the RHS of rule.
\begin{verbatim}
(fzinfer heath-estimate-RB
(~weight [very heavy])
(~height [tri 165 170 175]))
\end{verbatim}
3.6 Fuzzy Inferencing
There are two commands \texttt{p}, \texttt{fzrule} to define rules in FOPS5. The command \texttt{p} plays the role of defining the same kind of rules as \texttt{p} of OPS5. For these rules, fuzzy values are allowed as attribute values and a certainty factor is given. The command \texttt{fzrule} takes charge of defining fuzzy production rulebases.
FOPS5 does not apply fuzzy inferencing to rules defined by \texttt{p} command. Instead of that, the matching degree between LHS of rule and WMEs is evaluated and it is reflected to the certainty factor of the inferred results. FOPS5 uses the proposed measures for fuzzy matching and comparison to evaluate matching degree. FOPS5 applies fuzzy inferencing to rules defined by \texttt{fzrule} command.
In Table 1, we can handle the cases 1 and 2 by using \texttt{fzrule} command and the cases 3 to 8 by using \texttt{p} command.
3.7 Inference Engine
The inference engine of FOPS5 cycles over the three steps of \texttt{match}, \texttt{select} and \texttt{execute}. In the match step, the instantiation of each rule is found. The instantiation is an ordered pair whose first item is the name of a rule and whose second item is a list of WMEs that match the LHS of rule with a consistent set of bindings. In the selection step, when there are more than one rule instantiations one instantiation is selected for firing. In the execution step, the actions of the RHS of the selected rule are performed.
To make the matching operations efficient the RETE match algorithm[6] is used in the match step. As the selection strategy, FOPS5 provides the modified MEA and LEX algorithm[2] which consider matching degree as well as recency.
FOPS5 is implemented with Common Lisp language on SPARC workstation.
4 Conclusion
In this paper, we investigate the problems to be solved when we allow fuzzy values and certainty factors to rules and facts. We propose some methods to manage fuzzy matchings and fuzzy comparisons which are incurred by permitting fuzzy values in the attribute values. In addition, an inference strategy for these knowledge bases is proposed.
In the proposed platform, the fuzzy information processing is flexibly supported: The CRI-type fuzzy inference as well as the conventional (match-execute type) inference are fully supported. When some fuzzy facts are given, it is possible to infer some meaningful information from crisp rules.
On the basis of the proposed methods, we present an fuzzy expert system shell called FOPS5 which extends OPS5 to accommodate fuzzy information processing. FOPS5 has the role as the conventional expert system shell OPS5. In addition, it can support fuzzy inferencing and provides flexible services for fuzzy information processing.
References
|
{"Source-Url": "https://koasas.kaist.ac.kr/bitstream/10203/22381/1/%ea%b7%9c%ec%b9%99%20%ea%b8%b0%eb%b0%98%20%ec%8b%9c%ec%8a%a4%ed%85%9c%ec%97%90%ec%84%9c%ec%9d%98%20%ed%8d%bc%ec%a7%80%ec%a0%95%eb%b3%b4%ec%b2%98%eb%a6%ac.pdf", "len_cl100k_base": 5575, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 10690, "total-output-tokens": 6680, "length": "2e12", "weborganizer": {"__label__adult": 0.0003528594970703125, "__label__art_design": 0.0005621910095214844, "__label__crime_law": 0.0006580352783203125, "__label__education_jobs": 0.0016145706176757812, "__label__entertainment": 0.00012826919555664062, "__label__fashion_beauty": 0.00019872188568115232, "__label__finance_business": 0.0012731552124023438, "__label__food_dining": 0.0005931854248046875, "__label__games": 0.0011644363403320312, "__label__hardware": 0.0010890960693359375, "__label__health": 0.0008053779602050781, "__label__history": 0.0003414154052734375, "__label__home_hobbies": 0.00017321109771728516, "__label__industrial": 0.0016880035400390625, "__label__literature": 0.0005269050598144531, "__label__politics": 0.0004277229309082031, "__label__religion": 0.0005946159362792969, "__label__science_tech": 0.32275390625, "__label__social_life": 0.00014400482177734375, "__label__software": 0.034423828125, "__label__software_dev": 0.62939453125, "__label__sports_fitness": 0.0002999305725097656, "__label__transportation": 0.0005297660827636719, "__label__travel": 0.0001928806304931641}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 20707, 0.03801]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 20707, 0.60324]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 20707, 0.83497]], "google_gemma-3-12b-it_contains_pii": [[0, 1020, false], [1020, 3881, null], [3881, 6279, null], [6279, 9148, null], [9148, 11518, null], [11518, 13349, null], [13349, 15138, null], [15138, 17875, null], [17875, 19973, null], [19973, 20707, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1020, true], [1020, 3881, null], [3881, 6279, null], [6279, 9148, null], [9148, 11518, null], [11518, 13349, null], [13349, 15138, null], [15138, 17875, null], [17875, 19973, null], [19973, 20707, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 20707, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 20707, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 20707, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 20707, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 20707, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 20707, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 20707, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 20707, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 20707, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 20707, null]], "pdf_page_numbers": [[0, 1020, 1], [1020, 3881, 2], [3881, 6279, 3], [6279, 9148, 4], [9148, 11518, 5], [11518, 13349, 6], [13349, 15138, 7], [15138, 17875, 8], [17875, 19973, 9], [19973, 20707, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 20707, 0.06098]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
6c4a5e559edb7cd282b490169bc0e882816b2e0a
|
[REMOVED]
|
{"Source-Url": "https://inria.hal.science/hal-02331334v1/document", "len_cl100k_base": 4639, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 21559, "total-output-tokens": 5480, "length": "2e12", "weborganizer": {"__label__adult": 0.0006170272827148438, "__label__art_design": 0.0010385513305664062, "__label__crime_law": 0.0009918212890625, "__label__education_jobs": 0.040679931640625, "__label__entertainment": 0.0003387928009033203, "__label__fashion_beauty": 0.0003812313079833984, "__label__finance_business": 0.0006785392761230469, "__label__food_dining": 0.0010843276977539062, "__label__games": 0.00432586669921875, "__label__hardware": 0.0011730194091796875, "__label__health": 0.0014925003051757812, "__label__history": 0.0008258819580078125, "__label__home_hobbies": 0.00032329559326171875, "__label__industrial": 0.0012521743774414062, "__label__literature": 0.0013494491577148438, "__label__politics": 0.0008997917175292969, "__label__religion": 0.0009918212890625, "__label__science_tech": 0.23681640625, "__label__social_life": 0.0005068778991699219, "__label__software": 0.015655517578125, "__label__software_dev": 0.68505859375, "__label__sports_fitness": 0.0014677047729492188, "__label__transportation": 0.0014057159423828125, "__label__travel": 0.0004162788391113281}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 23429, 0.02664]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 23429, 0.35848]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 23429, 0.90991]], "google_gemma-3-12b-it_contains_pii": [[0, 1221, false], [1221, 3641, null], [3641, 6259, null], [6259, 9162, null], [9162, 12038, null], [12038, 14794, null], [14794, 17914, null], [17914, 20248, null], [20248, 23429, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1221, true], [1221, 3641, null], [3641, 6259, null], [6259, 9162, null], [9162, 12038, null], [12038, 14794, null], [14794, 17914, null], [17914, 20248, null], [20248, 23429, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 23429, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 23429, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 23429, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 23429, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 23429, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 23429, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 23429, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 23429, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 23429, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 23429, null]], "pdf_page_numbers": [[0, 1221, 1], [1221, 3641, 2], [3641, 6259, 3], [6259, 9162, 4], [9162, 12038, 5], [12038, 14794, 6], [14794, 17914, 7], [17914, 20248, 8], [20248, 23429, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 23429, 0.0198]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
ffa02ffbcd83a0aa9e3b904075135673bd4bd2c5
|
Ruby Extension Library Verified using Coq Proof-assistant
Tanaka Akira
National Institute of Advanced Industrial Science and Technology (AIST)
RubyKaigi 2017
2017-09-20
About This Talk
• Formal verification for fast & safe program in C
• Quality assurance other than test
Materials
- Ruby
- Coq
- C
- HTML escape
- Intel SSE
Do you know all of them?
Coq Proof-assistant
• Proof assistant
– Programmer writes a proof
– Coq checks the proof
• Coq has ML-like language, Gallina
– Powerful type system
– Gallina programs can be proved
• Program Extraction to OCaml, Haskell and Scheme
• C code generation by our plugin
https://github.com/akr/codegen
Development Flow
1. In Coq
i. Define a specification and implementation
ii. Verify them
iii. Convert the implementation into C
2. In C
i. Define supplemental code
ii. Define glue code for Ruby
3. In Ruby
i. Use the verified implementation
Benefits of Verification
• Correct
• Fast
Compared to:
• C: fast but dangerous
• Ruby: safe but slow
Simple Example: pow
Specification of power function in Gallina:
(* pow a k = a ** k *)
Fixpoint pow a k :=
match k with
| 0 => 1
| k'.+1 => a * pow a k'
end.
Good: Obviously correct
Bad: Naive algorithm
Bad: (non-tail) recursion
Complex but Fast pow
Definition uphalf' n := n – n./2.
(* fastpow_iter a k x = (a ** k) * x *)
Fixpoint fastpow_iter a k x :=
if k is k'.+1 then
if odd k then
fastpow_iter a k' (a * x)
else
fastpow_iter (a * a) (uphalf' k') x
else
x.
Definition fastpow a k := fastpow_iter a k 1.
Complex and Fast $\text{pow} \ (2)$
Bad: Not obviously correct
Good: Fast algorithm
Good: Tail recursion
Correctness for fastpow
• We can prove equality of fastpow and pow in Coq
Lemma fastpow_pow a k : fastpow a k = pow a k.
Proof. (snip) Qed.
• This is the evidence that fastpow is correct
• The proof is snipped because Coq proof is unreadable
(interactive environment is required to read proof)
Code Generation from fastpow
```
nat n3_fastpow_iter(nat v2_a, nat v1_k, nat v0_x) {
n3_fastpow_iter:;
switch (sw_nat(v1_k)) {
case_O_nat: { return v0_x; }
case_S_nat: {
nat v4_k_ = field0_S_nat(v1_k);
bool v5_b = n1_odd(v1_k);
switch (sw_bool(v5_b)) {
case_true_bool: {
nat v6_n = n2_muln(v2_a, v0_x);
v1_k = v4_k_; v0_x = v6_n; goto n3_fastpow_iter; }
case_false_bool: {
nat v7_n = n2_muln(v2_a, v2_a);
nat v8_n = n1_uphalf_(v4_k_);
v2_a = v7_n; v1_k = v8_n; goto n3_fastpow_iter; }
}
}
}
}
nat n2_fastpow(nat v10_a, nat v9_k) {
nat v11_n = n0_O();
nat v12_n = n1_S(v11_n);
return n3_fastpow_iter(v10_a, v9_k, v12_n); }
```
Primitives for fastpow
• Types
– bool: Boolean
– nat: Peano's natural number
• Functions
– odd: nat → bool
– muln: nat → nat → nat
bool
- Coq definition
Inductive bool : Set :=
| true : bool
| false : bool.
- C Implementation
/* bool type */
#include <stdbool.h>
/* macros for "match" */
#define sw_bool(b) (b)
#define case_true_bool default
#define case_false_bool case false
/* constructors */
#define n0_true() true
#define n0_false() false
nat (Peano's natural number)
• Coq definition
Inductive nat : Set :=
| O : nat (* zero *)
| S : nat → nat. (* successor function *)
• C Implementation
typedef uint64_t nat;
#define n0_O() ((nat)0)
#define n1_S(n) ((n)+1)
#define sw_nat(n) (n)
#define case_O_nat case 0
#define case_S_nat default
#define field0_S_nat(n) ((n)-1)
/* primitive functions */
#define n2_addn(a,b) ((a)+(b))
#define n2_subn(a,b) ((a)-(b))
#define n2_muln(a,b) ((a)*(b))
#define n2_divn(a,b) ((a)/(b))
#define n2_modn(a,b) ((a)%(b))
#define n1_odd(n) ((n)&1)
Verified Program Development
• Describe a program in Gallina
• Describe a proposition (Gallina type)
• Describe a proof (Gallina program)
• Coq checks the proof (type check)
• C code generation from the Gallina program
• Define supplemental C code
Curry-Howard Correspondence
They have same structure:
• proposition $\sim$ type
• proof $\sim$ program
"Prove a proposition" = "Write a program of the correspond type"
Example: \( A \land B \)
- **proof**
- \( A, B \) : propositions
- \( A \land B \) : proposition of "A and B".
- proof for \( A \land B \) : pair of proof for \( A \) and proof for \( B \)
- **program**
- \( A, B \) : types
- \( A \land B \) : pair of \( A \) and \( B \)
- type \( A\text{and}B = A \times B \)
- value of \( A \land B \) : pair of value of \( A \) and a value of \( B \)
Logical Formulae
• Propositional logic
– and : type AandB = A * B
– or : type AorB = a of A | b of B
– imply : type AimplyB = A → B
• Predicate logic (dependent types)
– ∀x:A. B : A → B
– ∃x:A. B : pair of x and proof of B
– x = y : equality
Specification and Correctness
- $\text{spec}(x) = \text{obviously-correct-function}$
- $\text{imp}(x) = \text{complex-function}$
- proposition of correctness:
$\forall x. \text{imp}(x) = \text{spec}(x)$
(Other form of specification is possible...)
Code Generation to C
• C code generation by our plugin
https://github.com/akr/codegen
• Simple mapping from Gallina subset to C
• Tail recursion is translated to goto
• Fully customizable implementation of data types
What is Verified?
Verified:
• The algorithm of fastpow
Not Verified
• Translation mechanism to C
• Implementation of primitives: bool, nat, muln, odd
Not Explained
• Program failures (such as integer overflow)
It is possible to prove about program failures using our monadification plugin. But we ignore this issue today.
HTML Escape
CGI.escapeHTML substitutes five characters in a string:
& → &
< → <
> → >
" → "
' → '
We ignore non-ASCII characters for simplicity.
HTML Escape Specification
Definition html_escape_alist :=
map (fun p => (p.1, seq_of_str p.2)) [::
("&"%char, "amp"); ("<"%char, "lt"); (">"%char, "gt");
("""%char, "quot"); ("""%char, "#39") ].
Definition html_escape_byte c :=
if assoc c html_escape_alist is Some p then
"&" ++ p.2 ++ ";
else
[:: c].
Definition html_escape s := flatten (map html_escape_byte s).
This seems correct but doesn't work optimal in C: list (seq) and higher order function
Primitive Types for HTML Escape
We need char* for efficiency
Coq C
bool → bool
nat → uint64_t
ascii → unsigned char
byteptr → char*
buffer → Ruby's VALUE (String)
ascii type (unsigned char)
• Coq definition
(* ascii is 8 booleans *)
Inductive ascii : Set := Ascii (_ _ _ _ _ _ _ _ : bool).
• C Implementation
typedef unsigned char ascii;
byteptr type (char*)
• Required operations to scan a memory region: advance a pointer, dereference a pointer
• Coq definition
"char*" is represented using a list of ascii and an index in it.
Inductive byteptr := bptr : nat → seq ascii → byteptr.
bptradd (bptr i s) n = bptr (i + n) s
bptrget (bptr i s) = nth "000"%char s i
• C Implementation
typedef const char *byteptr;
#define n2_bpstradd(p, n) (p + n)
#define n1_bpstrget(p) (*(unsigned char *)p)
buffer type (VALUE)
• Required operation for result buffer: add data at end of buffer
• Coq definition
Inductive buffer := bufctr of seq ascii.
Definition bufaddmem buf ptr n := ...
• C Implementation
– buffer: VALUE (String)
– bufaddmem: rb_str_buf_cat
• bufaddmem is pure but rb_str_buf_cat is destructive. This problem is solved by copying the string when necessary
Tail Recursive HTML Escape
Translatable to C
Fixpoint trec_html_escape buf ptr n :=
match n with
| 0 => buf
| n'.+1 =>
let: (escptr, escn) :=
html_escape_byte_table (bptrget ptr) in
trec_html_escape
(bufaddmem buf escptr escn)
(bptradd ptr 1)
n'
end.
Correctness of Tail Recursive HTML Escape
- Definition \( \text{trec\_html\_escape\_stub} \ s := \text{s\_of\_buf} \ (\text{trec\_html\_escape} \ (\text{bufctr} [::]) \ (\text{bptr} 0 \ s) \ (\text{size} s)). \)
- Lemma \( \text{trec\_html\_escape\_ok} \ s : \ \text{trec\_html\_escape\_stub} \ s = \text{html\_escape} \ s. \)
Proof. (snip) Qed.
buffer n3_trec_html_escape(buffer v2_buf, byteptr v1_ptr, nat v0_n) {
n3_trec_html_escape:;
switch (sw_nat(v0_n)) {
case_O_nat: { return v2_buf; }
case_S_nat: {
nat v4_n_ = field0_S_nat(v0_n);
ascii v5_a = n1_bptrget(v1_ptr);
prod_byteptr_nat v6_p = n1_html_escape_byte_table(v5_a);
byteptr v7_escptr = field0_pair_prod_byteptr_nat(v6_p);
nat v8_escn = field1_pair_prod_byteptr_nat(v6_p);
buffer v9_b = n3_bufaddmem(v2_buf, v7_escptr, v8_escn);
nat v10_n = n0_O();
nat v11_n = n1_S(v10_n);
byteptr v12_b = n2_bptradd(v1_ptr, v11_n);
v2_buf = v9_b;
v1_ptr = v12_b;
v0_n = v4_n_;
goto n3_trec_html_escape; } } }
Primitive Type for SSE
• m128 → __m128i
• __m128i is defined by intrinsics for SSE
m128 type
- m128 consists 16 bytes. (SSE register is 128 bits)
- Coq definition
Inductive m128 := c128 :
ascii → ascii → ascii → ascii → ascii → ascii → ascii → ascii →
ascii → ascii → ascii → ascii → ascii → ascii → ascii → ascii → m128.
Definition m128_of_seq s := c128
(nth "000"%char s 0) ...(snip)...
(nth "000"%char s 15).
Definition m128_of_bptr ptr :=
m128_of_seq (drop (i_of_bptr ptr) (s_of_bptr ptr)).
- C Implementation
typedef __m128i m128;
#define n1_m128_of_bptr(p) _mm_loadu_si128((__m128i const*)(p))
SSE pcmpestri instruction
• pcmpestri is a SSE4.2 instruction
Packed Compare Explicit Length Strings, Return Index
• Coq definition
Definition cmpestri_ubyte_eqany_ppol_lsig
(a : m128) (la : nat) (b : m128) (lb : nat) :=
let sa := take la (seq_of_m128 a) in
let sb := take lb (seq_of_m128 b) in
let p := mem sa in
if has p sb then find p sb else 16.
• C Implementation
#define n4_cmpestri_ubyte_eqany_ppol_lsig(a, la, b, lb) \n _mm_cmpestri(a, la, b, lb, \n _SIDD_UBYTE_OPS|_SIDD_CMP_EQUAL_ANY| \n _SIDD_POSITIVE_POLARITY|_SIDD_LEAST_SIGNIFICANT)
• _mm_cmpestri is SSE intrinsic function which generates pcmpestri.
Fixpoint sse_html_escape buf ptr m n :=
match n with
| 0 => bufaddmem buf ptr m
| n'.+1 =>
let p1 := bptradd ptr m in
if n <= 15 then
trec_html_escape (bufaddmem buf ptr m) p1 n
else
let i := cmpestri_ubyte_eqany_ppol_lsig
chars_to_escape num_chars_to_escape
(m128_of_bptr p1) 16 in
if 16 <= i then
sse_html_escape buf ptr (m + 16) (n' - 15)
else
let buf2 := bufaddmem buf ptr (m + i) in
let p2 := bptradd ptr (m + i) in
let c := bptrget p2 in
let p3 := bptradd p2 1 in
let: (escptr, escn) := html_escape_byte_table c in
let buf3 := bufaddmem buf2 escptr escn in
sse_html_escape buf3 p3 0 (n' - i)
end.
Correctness of HTML Escape using SSE
• Definition sse_html_escape_stub s := s_of_buf (sse_html_escape (bufctr [:::]) (bptr 0 s) 0 (size s)).
• Lemma sse_html_escape_ok s : sse_html_escape_stub s = html_escape s. Proof. (snip) Qed.
Glue Code for Ruby Extension
VALUE
sse_html_escape(VALUE self, VALUE str)
{
buffer buf;
StringValue(str);
RB_GC_GUARD(str);
buf = buffer_new(RSTRING_LEN(str));
n4_sse_html_escape(buf, RSTRING_PTR(str), 0, RSTRING_LEN(str));
return buf.str;
}
void
Init_verified_html_escape()
{
rb_define_global_function("sse_html_escape", sse_html_escape, 1);
}
Test
% ruby -l. -rverified_html_escape \
-e 'p sse_html_escape("x&y")'
"x&y"
Benchmark
- Benchmark results show that:
- Benchmark escape is fastest for few escaping characters.
- CGI.escapeHTML is fast enough.
- Tail recursive (non-SSE) escape is slow (rb_str_buf_cat is called for each byte).
- SSE escape is slowest for too many escaping characters.
Graphical representation:
- X-axis: Escape character ratio
- Y-axis: Time / size [s/byte]
- Lines indicate performance of different methods:
- CGI.escapeHTML
- sse_html_escape
- trec_html_escape
Graph notes:
- SSE escape is fastest for few escaping characters.
- CGI.escapeHTML is fast enough.
- Tail recursive (non-SSE) escape is slow (rb_str_buf_cat is called for each byte).
- SSE escape is slowest for too many escaping characters.
Some Thoughts
• pcmpestrm instruction would be faster than pcmpestrmi.
Encouragement of Coq
• Realistic programming is possible
• You will learn about "correctness" more precisely
How to write a correct program
Think program's behavior seriously
No tool can support non-thinking person
Think Seriously
Most real programs are too complex to think in a brain
We need an external tool to think the behavior:
• Write the behavior
• Read it and re-thinking
Write the behavior in ...
• Natural language
– Good: Very flexible
– Bad: Too flexible, no automatic checking
• Programming language
– Good: Actually works and testable
– Bad: Ad-hoc test is very sparse
• Test driven development (TDD)
– Good: Many examples make us more thinking
– Bad: Not possible to test all (infinite) inputs
• Formal verification
– Good: Coq forces us to think correctness for all inputs
– Bad: Proof is tedious
Importance of learning formal verification
• You will learn how to describe correctness very preciously.
• As you learned how to describe behavior very preciously by learning programming
Summary
• Correct and fast C function can be generated from Coq
• The function is usable from Ruby
• Encourage Coq to learn about correctness
Extra Slides
Benchmark Script
require 'cgi'
require 'verified_html_escape'
methods = %w[sse_html_escape trec_html_escape CGI.escapeHTML]
puts "size[byte],method,esc_ratio,time[s]"
max_size = 40000
num_sizes = 200
num_ratios = 50
code = []
methods.each { |meth|
num_sizes.times {
num_ratios.times {
sz = 1+rand(max_size-1)
esc_ratio = rand
code << <<~End
sz = #{sz}
meth = #{meth.dump}
esc_ratio = #{esc_ratio}
num_escape = (sz * esc_ratio).to_i
src = (["a"] * (sz - num_escape) + ["&"] * num_escape).shuffle.join
GC.disable
t1 = Process.clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID)
dst = #{meth}(src)
t2 = Process.clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID)
GC.enable
t = t2-t1
puts "#{sz},#{meth},#{esc_ratio},#{t}"
End
}
}
}
eval code.shuffle.join
|
{"Source-Url": "http://www.a-k-r.org/pub/2017-09-20-akr-rubykaigi.pdf", "len_cl100k_base": 4346, "olmocr-version": "0.1.50", "pdf-total-pages": 47, "total-fallback-pages": 0, "total-input-tokens": 61677, "total-output-tokens": 6340, "length": "2e12", "weborganizer": {"__label__adult": 0.00036525726318359375, "__label__art_design": 0.0002112388610839844, "__label__crime_law": 0.0002677440643310547, "__label__education_jobs": 0.0005254745483398438, "__label__entertainment": 4.351139068603515e-05, "__label__fashion_beauty": 0.00012969970703125, "__label__finance_business": 0.0001430511474609375, "__label__food_dining": 0.0003917217254638672, "__label__games": 0.00039458274841308594, "__label__hardware": 0.0008006095886230469, "__label__health": 0.0003664493560791016, "__label__history": 0.00012600421905517578, "__label__home_hobbies": 8.243322372436523e-05, "__label__industrial": 0.0003533363342285156, "__label__literature": 0.0001533031463623047, "__label__politics": 0.0001951456069946289, "__label__religion": 0.0003840923309326172, "__label__science_tech": 0.003978729248046875, "__label__social_life": 8.32676887512207e-05, "__label__software": 0.0026874542236328125, "__label__software_dev": 0.9873046875, "__label__sports_fitness": 0.0003452301025390625, "__label__transportation": 0.00042819976806640625, "__label__travel": 0.00016129016876220703}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 14591, 0.0228]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 14591, 0.78865]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 14591, 0.57365]], "google_gemma-3-12b-it_contains_pii": [[0, 170, false], [170, 274, null], [274, 354, null], [354, 661, null], [661, 921, null], [921, 1024, null], [1024, 1264, null], [1264, 1573, null], [1573, 1679, null], [1679, 1978, null], [1978, 2834, null], [2834, 2975, null], [2975, 3299, null], [3299, 3850, null], [3850, 4099, null], [4099, 4270, null], [4270, 4676, null], [4676, 4932, null], [4932, 5185, null], [5185, 5406, null], [5406, 5733, null], [5733, 5901, null], [5901, 6382, null], [6382, 6550, null], [6550, 6733, null], [6733, 7201, null], [7201, 7582, null], [7582, 7899, null], [7899, 8250, null], [8250, 9040, null], [9040, 9124, null], [9124, 9658, null], [9658, 10312, null], [10312, 11039, null], [11039, 11272, null], [11272, 11646, null], [11646, 11731, null], [11731, 12459, null], [12459, 12531, null], [12531, 12641, null], [12641, 12748, null], [12748, 12917, null], [12917, 13370, null], [13370, 13559, null], [13559, 13702, null], [13702, 13715, null], [13715, 14591, null]], "google_gemma-3-12b-it_is_public_document": [[0, 170, true], [170, 274, null], [274, 354, null], [354, 661, null], [661, 921, null], [921, 1024, null], [1024, 1264, null], [1264, 1573, null], [1573, 1679, null], [1679, 1978, null], [1978, 2834, null], [2834, 2975, null], [2975, 3299, null], [3299, 3850, null], [3850, 4099, null], [4099, 4270, null], [4270, 4676, null], [4676, 4932, null], [4932, 5185, null], [5185, 5406, null], [5406, 5733, null], [5733, 5901, null], [5901, 6382, null], [6382, 6550, null], [6550, 6733, null], [6733, 7201, null], [7201, 7582, null], [7582, 7899, null], [7899, 8250, null], [8250, 9040, null], [9040, 9124, null], [9124, 9658, null], [9658, 10312, null], [10312, 11039, null], [11039, 11272, null], [11272, 11646, null], [11646, 11731, null], [11731, 12459, null], [12459, 12531, null], [12531, 12641, null], [12641, 12748, null], [12748, 12917, null], [12917, 13370, null], [13370, 13559, null], [13559, 13702, null], [13702, 13715, null], [13715, 14591, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 14591, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 14591, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 14591, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 14591, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 14591, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 14591, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 14591, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 14591, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 14591, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 14591, null]], "pdf_page_numbers": [[0, 170, 1], [170, 274, 2], [274, 354, 3], [354, 661, 4], [661, 921, 5], [921, 1024, 6], [1024, 1264, 7], [1264, 1573, 8], [1573, 1679, 9], [1679, 1978, 10], [1978, 2834, 11], [2834, 2975, 12], [2975, 3299, 13], [3299, 3850, 14], [3850, 4099, 15], [4099, 4270, 16], [4270, 4676, 17], [4676, 4932, 18], [4932, 5185, 19], [5185, 5406, 20], [5406, 5733, 21], [5733, 5901, 22], [5901, 6382, 23], [6382, 6550, 24], [6550, 6733, 25], [6733, 7201, 26], [7201, 7582, 27], [7582, 7899, 28], [7899, 8250, 29], [8250, 9040, 30], [9040, 9124, 31], [9124, 9658, 32], [9658, 10312, 33], [10312, 11039, 34], [11039, 11272, 35], [11272, 11646, 36], [11646, 11731, 37], [11731, 12459, 38], [12459, 12531, 39], [12531, 12641, 40], [12641, 12748, 41], [12748, 12917, 42], [12917, 13370, 43], [13370, 13559, 44], [13559, 13702, 45], [13702, 13715, 46], [13715, 14591, 47]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 14591, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-28
|
2024-11-28
|
76d2ea41308d070864fb15691314f2cb3a440352
|
Extracting Information from Deeds by Optical Character Recognition (OCR) and Text Interpretation
Rik WOUTERS, Gert MEIJERINK and Jakub ZAVREL the Netherlands
Key words: archive, deed, OCR, text recognition, text interpretation, Textkernel
SUMMARY
Since a long time the Netherlands’ Cadastre, Land Registry and Mapping Agency (in short Kadaster) delivers digital information to customers. Already in the early 1990s information to public notaries was disseminated through IBM-global network. In 2002 Kadaster opened the internet shop KOL (Kadaster-on-line), through which legal ownership information on real estate is provided.
At present Kadaster is scanning 15 million deeds which up to now were stored on microfilm. The accessibility of the deeds had its limitations, especially now Kadaster has become an organisation were all processes are organised in a centralised way and at a national level.
Part of the project deals with the retrieval of information concerning servitudes, easements and the like. By means of text recognition tools this information is extracted from recorded deeds. In addition this information has become available on the internet. This paper describes which procedures and approaches have been used to make a next step in e-services provided by Kadaster. The paper also dedicates attention to a special techniques for interpretation, that was applied by the intelligence services in Romania.
The system saves around 75% of manual processing costs during the coding of semantically complex information from an existing 15 million archive deeds. Furthermore, the system uses a combination of a highly accurate (>99.8% precision) single class classifiers for negatives, and a domain specific region of interest detection module. The recognition modules are integrated in a web based workflow system supporting large scale distributed manual coding.
Extracting Information from Deeds by Optical Character Recognition (OCR) and Text Interpretation
Rik Wouters, Gert Meijerink and Jakub Zavrel the Netherlands
1. INTRODUCTION
1.1 General
When buying or selling registered properties, in the Netherlands, one is legally obliged to register the accompanying notarial deeds in the cadastral system. This system ensures that the source of cadastral data and – accordingly – the information are kept up-to-date at all times. The Netherlands’ Cadastre, Land Registry and Mapping Agency, in short Kadaster, keeps registers by law. These registers consist (among other things) of notarial deeds related to the registered properties. In most cases, these are deeds of conveyance (when transferring property from the buyer to the vendor) and mortgage deeds. The public registers contain details which indicate the rights that are related to the registered properties (legal status).
The most important details in the deeds, referred to above, which relate to immoveable property are incorporated in the cadastral register. The section in which, and the number under which the deed is listed in the public registers enables the user to find the original deed in the public registers, or to have someone do this for the user. The cadastral register also functions as an index for the public registers. It provides a clear overview of each parcel of, for example, the rights related to a parcel, ownership and the purchase price.
In the event of a dispute arising between the public registers and the cadastral register, the public registers take precedence for establishing the legal status of registered properties. Because most civil-law notaries, estate agents and other parties involved are directly affiliated with the cadastral system, the registered information is directly available. This is of great importance when one considers that more than one million real estate and mortgage transactions take place every year in the Netherlands.
1.2 Objectives concerning historic information
The land information system reaches a high quality standard and meets currently demands of society: a reliable, transparent and accessible cadastral information system. Because of the high level reached, new opportunities for delivering services to the society emerge. These opportunities concentrate on the delivery of services to third parties. The “selling point” is the fact that the cadastral registration has favourable characteristics for third parties:
- nation-wide coverage of data;
- high quality registrations;
- state of the art web-portal; and
- centrally organised IT-infrastructure.
The main challenge of Kadaster today is to make also available historic information through the internet, having the portal for national distribution of data in place. One of the most important historic information sources is the archive of field sketches and historic cadastral maps [1]. There is however, also a growing demand for information from historical deeds, more specifically information on easements, servitudes and the like. To that purpose recorded paper deeds are currently scanned and the text related to for mentioned easements is searched for: this is important information for the buyer when it comes to the purchase of a real estate object. This type of information will be on line available in the cadastre registration from 2010 onwards.
2. GLOBAL CONCEPT
2.1 Introduction
In many organisations, very large archives of electronic or paper documents exist, whose contents are crucial for the core tasks of the organisation. In the best case, the documents are available in a full text information retrieval system. However, the information that is essential for the organisation is often hidden in the concepts, meanings and relationships which are used in the text rather than in clear keywords. Often the concepts are complex, they can be expressed in text in many different ways and require domain expertise to be recognized by a reader. The ideal situation would be to code the semantic information as metadata in a structured information repository. However, the cost associated with converting the existing document archives by manual coding are huge, and are often considered an obstacle. Automatic classification methods are not considered applicable because their recognition and interpretation accuracy does not meet the information quality standards of the organisation. In this paper we discuss a text mining approach that can achieve significant cost reduction in this process, while at the same time guaranteeing the required information quality standards.
The above situation holds true for the case of Kadaster in the Netherlands. The document archive contains 15 million transfer deeds that are contracts concerning the transfer of ownership of real estate. The more recent parts of this archive is already available as PDF documents, the older parts of the archive as images which are scanned from microfilm. The documents can be considered “noisy text” because a large part of the text has been obtained by OCR from images with very poor quality. The legal right that is to be coded for the whole archive is the concept of “Erfdienstbaarheid” (explained in more detail below). In a pilot project it was determined that a human coding operator needs a) an average of three minutes per document to determine whether it contains the concept (positive class) and if yes b) to code which lot numbers are in that particular relationship, and c) identify all text fragments that specify the concept (land/right). Hence the goal of the project was to save cost on a budget which was estimated to cost five hundred thousand to one million man hours.
2.2 Registration of easements
When purchasing or valuing a piece of land or a dwelling it is of interest to know whether rights of third parties are vested on the parcel. For example: a right of way or a right of view. An “Erdienstbaarheid” is an easement comprising a burden on a certain property (“the restricted parcel”) is loaded for another property (“the ruling parcel”) like a “right of way” providing access to the public street over an adjacent property. Frequently questions are asked by clients about the occurrence of easements, encumbrances, servitudes, etc. In that case the client can request Kadaster to conduct an easement investigation: in a so-called “erfdienstbaarhedenonderzoek”.
In case of an easement investigation, Kadaster examines whether exists registered documents (deed), which contains information intending to establish an easement on the serving yard. It is also possible that the Kadaster examines whether there are easements, in which case the parcel is involved as the serving but as ruling yard.
The result of the investigation is an official statement which sums up the easements are found based on the examination to a certain specific date of all documents which relate to the plot as ‘serving parcel’ (possibly in combination with the plot as ‘ruling parcel’). It also includes the texts in the deed(s), that might relate to the requested easement. When a deed is only partially readable, the specific text of that the easement can not be selected., in which case a full copy of this deed is provide for free.
The research into easements is time consuming and means a lot of manual work, because all recorded deeds have to be assessed. The research activity is bound to the location of storage because in all cases one has to access the paper archives. Especially notaries and notary clerks devote a lot of time to this kind of research.
The main objective of the project was to find and select the easements in the deeds and to record the determined easements in the digital cadastral system in order to make them easily accessible. The new system will improve data quality and reduces processing time of drawing up and recording notarial deeds.
The challenge now was to find and select the required information automatically, without (a lot of) human interference. That is why Optical Character Recognition (OCR) techniques and text processing applications were introduced.
The consequences of the wrong tracking or losses of information on easements are substantial. The buyer can blame the notary or Kadaster, who are liable in case of mistakes, and can request for indemnification in case of financial losses. The Quality Charter of the Kadaster promises also for this type of information the normal high reliability.
2.3 Work flow
The “Erfdienstbaarheden”-programme had a budget of 20 M€. It comprises a large number of projects, including numerous activities. The total project was controlled by a work flow application. Figure 1 shows the basic steps.
The process consists of six basic steps, starting with the scan of deeds (micro films, XML-files and paper deeds). The second step is the activity where text is transformed into readable text with OCR-techniques (see section 3.1). The third step is the most important activity where the text is interpreted and the relevant information searched for is extracted (see section 3.2). After that, the manual checking takes place: the as “positive” selected deeds will be checked and relevant data stored in the database. All results will be checked independently. If the result does not meet the required standard the production of the whole day is disregarded. Finally the deed is archived.
Overall activities pertain to project management and control. In this programma adequate project management was crucial. The project was complex (new technology), had many stakeholders and subcontractors and the quality to be achieved was crucial. For that process information and management information were produce on a daily basis.
Figure 1. General scheme of project steps
3. BASIC APPLICATIONS FOR OCR AND INTERPRETATION
3.1 Character recognition
With the OCR-technology as explained, digitised text is generated. In the production street two OCR-applications are applied. On the left text page of Figure 2 one can see the result of the first application. It produces a result built up by several words (all relevant) but leaves a lot of words out. On the right page one can see the result of the second application that builds up a lot of words, not all of them correct, and misses out a few words. Now these two results are merged together to obtain a far better end result. This large amount of text archived by the OCR-application is needed to be successful in the next step of the process: i.e. text interpretation.
Figure 2. Left page text after first step and right page after second step
3.2 Text interpretation
The concept of easement as explained concerns the right of the owner of one parcel of land (the dominant tenement) to restrict the freedom of another person's use of land (the servient tenement), or to guarantee his own use of it. It is a right (and obligation) that is treated as part of the property itself, and as such it passes from one owner of a parcel to the next. It is only established or abandoned in a deed approved by the notary that is available in the Kadaster archive (positive class). Kadaster codes the concept as a quadruple <document id, date, dominant tenement id, servient tenement id, text fragment>. The specific vocabulary
specifying the right and its establishment or abandonment is highly variable. The table below gives a few examples of indicative phrases:
<table>
<thead>
<tr>
<th>Erfdienstbaarheden ("easements")</th>
<th>Erfdienstbaarheid ("easement")</th>
</tr>
</thead>
<tbody>
<tr>
<td>Vestiging Erfdienstbaarheden ("establishment easements")</td>
<td>Vestiging Erfdienstbaarheid ("easement")</td>
</tr>
<tr>
<td>Dienend erf ("serving parcel")</td>
<td>Lijdend erf ("restricted parcel")</td>
</tr>
<tr>
<td>Rechten van overpad ("rights of path")</td>
<td>Recht van overpad ("right of path")</td>
</tr>
<tr>
<td>Recht van weg ("right of way")</td>
<td>Recht van uitweg ("right of exit")</td>
</tr>
<tr>
<td>Recht van pad ("right of footpath")</td>
<td>Wordt bij deze gevestigd ("in this deed will be established...")</td>
</tr>
<tr>
<td>Bij deze wordt ten laste van ("herewith will be established on...")</td>
<td>Bij deze wordt ten behoeve van ("herewith will be established for...")</td>
</tr>
<tr>
<td>Gevestigd het recht van erfdienstbaarheid ("establishment of a right...")</td>
<td></td>
</tr>
</tbody>
</table>
It is not feasible to arrive at a complete list of all possible easements and their formulations in text without reading the whole archived deed. An additional complication in recognition of the concept is that all deeds about a parcel that succeed a positive class document in time quote the relevant fragments from the positive class document verbatim. And a final non-trivial complication is the presence of high amounts of character recognition noise. Some examples are given below (clerical errors in writing or misinterpretation by computer):
```
ErTdienstbaarheden,
lijdende erTdienstbaar-
lijdende erf dien s tbaarheden
orfdiensbaartheden
et.rfdienstbaarheden,l
eredienstbaarhnden
glijdende arfdienstbaarhden,
erfdienstbaarhcdcn.
erf dienstbaartieden
lijdende e r r
lijden d e eri'dienstbaarhden,
orfdienstbaarheden
erdienatbaarheden
erraienstbaarheden ^
derCdiensbaarheoen
die crTdienstbaarheden
crfdienstbaarheden,
irfdienstbaarhden,
lijdende erxdiensbaarheuen,
```
3.3 Accurate single class classifier for negatives
The approach used to detect easement descriptions in the documents is a string matching approach based on the nearest neighbour classifier [2]. We collected instances of positive fragments from a small manually annotated training set (4000 documents). The company Textkernel has a very fast string matching application, based on q-gram matching and string similarity computation [3], that has been optimised for millisecond retrieval in text databases with millions of records using techniques inspired by database cache optimisation [4], called FuzzServer. FuzzServer is able to exhaustively measure the similarity of all fragments up to a certain string length from the document against the text fragments from the training set. This makes the approach at the same time robust to linguistic variation and large amounts of OCR noise.
The main opportunity for time savings within the project, was the fact that only 10-20% of the documents are of the positive class. For the positive class documents the system identifies the fragments where easements might be mentioned. The manual coding of the parcel numbers to the easement is still needed. However, it is very difficult to distinguish between truly positive documents and false positives (e.g., containing verbatim citations of positive documents). We did, therefore, focused on creating a very accurate classifier for the negative class. We call this the problem of being sure about what is not there. This classifier has not only features about matches of positive fragments in the training set, but also about negative matches and about the total completeness and quality of the underlying OCR results. By tuning the thresholds of this classifier Kadaster was able to achieve a precision on the negative class of over 99.5% at a recall of 55%. This means that close to one half of the total document archive no longer needs to be read by human beings, because one can be certain that it does not contain easements.
The suggestion of the computer, indicating a potential easement is analysed by the operator. For that purpose, a specific application was developed (see Figure 3). The easement can be linked to the appropriate parcel.
4. TECHNICAL CONCEPT
4.1 System architecture
The solution adopted by Kadaster was set up as a pipeline system consisting of Workflow Agents. The agents log the changes made to the pipeline state in a central document database to track the flow of documents through the system. Documents are loaded in batches into the system’s spool directory, where the Pipeline Filler agent picks them up and sends them to the OCR and recognition engines. The OCR and recognition engines work in parallel on 56 CPU cores to deliver the needed throughput. The results are delivered into the spool directory for manual coding. Kadaster operators work with Textkernel’s web based workflow application, called Sourcebox [5]. In Sourcebox, documents are grouped into small sets for operators in
order to manually code and check. After manual coding, results are checked and quality assurance is performed on a daily basis by blind evaluation of system and human coded output samples to ensure an accuracy of 99.5% on the whole document stream.
Figure 4: picture of the Unisys computer centre: large numbers of servers needed
The workflow in Sourcebox is based on a number of roles: operator, manager, QA-operator, and QA-manager. A regular operator receives only those documents which have been classified as positive by the automatic classifiers. For these documents, the system highlights the fragments with positive matches in the image of the document, allowing fast orientation in the document (see figure 4). The workflow system achieves a further 50% reduction in the time needed for manual coding, bringing the total reduction to approximately 75% of the person hour budget [6].
4.2 Technical system concept
For the project a substantial extension of the technical infrastructure was needed. This is a temporary facility, mainly hosted by Unisys [7]. Especially with gray-scale scanning the bulk of the computer capacity is needed for OCR. This applies to both the processing as well as for the storage capacity. During the production phase, which lasts for approximately four years, the production street is not part of the technical infrastructure of Kadaster but is being hosted by Unisys, including the technical system. The functional management for the (central)
activities in the field of designing and optimizing the word-processing software is the responsibility of Unisys. The functional workflow management, planning and user support is the responsibility of Kadaster.
After these four years a small part of the configuration was left in place to be used to support the primary task of electronic deed processing. It concerns a small number of servers and relatively little storage capacity.
In Figure 5 is shown the infrastructure needed for externally hosted production line, the various application components are positioned and the facilities required for integrating the internal and external (Unisys) functional environments.

All end user applications are available as WEB-applications. For employees in the regional offices this means that the applications can come through the standard on the Citrix platform present, through Internet Explorer or any other internet browser. This also applies to the management applications. For employees outside the office a normal browser-implementation on a PC with Internet access is sufficient.
5. PARTNERSHIP
The project is almost finished now. The project was a joined effort between Kadaster and Unisys. In a partnership, where mutual trust was as important as a formal contract, both parties had very strong interests in the success of the project: Kadaster’s interest is to save a lot of time and money to digitise large numbers of deeds and to extract valuable information from these documents and Unisys because of acquiring a good reference for future work and the profit.
The first step in 2006 was a pilot which was mainly meant to prove the potential performance of modern applications to recognize characters/text fragments and to extract meaningful information. This step was financially fully covered by Unisys. After the positive result, Kadaster tendered the implementation project, according to EU-tender regulations. Unisys won the tender and a contract was signed. The contract price was based on a specific charging model, where the benefits for Kadaster were the prime input. The charging model based on “click charge”: For every document that is processed there was a basic charge. On top of this, there was a bonus scheme:
- For every document that does not have to pass manual processing, an additional charge is made;
- For every document that does need manual processing, a time saving incentive is introduced; and
- For every minute saving in the new process compared to the old process, a fee is charged (a small percentage of the savings Kadaster makes).
The charm of the model is that both Kadaster and Unisys did try to get the best results as both parties financially benefit from less manual processing and from time savings. The result was that both organisations became true business partners throughout the project, having the same objective.
6. DISCUSSION AND CONCLUSIONS
After several attempts to extract information from deeds in the late 1980s and 1990s, Kadaster succeeded to make a software application using OCR and text rinterpretation techniques ready for effective and efficient support to Kadaster’s largest archiving project.
The extraction of specific information on easements was successful. The quality levels currently achieved by the system were 99.8% quality; far better than manually can be achieved. Now over 50% of documents are processed automatically. On top of that, the documents that require manual intervention are now processed at a 50% faster speed.
The success of the project is boosted by an excellent partnership between Kadaster and Unisys. The agile charging model supported an efficient cooperation and stimulated mutual interest in making an optimal contribution to the project.
ACKNOWLEDGEMENTS
I would like to thank Prof. ir. Paul van de Molen and Miss ir. Louisa Jansen for reviewing this paper.
REFERENCES
[1] Wouters, Rik: Digitizing Large Volumes of Historic Information and Interpretation by OCR. October 2009
BIOGRAPHICAL NOTES
Rik Wouters
Holds a degree (MSc) in Agricultural Sciences from Wageningen University, The Netherlands. He worked for five years for FAO, where he had assignments in watershed management and forestry projects in Africa and Asia. In the Netherlands, he worked over 15 years in IT-projects. In 1996 he joined the Netherlands Cadastre, Land Registry and Mapping Agency and was responsible for large and complex IT-projects among which a project dealing with the renewal of major parts of the land registration system. In 2006 he became regional manager for Kadaster International, where he is responsible for the regions Central and Eastern Europe and Asia. In recent years he carried out many review and advisory missions to ECA-countries for the World Bank, the Dutch Government and other donor-organisations.
Gert Meijerink
Holds a MBA degree (MSM) in Strategic Management from the Lemniscaat Business School, The Netherlands and an engineering degree in Advanced Electronics from Rens and Rens. He worked for five years for DICOM, where he had several assignments in the document imaging industry in the Benelux and France. For BancTec he worked 9 years in several roles including 5 years international product management and sales. In the Netherlands, he worked over 15 years in Electronic Content Management-projects. In 2007 he joined Unisys and was commercially responsible for large and complex IT-projects in the Dutch government and the justice and public safety area. In 2008 he closed the erfdiestbahrden project with Dutch Kadaster.
Rob Vaandrager
Holds a degree Business Administration from Keele University, the United Kingdom. He works since 1979 at Netherlands Cadastre, Land Registry and Mapping Agency. After seven years he became Manager of a production team in Rotterdam. Over twenty years he was team leader of various teams all over the Netherlands and he moved up to the position of deputy director of the local office of Eindhoven. The last three years he holds the position of Senior Project Manager and in this position he is responsible for the programme of “unlock and update easements”.
Jakub Zavrel
Holds MSc-degrees in Artificial Intelligence (Utrecht) and Computational Linguistics (Amsterdam). He worked for several years at the University of Tilburg and University of Antwerp doing research in Machine Learning of Natural Language and published extensively about classification based machine learning methods for sequence labeling. More attracted to applications that to theoretical research, he was one of the founders of Textkernel in 2001. As CEO, he has since then led its growth to one of the leading Dutch language technology companies.
CONTACTS
Ir. Rik Wouters
Netherlands’ Cadastre, Land Registry and Mapping Agency
Hofstraat 110
7311 KZ Apeldoorn
THE NETHERLANDS
Tel. +31 88 183 3520
Fax +31 88 183 2074
E-mail: rik.wouters@kadaster.nl
Website: www.kadaster.nl
Gert Meijerink MBA
Unisys Technology, Consulting and Integration Solutions
Tupolevlaan 1
1119 NW Schiphol-Rijk
THE NETHERLANDS
Tel. +31(0) 20 526 7500
E-mail: gert.meijerink@nl.unisys.com
Website: www.unisys.com
Ir. Jakub Zavrel
Textkernel BV
Nieuwendammerkade 28A-17
NL-1022 AB Amsterdam
THE NETHERLANDS
Tel. +31 20 494 2496
|
{"Source-Url": "http://fig.net/resources/proceedings/fig_proceedings/fig2010/papers/ts02h/ts02h_wouters_3841.pdf", "len_cl100k_base": 5709, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 29540, "total-output-tokens": 6495, "length": "2e12", "weborganizer": {"__label__adult": 0.0004184246063232422, "__label__art_design": 0.00229644775390625, "__label__crime_law": 0.006946563720703125, "__label__education_jobs": 0.00344085693359375, "__label__entertainment": 0.00011897087097167967, "__label__fashion_beauty": 0.0003659725189208984, "__label__finance_business": 0.00731658935546875, "__label__food_dining": 0.0004453659057617187, "__label__games": 0.0008769035339355469, "__label__hardware": 0.0041351318359375, "__label__health": 0.0009069442749023438, "__label__history": 0.0017271041870117188, "__label__home_hobbies": 0.0012235641479492188, "__label__industrial": 0.0026264190673828125, "__label__literature": 0.000667572021484375, "__label__politics": 0.0007443428039550781, "__label__religion": 0.0005631446838378906, "__label__science_tech": 0.3955078125, "__label__social_life": 0.0002663135528564453, "__label__software": 0.1549072265625, "__label__software_dev": 0.4130859375, "__label__sports_fitness": 0.0001817941665649414, "__label__transportation": 0.0008029937744140625, "__label__travel": 0.00037288665771484375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27651, 0.03516]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27651, 0.40265]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27651, 0.92317]], "google_gemma-3-12b-it_contains_pii": [[0, 1882, false], [1882, 4519, null], [4519, 7603, null], [7603, 10373, null], [10373, 11679, null], [11679, 13179, null], [13179, 15095, null], [15095, 17121, null], [17121, 18117, null], [18117, 19603, null], [19603, 20770, null], [20770, 23434, null], [23434, 25951, null], [25951, 27528, null], [27528, 27651, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1882, true], [1882, 4519, null], [4519, 7603, null], [7603, 10373, null], [10373, 11679, null], [11679, 13179, null], [13179, 15095, null], [15095, 17121, null], [17121, 18117, null], [18117, 19603, null], [19603, 20770, null], [20770, 23434, null], [23434, 25951, null], [25951, 27528, null], [27528, 27651, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27651, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27651, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27651, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27651, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27651, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27651, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27651, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27651, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27651, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27651, null]], "pdf_page_numbers": [[0, 1882, 1], [1882, 4519, 2], [4519, 7603, 3], [7603, 10373, 4], [10373, 11679, 5], [11679, 13179, 6], [13179, 15095, 7], [15095, 17121, 8], [17121, 18117, 9], [18117, 19603, 10], [19603, 20770, 11], [20770, 23434, 12], [23434, 25951, 13], [25951, 27528, 14], [27528, 27651, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27651, 0.06081]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
bed6c86c7bd6089bfc981fbe8268eb4b99765969
|
[REMOVED]
|
{"Source-Url": "http://www.dtic.mil/dtic/tr/fulltext/u2/a465276.pdf", "len_cl100k_base": 4472, "olmocr-version": "0.1.50", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 25929, "total-output-tokens": 5357, "length": "2e12", "weborganizer": {"__label__adult": 0.00035762786865234375, "__label__art_design": 0.0002942085266113281, "__label__crime_law": 0.0007781982421875, "__label__education_jobs": 0.0005660057067871094, "__label__entertainment": 7.295608520507812e-05, "__label__fashion_beauty": 0.0001615285873413086, "__label__finance_business": 0.00032138824462890625, "__label__food_dining": 0.00035834312438964844, "__label__games": 0.0005588531494140625, "__label__hardware": 0.001300811767578125, "__label__health": 0.0006928443908691406, "__label__history": 0.00024080276489257812, "__label__home_hobbies": 9.959936141967772e-05, "__label__industrial": 0.0005459785461425781, "__label__literature": 0.000232696533203125, "__label__politics": 0.00039267539978027344, "__label__religion": 0.0003917217254638672, "__label__science_tech": 0.0814208984375, "__label__social_life": 9.483098983764648e-05, "__label__software": 0.01047515869140625, "__label__software_dev": 0.8994140625, "__label__sports_fitness": 0.0003113746643066406, "__label__transportation": 0.0006322860717773438, "__label__travel": 0.00019752979278564453}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 20720, 0.02335]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 20720, 0.52794]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 20720, 0.86366]], "google_gemma-3-12b-it_contains_pii": [[0, 2226, false], [2226, 3296, null], [3296, 6494, null], [6494, 9724, null], [9724, 11721, null], [11721, 14336, null], [14336, 17604, null], [17604, 20720, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2226, true], [2226, 3296, null], [3296, 6494, null], [6494, 9724, null], [9724, 11721, null], [11721, 14336, null], [14336, 17604, null], [17604, 20720, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 20720, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 20720, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 20720, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 20720, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 20720, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 20720, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 20720, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 20720, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 20720, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 20720, null]], "pdf_page_numbers": [[0, 2226, 1], [2226, 3296, 2], [3296, 6494, 3], [6494, 9724, 4], [9724, 11721, 5], [11721, 14336, 6], [14336, 17604, 7], [17604, 20720, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 20720, 0.16058]]}
|
olmocr_science_pdfs
|
2024-11-28
|
2024-11-28
|
034fc5f825bfe4bff49e0fa1df212cd2150fde45
|
Deep Networks 3
10-405
Summary
• The basic architecture:
– Matrix operations implemented on GPU
– Minibatch SGD optimization
– Autodiff to get gradients
• This lets you write expressive models easily
– ...but some models are hard to train...
– Which models should you use, and why?
Deep Network Training Tricks
Recap: weight updates for multilayer ANN
For nodes $k$ in output layer $L$:
\[
\delta^L_k \equiv (t_k - a_k) \ a_k \ (1 - a_k)
\]
For nodes $j$ in hidden layer $h$:
\[
\delta^h_j \equiv \sum_k (\delta^{h+1}_j \ w_{kj}) \ a_j \ (1 - a_j)
\]
What happens as the layers get further and further from the output layer? E.g., what’s gradient for the bias term with several layers after it?
\[
\frac{\partial C}{\partial b_1} = \sigma'(z_1) \times w_2 \times \sigma'(z_2) \times w_3 \times \sigma'(z_3) \times w_4 \times \sigma'(z_4) \times \frac{\partial C}{\partial a_4}
\]
Gradients are unstable
Max at 1/4
If weights are less than 4 then we are multiplying by many numbers < 1 so the gradients get very small.
The vanishing gradient problem
What happens as the layers get further and further from the output layer? E.g., what’s gradient for the bias term with several layers after it in a trivial net?
\[
\frac{\partial C}{\partial b_1} = \sigma'(z_1) \times w_2 \times \sigma'(z_2) \times w_3 \times \sigma'(z_3) \times w_4 \times \sigma'(z_4) \times \frac{\partial C}{\partial a_4}
\]
Gradients are unstable
What happens as the layers get further and further from the output layer? E.g., what's gradient for the bias term with several layers after it in a trivial net?
\[
\frac{\partial C}{\partial b_1} = \sigma'(z_1) \times w_2 \times \sigma'(z_2) \times w_3 \times \sigma'(z_3) \times w_4 \times \sigma'(z_4) \times \frac{\partial C}{\partial a_4}
\]
If weights are large then we are multiplying by many numbers > 1 so the gradients get very big.
The **exploding gradient** problem (less common but possible)
Vanishing gradients
Histogram of gradients in a 5-layer network for an artificial image recognition task
Solution? “do as much as you can with networks with linear gradients” - wcohen
Understanding the difficulty of training deep feedforward neural networks
We will get to these tricks eventually....
Saturation and initialization
It’s easy for sigmoid units to saturate
Learning rate approaches zero and unit is “stuck”
It’s easy for sigmoid units to saturate
- Saturation visualization from Glorot & Bengio 2010
Closest-to-output hidden layer still stuck for first 2M examples
It’s easy for sigmoid units to saturate
For a big network there are lots of weighted inputs to each neuron. If any of them are too large then the neuron will saturate. So neurons get stuck with a few large inputs OR many small ones.
It’s easy for sigmoid units to saturate
• If there are 500 non-zero inputs initialized with a Gaussian \( \sim N(0,1) \) then the SD is \( \sqrt{500} \approx 22.4 \)
• Fix: initialize carefully! e.g.
\[
W_{ij} \sim U \left[ -\frac{1}{\sqrt{n}}, \frac{1}{\sqrt{n}} \right]
\]
• Or (at level \( j \)):
\[
W \sim U \left[ -\frac{\sqrt{6}}{\sqrt{n_j + n_{j+1}}}, \frac{\sqrt{6}}{\sqrt{n_j + n_{j+1}}} \right]
\]
First breakthrough deep learning results were based on clever pre-training initialization schemes, where deep networks were seeded with weights learned from unsupervised strategies.
Tanh vs Tanh N: only difference is initialization!
Cross-entropy loss
\[ C = \frac{1}{n} \sum_x [y \ln a + (1 - y) \ln(1 - a)], \]
\[ C = \frac{1}{n} \sum_x (y - a)^2 \]
1990’s ANNs often used quadratic loss at the output layer.
Figure 5: Cross entropy (black, surface on top) and quadratic (red, bottom surface) cost as a function of two weights (one at each layer) of a network with two layers, \( W_1 \) respectively on the first layer and \( W_2 \) on the second, output layer.
Network outputs a probability distribution!
Cross-entropy loss after a softmax layer gives a very simple, numerically stable gradient: \( Y - P \)
Softmax output layer
tf.nn.softmax_cross_entropy_with_logits
Inputs: X,W1,B1,W2,B2
Z1a = mul(X,W1) // matrix mult
Z1b = add*(Z1a,B1) // add bias vec
A1 = tanh(Z1b) //element-wise
Z2a = mul(A1,W2)
Z2b = add*(Z2a,B2)
A2 = tanh(Z2b) // element-wise
P = softMax(A2) // vec to vec
C = crossEnt_{Y}(P) // cost function
**Softmax output layer**
\[ \text{Inputs: } X, W_1, B_1, W_2, B_2 \]
\[ Z_{1a} = \text{mul}(X, W_1) \quad \text{matrix mult} \]
\[ Z_{1b} = \text{add}^{*}(Z_{1a}, B_1) \quad \text{add bias vec} \]
\[ A_1 = \tanh(Z_{1b}) \quad \text{element-wise} \]
\[ Z_{2a} = \text{mul}(A_1, W_2) \]
\[ Z_{2b} = \text{add}^{*}(Z_{2a}, B_2) \]
\[ A_2 = \tanh(Z_{2b}) \quad \text{element-wise} \]
\[ P = \text{softmax}(A_2) \quad \text{vec to vec} \]
\[ C = \text{crossEnt}_{Y}(P) \quad \text{cost function} \]
Alternative non-linearities
- A new change: modifying the nonlinearity
- The logistic is not widely used in modern ANNs
Alternate non-linearities
- Zero’s don’t get you stuck
Alternate 1: tanh
Like logistic function but shifted to range \([-1, +1]\)
Understanding the difficulty of training deep feedforward neural networks
Alternative non-linearities
softsign(x) = x/(1 + |x|)
Alternative non-linearities
• A new change: modifying the nonlinearity — reLU often used in vision tasks
Alternate 2: rectified linear unit
Linear with a cutoff at zero
(Implement: clip the gradient when you pass zero)
Alternative non-linearities
- A new change: modifying the nonlinearity
- reLU often used in vision tasks
Alternate 2: rectified linear unit
Soft version: $\log(\exp(x) + 1)$
Doesn’t saturate (at one end)
Sparsifies outputs
Helps with vanishing gradient
Deep Architectures
Word2Vec and GloVe Embeddings
Representing words in a deep network
"1 hot" vector
weights
hidden layer
1 aaliyeh 0
2 aardvark 0
3 aaai 0
... ... ...
18462 halloween 1
18463 hallows 0
... ... ...
... ... ...
29999 zymurgy 0
30000 zynga 0
The embeddings will be similar for words that behave similarly with respect to the downstream task.
\[ h = xW \]
But really \( h \) is the \( i \)-th row of \( W \). So learning \( W \) is just learning a hidden-layer encoding for each word in the vocabulary (embedding).
Representing words in a deep network
Potential downstream task: predict the words that co-occur with input word.
word2vec: skip-gram embeddings
A word in context “I had class on Halloween which seemed unfair” becomes an example
**word2vec: skip-gram embeddings**
**Training data:**
- **positive** examples are pairs of words $w(t), w(t+j)$ that co-occur.
- **negative** examples are samples of pairs of words $w(t), w(t+j)$ that don’t co-occur.
You want to train over a very large corpus (100M words+) and hundreds+ dimensions.
Often you initialize with this word representation and then “fine tune” - ie plug in the real downstream task and keep training....
GLOVE embeddings
\[ f(x) = \begin{cases}
(x/x_{\text{max}})^{\alpha} & \text{if } x < x_{\text{max}} \\
1 & \text{otherwise}
\end{cases} \]
\[ J = \sum_{i,j=1}^{V} f(X_{ij}) \left( w_i^T \tilde{w}_j + b_i + \tilde{b}_j - \log X_{ij} \right)^2 \]
how often words \( i \) and \( j \) co-occur in a corpus
how much to weight this word pair, based on frequency
embeddings for words \( i \) and \( j \)
biases for words \( i \) and \( j \)
RECURRENT NEURAL NETWORKS
Motivation: what about sequence prediction?
What can I do when input size and output size vary?
Motivation: what about sequence prediction?
Architecture for an RNN
Some information is passed from one subunit to the next
Sequence of outputs
Sequence of inputs
Start of sequence marker
End of sequence marker
http://colah.github.io/posts/2015-08-Understanding-LSTMs/
Architecture for an 1980’s RNN
Problem with this: it’s extremely deep and very hard to train
Architecture for an LSTM
“Bits of memory”
Decide what to forget
Decide what to insert
Longterm-short term model
σ: output in [0,1]
tanh: output in [-1,+1]
http://colah.github.io/posts/2015-08-Understanding-LSTMs/
Walkthrough
What part of memory to “forget” – zero means forget this bit
\[ f_t = \sigma \left( W_f \cdot [h_{t-1}, x_t] + b_f \right) \]
\( \sigma = \) logistic function, range [0,1]
What bits to insert into the next states
\[ i_t = \sigma (W_i \cdot [h_{t-1}, x_t] + b_i) \]
\[ \tilde{C}_t = \tanh(W_C \cdot [h_{t-1}, x_t] + b_C) \]
What content to store into the next state
http://colah.github.io/posts/2015-08-Understanding-LSTMs/
Walkthrough
Next memory cell content – mixture of not-forgotten part of previous cell and insertion
\[ C_t = f_t * C_{t-1} + i_t * \tilde{C}_t \]
\[(a'b)' = a'b + ab'\]
Walkthrough
What part of cell to output
tanh maps bits to [-1,+1] range
\[
o_t = \sigma(W_o [h_{t-1}, x_t] + b_o)
\]
\[
h_t = o_t \times \tanh(C_t)
\]
http://colah.github.io/posts/2015-08-Understanding-LSTMs/
Architecture for an LSTM
(1)
\[ f_t = \sigma (W_f \cdot [h_{t-1}, x_t] + b_f) \]
\[ i_t = \sigma (W_i \cdot [h_{t-1}, x_t] + b_i) \]
\[ \tilde{C}_t = \tanh(W_C \cdot [h_{t-1}, x_t] + b_C) \]
(2)
\[ C_t = f_t \cdot C_{t-1} + i_t \cdot \tilde{C}_t \]
(3)
\[ o_t = \sigma (W_o \cdot [h_{t-1}, x_t] + b_o) \]
\[ h_t = o_t \cdot \tanh(C_t) \]
Implementing an LSTM
For $t = 1, \ldots, T$:
1. $f_t = \sigma (W_f \cdot [h_{t-1}, x_t] + b_f)$
$i_t = \sigma (W_i \cdot [h_{t-1}, x_t] + b_i)$
$\tilde{C}_t = \tanh (W_C \cdot [h_{t-1}, x_t] + b_C)$
2. $C_t = f_t \ast C_{t-1} + i_t \ast \tilde{C}_t$
3. $o_t = \sigma (W_o \cdot [h_{t-1}, x_t] + b_o)$
$h_t = o_t \ast \tanh (C_t)$
SOME FUN LSTM EXAMPLES
http://karpathy.github.io/2015/05/21/rnn-effectiveness/
LSTMs can be used for other sequence tasks
- **image captioning**
- One to many
- **sequence classification**
- Many to one
- **translation**
- Many to many
- **named entity recognition**
- Many to many
seq2seq
http://karpathy.github.io/2015/05/21/rnn-effectiveness/
Character-level language model
Test time:
• pick a seed character sequence
• generate the next character
• then the next
• then the next …
http://karpathy.github.io/2015/05/21/rnn-effectiveness/
Character-level language model
PANDARUS:
Alas, I think he shall be come approached and the day
When little srain would be attain'd into being never fed,
And who is but a chain and subjects of his death,
I should not sleep.
Second Senator:
They are away this miseries, produced upon my soul,
Breaking and strongly should be buried, when I perish
The earth and thoughts of many states.
DUKE VINCENTIO:
Well, your wit is in the care of side and that.
Second Lord:
They would be ruled after this chamber, and
my fair nues begun out of the fact, to be conveyed,
Whose noble souls I'll have the heart of the wars.
http://karpathy.github.io/2015/05/21/rnn-effectiveness/
Character-level language model
First Citizen:
Nay, then, that was hers,
It speaks against your other service:
But since the
youth of the circumstance be spoken:
Your uncle and one Baptista's daughter.
SEBASTIAN:
Do I stand till the break off.
BIRON:
Hide thy head.
VENTIDIUS:
He purposeth to Athens: whither, with the vow
I made to handle you.
FALSTAFF:
My good knave.
Yoav Goldberg: order-10 unsmoothed character n-grams
http://karpathy.github.io/2015/05/21/rnn-effectiveness/
Character-level language model
-------------------- Recipe via Meal-Master (tm) v8.05
Title: BARBECUE RIBS
Categories: Chinese, Appetizers
Yield: 4 Servings
1 pk Seasoned rice
1 Beer -- cut into
cubes
1 ts Sugar
3/4 c Water
Chopped finels,
-up to 4 tblsp of chopped
2 pk Yeast Bread/over
--------------------FILLING--------------------
2 c Pineapple, chopped
1/3 c Milk
1/2 c Pecans
Cream of each
2 tb Balsamic cocoa
2 tb Flour
2 ts Lemon juice
Granulated sugar
2 tb Orange juice
http://karpathy.github.io/2015/05/21/rnn-effectiveness/
Character-level language model
LaTeX “almost compiles”
For $\bigoplus_{n=1,\ldots,m}$ where $\mathcal{L}_{m*} = 0$, hence we can find a closed subset $\mathcal{H}$ in $\mathcal{H}$ and any sets $\mathcal{F}$ on $X, U$ is a closed immersion of $S$, then $U \rightarrow T$ is a separated algebraic space.
Proof. Proof of (1). It also start we get
$$S = \text{Spec}(R) = U \times_X U \times_X U$$
and the comparically in the fibre product covering we have to prove the lemma generated by $\bigsqcup Z \times_U U \rightarrow V$. Consider the maps $M$ along the set of points $Sch_{f_{ppf}}$ and $U \rightarrow U$ is the fibre category of $S$ in $U$ in Section, ?? and the fact that any $U$ affine, see Morphisms, Lemma ???. Hence we obtain a scheme $S$ and any open subset $W \subset U$ in $Sh(G)$ such that $\text{Spec}(R') \rightarrow S$ is smooth or an
$$U = \bigcup U_i \times_{S, U_i}$$
which has a nonzero morphism we may assume that $f_i$ is of finite presentation over $S$. We claim that $\mathcal{O}_{X,x}$ is a scheme where $x, x', s'' \in S'$ such that $\mathcal{O}_{X,x'} \rightarrow \mathcal{O}_{X',x'}$ is separated. By Algebra, Lemma ?? we can define a map of complexes $GL_{S'}(x'/S'')$ and we win.
To prove study we see that $\mathcal{F}|_U$ is a covering of $\mathcal{X}'$, and $\mathcal{T}_i$ is an object of $\mathcal{F}_{X/S}$ for $i > 0$ and $\mathcal{F}_p$ exists and let $\mathcal{F}_i$ be a presheaf of $\mathcal{O}_X$-modules on $\mathcal{C}$ as a $\mathcal{F}$-module. In particular $\mathcal{F} = U/\mathcal{F}$ we have to show that
$$\tilde{M}^\bullet = \mathcal{T}^\bullet \otimes_{\text{Spec}(k)} \mathcal{O}_{S,s} - i_{X}^{-1} \mathcal{F}$$
is a unique morphism of algebraic stacks. Note that
Arrows = $(Sch/S)_{f_{ppf}}^{opp}, (Sch/S)_{f_{ppf}}$
and
$$V = \Gamma(S, \mathcal{O}) \hookrightarrow (U, \text{Spec}(A))$$
http://karpathy.github.io/2015/05/21/rnn-effectiveness/
Character-level language model
```c
/**
* Increment the size file of the new incorrect UI_FILTER group information
* of the size generatively.
*/
static int indicate_policy(void)
{
int error;
if (fd == MARN_EPT) {
/*
* The kernel blank will coeld it to userspace.
*/
if (ss->segment < mem_total)
unblock_graph_and_set_blocked();
else
ret = 1;
goto bail;
}
segaddr = in_SB(in.addr);
selector = seg / 16;
setup_works = true;
for (i = 0; i < blocks; i++) {
seq = buf[i++];
bpf = bd->bd.next + i * search;
if (fd) {
current = blocked;
}
}
}
```
CONVOLUTIONAL NEURAL NETWORKS
Model of vision in animals
[Hubel & Wiesel 1962]:
- **Simple cells** detect local features
- **Complex cells** “pool” the outputs of simple cells within a retinotopic neighborhood.
```
```
Retinotopic Feature Maps
```
```
Multiple convolutions
pooling subsampling
```
```
“Simple cells”
“Complex cells”
What’s a convolution?
• Basic idea:
– Pick a 3-3 matrix F of weights
– Slide this over an image and compute the “inner product” (similarity) of F and the corresponding field of the image, and replace the pixel in the center of the field with the output of the inner product operation
• Key point:
– Different convolutions extract different types of low-level “features” from an image
– All that we need to vary to generate these different features is the weights of F
How do we convolve an image with an ANN?
Note that the parameters in the matrix defining the convolution are tied across all places that it is used.
What’s a convolution?
http://matlabtricks.com/post-5/3x3-convolution-kernels-with-online-demo
What’s a convolution?
http://matlabtricks.com/post-5/3x3-convolution-kernels-with-online-demo
What’s a convolution?
http://matlabtricks.com/post-5/3x3-convolution-kernels-with-online-demo
What’s a convolution?
http://matlabtricks.com/post-5/3x3-convolution-kernels-with-online-demo
What’s a convolution?
http://matlabtricks.com/post-5/3x3-convolution-kernels-with-online-demo
What’s a convolution?
http://matlabtricks.com/post-5/3x3-convolution-kernels-with-online-demo
What’s a convolution?
• Basic idea:
– Pick a 3-3 matrix $F$ of weights
– Slide this over an image and compute a “feature map” for that image
• Key point:
– Different convolutions extract different types of low-level “features” from an image
– Weights of convolutions will be learned
Usually we construct many “feature maps” for each image...
Example: 6 convolutions of a digit
http://scs.ryerson.ca/~aharley/vis/conv/
CNNs typically alternate convolutions, non-linearity, and then downsampling
Downsampling is usually averaging or (more common in recent CNNs) max-pooling
Why do max-pooling?
- Saves space
- Reduces overfitting?
- Because I’m going to add more convolutions after it!
- Allows the short-range convolutions to extend over larger subfields of the images
- So we can spot larger objects
- Eg, a long horizontal line, or a corner, or …
- At some point the feature maps start to get very sparse and blobby – they are indicators of some semantic property, not a recognizable transformation of the image
- Then just use them as features in a “normal” ANN
Why do max-pooling?
• Saves space
• Reduces overfitting?
• Because I’m going to add more convolutions after it!
– Allows the short-range convolutions to extend over larger subfields of the images
• So we can spot larger objects
• Eg, a long horizontal line, or a corner, or …
PROC. OF THE IEEE, NOVEMBER 1998
Fig. 2. Architecture of LeNet-5, a Convolutional Neural Network, here for digits recognition. Each plane is a feature map, i.e. a set of units whose weights are constrained to be identical.
Alternating convolution and downsampling
5 layers up
The subfield in a large dataset that gives the strongest output for a neuron
Using RNNs and CNNs
LSTMs can be used for other tasks
<table>
<thead>
<tr>
<th>Encoder/Decoder</th>
<th>seq2seq</th>
</tr>
</thead>
<tbody>
<tr>
<td>image captioning</td>
<td>sequence classification</td>
</tr>
<tr>
<td>one to many</td>
<td>many to one</td>
</tr>
<tr>
<td></td>
<td>many to many</td>
</tr>
<tr>
<td></td>
<td>many to many</td>
</tr>
</tbody>
</table>
Image
[CNN]
http://karpathy.github.io/2015/05/21/rnn-effectiveness/
ANN Tricks for NLP
• Common tricks
– represent words with embeddings
– represent words in context with RNN hidden state
– represent a sentence with the last hidden state
• or pool all hidden states with MAX or SUM
– biLSTM: run an LSTM in both directions
• represent with first + last hidden state
– feed representations into a deeper network....
Example: reasoning about entailment
A large annotated corpus for learning natural language inference
Samuel R. Bowman*†
sbowman@stanford.edu
Gabor Angeli†‡
angeli@stanford.edu
Christopher Potts*
cgpotts@stanford.edu
Christopher D. Manning*†‡
manning@stanford.edu
<table>
<thead>
<tr>
<th>Example</th>
<th>Annotation</th>
<th>Label</th>
</tr>
</thead>
<tbody>
<tr>
<td>A man inspects the uniform of a figure in some East Asian country.</td>
<td>contradiction</td>
<td>C C C C C</td>
</tr>
<tr>
<td>An older and younger man smiling.</td>
<td>neutral</td>
<td>N N E N N</td>
</tr>
<tr>
<td>A black race car starts up in front of a crowd of people.</td>
<td>contradiction</td>
<td>C C C C C</td>
</tr>
<tr>
<td>A soccer game with multiple males playing.</td>
<td>entailment</td>
<td>E E E E E</td>
</tr>
<tr>
<td>A smiling costumed woman is holding an umbrella.</td>
<td>neutral</td>
<td>N N E C N</td>
</tr>
<tr>
<td>The man is sleeping</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Two men are smiling and laughing at the cats playing on the floor.</td>
<td></td>
<td></td>
</tr>
<tr>
<td>A man is driving down a lonely road.</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Some men are playing a sport.</td>
<td></td>
<td></td>
</tr>
<tr>
<td>A happy woman in a fairy costume holds an umbrella.</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
RNNs for entailment
<table>
<thead>
<tr>
<th>Sentence model</th>
<th>Train</th>
<th>Test</th>
</tr>
</thead>
<tbody>
<tr>
<td>100d Sum of words</td>
<td>79.3</td>
<td>75.3</td>
</tr>
<tr>
<td>100d RNN</td>
<td>73.1</td>
<td>72.2</td>
</tr>
<tr>
<td>100d LSTM RNN</td>
<td>84.8</td>
<td>77.6</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>System</th>
<th>SNLI</th>
</tr>
</thead>
<tbody>
<tr>
<td>Edit Distance Based</td>
<td>71.9</td>
</tr>
<tr>
<td>Classifier Based</td>
<td>72.2</td>
</tr>
<tr>
<td>+ Lexical Resources</td>
<td>75.0</td>
</tr>
</tbody>
</table>
Example: question answering
**LSTM-based Deep Learning Models for non-factoid answer selection**
Ming Tan, Cicero dos Santos, Bing Xiang & Bowen Zhou
IBM Watson Core Technologies
Yorktown Heights, NY, USA
{mingtan,cicerons,bingxia,zhou}@us.ibm.com
Common trick: train network to make representations similar/dissimilar, not to classify
Example: question answering
Adding **attention**:
• classify the hidden states $h_1, \ldots h_m$ of the answer according to relevance to the question
• when you pool, weight by the classifier’s score
• classifier is based on question representation $o_q$ and hidden state $h_i$
Example: question answering
<table>
<thead>
<tr>
<th>Model</th>
<th>Validation</th>
<th>Test1</th>
<th>Test2</th>
</tr>
</thead>
<tbody>
<tr>
<td>A. Bag-of-word</td>
<td>31.9</td>
<td>32.1</td>
<td>32.2</td>
</tr>
<tr>
<td>B. Metzler-Bendersky IR model</td>
<td>52.7</td>
<td>55.1</td>
<td>50.8</td>
</tr>
<tr>
<td>C. Architecture-II in (Feng et al., 2015)</td>
<td>61.8</td>
<td>62.8</td>
<td>59.2</td>
</tr>
<tr>
<td>D. Architecture-II with GESD</td>
<td>65.4</td>
<td>65.3</td>
<td>61.0</td>
</tr>
<tr>
<td>A QA-LSTM basic-model(head/tail)</td>
<td>54.0</td>
<td>53.1</td>
<td>51.2</td>
</tr>
<tr>
<td>B QA-LSTM basic-model(avg pooling)</td>
<td>58.5</td>
<td>58.2</td>
<td>54.0</td>
</tr>
<tr>
<td>C QA-LSTM basic-model(max pooling)</td>
<td>64.3</td>
<td>63.1</td>
<td>58.0</td>
</tr>
<tr>
<td>G QA-LSTM with attention (max pooling)</td>
<td>66.5</td>
<td>63.7</td>
<td>60.3</td>
</tr>
<tr>
<td>H QA-LSTM with attention (avg pooling)</td>
<td><strong>68.4</strong></td>
<td><strong>68.1</strong></td>
<td>62.2</td>
</tr>
</tbody>
</table>
Example: recommendation
Rose Catherine & Cohen, RecSys 2017
Example: recommendation
Rose Catherine & Cohen, RecSys 2017
# Example: recommendation
Rose Catherine & Cohen, RecSys 2017
---
## Dataset Performance
<table>
<thead>
<tr>
<th>Dataset</th>
<th>DeepCoNN + Test Reviews</th>
<th>MF</th>
<th>DeepCoNN</th>
<th>DeepCoNN-rev$_{AB}$</th>
<th>TransNet</th>
<th>TransNet-Ext</th>
</tr>
</thead>
<tbody>
<tr>
<td>Yelp17</td>
<td>1.2106</td>
<td>1.8661</td>
<td>1.8984</td>
<td>1.7045</td>
<td>1.6387</td>
<td>1.5913</td>
</tr>
<tr>
<td>AZ-Elec</td>
<td>0.9791</td>
<td>1.8898</td>
<td>1.9704</td>
<td>2.0774</td>
<td>1.8380</td>
<td>1.7781</td>
</tr>
<tr>
<td>AZ-CSJ</td>
<td>0.7747</td>
<td>1.5212</td>
<td>1.5487</td>
<td>1.7044</td>
<td>1.4487</td>
<td>1.4780</td>
</tr>
<tr>
<td>AZ-Mov</td>
<td>0.9392</td>
<td>1.4324</td>
<td>1.3611</td>
<td>1.5276</td>
<td>1.3599</td>
<td>1.2691</td>
</tr>
</tbody>
</table>
|
{"Source-Url": "http://www.cs.cmu.edu/~wcohen/10-405/deep-3.pdf", "len_cl100k_base": 7284, "olmocr-version": "0.1.50", "pdf-total-pages": 76, "total-fallback-pages": 0, "total-input-tokens": 101250, "total-output-tokens": 9845, "length": "2e12", "weborganizer": {"__label__adult": 0.0005311965942382812, "__label__art_design": 0.00136566162109375, "__label__crime_law": 0.00036215782165527344, "__label__education_jobs": 0.0012454986572265625, "__label__entertainment": 0.0005211830139160156, "__label__fashion_beauty": 0.00026988983154296875, "__label__finance_business": 0.00022864341735839844, "__label__food_dining": 0.0011548995971679688, "__label__games": 0.0012264251708984375, "__label__hardware": 0.0030689239501953125, "__label__health": 0.0008707046508789062, "__label__history": 0.0003979206085205078, "__label__home_hobbies": 0.0002777576446533203, "__label__industrial": 0.0007772445678710938, "__label__literature": 0.0008788108825683594, "__label__politics": 0.0003273487091064453, "__label__religion": 0.0006899833679199219, "__label__science_tech": 0.401611328125, "__label__social_life": 0.0002180337905883789, "__label__software": 0.0234222412109375, "__label__software_dev": 0.5595703125, "__label__sports_fitness": 0.0003333091735839844, "__label__transportation": 0.0004405975341796875, "__label__travel": 0.00024962425231933594}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22500, 0.02952]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22500, 0.61164]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22500, 0.77945]], "google_gemma-3-12b-it_contains_pii": [[0, 24, false], [24, 295, null], [295, 324, null], [324, 897, null], [897, 1417, null], [1417, 1948, null], [1948, 2134, null], [2134, 2252, null], [2252, 2374, null], [2374, 2534, null], [2534, 2768, null], [2768, 3181, null], [3181, 3415, null], [3415, 3850, null], [3850, 3998, null], [3998, 4319, null], [4319, 4822, null], [4822, 5079, null], [5079, 5209, null], [5209, 5432, null], [5432, 5691, null], [5691, 5710, null], [5710, 5740, null], [5740, 6226, null], [6226, 6340, null], [6340, 6456, null], [6456, 6891, null], [6891, 7333, null], [7333, 7359, null], [7359, 7456, null], [7456, 7500, null], [7500, 7731, null], [7731, 7825, null], [7825, 8043, null], [8043, 8230, null], [8230, 8485, null], [8485, 8657, null], [8657, 8871, null], [8871, 9215, null], [9215, 9558, null], [9558, 9638, null], [9638, 9919, null], [9919, 10116, null], [10116, 10785, null], [10785, 11270, null], [11270, 11812, null], [11812, 13728, null], [13728, 14423, null], [14423, 14453, null], [14453, 14765, null], [14765, 15243, null], [15243, 15393, null], [15393, 15488, null], [15488, 15583, null], [15583, 15678, null], [15678, 15773, null], [15773, 15868, null], [15868, 15963, null], [15963, 16256, null], [16256, 16315, null], [16315, 16392, null], [16392, 16547, null], [16547, 17050, null], [17050, 17562, null], [17562, 17694, null], [17694, 17714, null], [17714, 18031, null], [18031, 18398, null], [18398, 19375, null], [19375, 19869, null], [19869, 20208, null], [20208, 20493, null], [20493, 21641, null], [21641, 21702, null], [21702, 21763, null], [21763, 22500, null]], "google_gemma-3-12b-it_is_public_document": [[0, 24, true], [24, 295, null], [295, 324, null], [324, 897, null], [897, 1417, null], [1417, 1948, null], [1948, 2134, null], [2134, 2252, null], [2252, 2374, null], [2374, 2534, null], [2534, 2768, null], [2768, 3181, null], [3181, 3415, null], [3415, 3850, null], [3850, 3998, null], [3998, 4319, null], [4319, 4822, null], [4822, 5079, null], [5079, 5209, null], [5209, 5432, null], [5432, 5691, null], [5691, 5710, null], [5710, 5740, null], [5740, 6226, null], [6226, 6340, null], [6340, 6456, null], [6456, 6891, null], [6891, 7333, null], [7333, 7359, null], [7359, 7456, null], [7456, 7500, null], [7500, 7731, null], [7731, 7825, null], [7825, 8043, null], [8043, 8230, null], [8230, 8485, null], [8485, 8657, null], [8657, 8871, null], [8871, 9215, null], [9215, 9558, null], [9558, 9638, null], [9638, 9919, null], [9919, 10116, null], [10116, 10785, null], [10785, 11270, null], [11270, 11812, null], [11812, 13728, null], [13728, 14423, null], [14423, 14453, null], [14453, 14765, null], [14765, 15243, null], [15243, 15393, null], [15393, 15488, null], [15488, 15583, null], [15583, 15678, null], [15678, 15773, null], [15773, 15868, null], [15868, 15963, null], [15963, 16256, null], [16256, 16315, null], [16315, 16392, null], [16392, 16547, null], [16547, 17050, null], [17050, 17562, null], [17562, 17694, null], [17694, 17714, null], [17714, 18031, null], [18031, 18398, null], [18398, 19375, null], [19375, 19869, null], [19869, 20208, null], [20208, 20493, null], [20493, 21641, null], [21641, 21702, null], [21702, 21763, null], [21763, 22500, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 22500, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22500, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22500, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22500, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 22500, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22500, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22500, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22500, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22500, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22500, null]], "pdf_page_numbers": [[0, 24, 1], [24, 295, 2], [295, 324, 3], [324, 897, 4], [897, 1417, 5], [1417, 1948, 6], [1948, 2134, 7], [2134, 2252, 8], [2252, 2374, 9], [2374, 2534, 10], [2534, 2768, 11], [2768, 3181, 12], [3181, 3415, 13], [3415, 3850, 14], [3850, 3998, 15], [3998, 4319, 16], [4319, 4822, 17], [4822, 5079, 18], [5079, 5209, 19], [5209, 5432, 20], [5432, 5691, 21], [5691, 5710, 22], [5710, 5740, 23], [5740, 6226, 24], [6226, 6340, 25], [6340, 6456, 26], [6456, 6891, 27], [6891, 7333, 28], [7333, 7359, 29], [7359, 7456, 30], [7456, 7500, 31], [7500, 7731, 32], [7731, 7825, 33], [7825, 8043, 34], [8043, 8230, 35], [8230, 8485, 36], [8485, 8657, 37], [8657, 8871, 38], [8871, 9215, 39], [9215, 9558, 40], [9558, 9638, 41], [9638, 9919, 42], [9919, 10116, 43], [10116, 10785, 44], [10785, 11270, 45], [11270, 11812, 46], [11812, 13728, 47], [13728, 14423, 48], [14423, 14453, 49], [14453, 14765, 50], [14765, 15243, 51], [15243, 15393, 52], [15393, 15488, 53], [15488, 15583, 54], [15583, 15678, 55], [15678, 15773, 56], [15773, 15868, 57], [15868, 15963, 58], [15963, 16256, 59], [16256, 16315, 60], [16315, 16392, 61], [16392, 16547, 62], [16547, 17050, 63], [17050, 17562, 64], [17562, 17694, 65], [17694, 17714, 66], [17714, 18031, 67], [18031, 18398, 68], [18398, 19375, 69], [19375, 19869, 70], [19869, 20208, 71], [20208, 20493, 72], [20493, 21641, 73], [21641, 21702, 74], [21702, 21763, 75], [21763, 22500, 76]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22500, 0.08964]]}
|
olmocr_science_pdfs
|
2024-12-01
|
2024-12-01
|
59ea3e0325790e70dfec4608a240e5626858fe8a
|
Toward Constrained Semantic WoT
Remy Rojas, Lionel Médini, Amélie Cordier
To cite this version:
Remy Rojas, Lionel Médini, Amélie Cordier. Toward Constrained Semantic WoT. Seventh International Workshop on the Web of Things (WoT 2016), W3C, Nov 2016, Stuttgart, Germany. pp.31 - 37, 10.1145/3017995.3018002. hal-01515382
HAL Id: hal-01515382
https://hal.archives-ouvertes.fr/hal-01515382
Submitted on 27 Apr 2017
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.
ABSTRACT
More and more things are now connected to the Internet and become part of the Web of Things. The notion of “thing” encompasses various types of devices, from complex robots to simple sensors. In particular, things may rely on limited memory, storage and computing capabilities. We propose an architecture able to embed both semantic and RESTful technologies into constrained things, while being generic and reconfigurable. It combines emerging standards such as CoAP and Hydra to split RDF graphs, process requests, and generate responses on-the-fly. We validate our proposition by implementing such a Server in an Arduino UNO.
Keywords
Semantic Web of Things; constrained, embedded, REST, Hydra, CoAP, arduino
1. INTRODUCTION
One of the WoT challenges is to provide building blocks for applications able to compose services offered by things as standard Web resources [4]. Relying on the Web – and REST principles – as a platform provides WoT applications with efficiency and scalability. One trend of the Web community consists in providing semantic, hypermedia-based documentations for Web APIs (aka RESTful services). This way, intelligent clients can navigate among resources and decide which service to use for a given purpose [14]. Achieving and combining these two objectives is an important direction towards which the W3C WoT Interest Group\(^1\) aims.
A promising solution consists in defining architectures able to provide clients with semantically described RESTful services (e.g. servients\(^2\) or avatars [8]), using for instance the Hydra [6] or the Thing Description\(^3\) vocabularies. From a pragmatic point of view, even if these architectures can theoretically be embedded in things, they can require a large amount of resources that may not be available on all devices. Indeed, there is currently no technology stack that allows at the same time discoverability, scalable access through Web standards and semantic interoperability, aimed to fit in constrained devices\(^4\). In order for such an architecture to meet the requirements of both the semantic WoT and constrained devices, it must satisfy the following requirements:
- **Energy efficiency**: Energy consumption of devices, especially battery-powered, should be optimized. In particular, during wireless network communications, the quantity of data transmitted should be minimized.
- **Computational resource efficiency**: Inside a server, implementing the network protocol stack requires computing resources. On constrained devices, such implementations should choose the adequate protocols to keep their memory footprint minimal.
- **Self-description**: Constrained devices should memorize their configuration in non-volatile memory, so that they can harmlessly be shut down and restarted, and send their API documentation to clients.
- **Availability**: Endpoints generated by constrained devices should be available as a Web resource and the required operations to solve requests should be kept minimal to limit processing time.
- **Scalability**: Web Servers embedded in constrained devices should be optimized to maximize the number of clients they can efficiently handle.
We herein propose a generic architecture designed to fit inside constrained devices, taking into account their limited resources while allowing them to provide clients with discoverable and interoperable access to their sensors and actuators. Our approach relies on two key technologies: Hydra for reconfigurable thing API documentations, and CoAP for block-wise transfers, which allow analysing and generating RDF graphs on the go. We intend to show how today’s Web tools can be used to embed semantic, RESTful and auto-descriptive services on such constrained devices. Our approach targets things equipped with a network interface capable of implementing the IP protocol and minimally
---
\(^1\)https://www.w3.org/WoT/IG/
\(^2\)https://w3c.github.io/wot/architecture/wot-architecture.html#general-description-of-wot-servient
\(^3\)https://w3c.github.io/wot/current-practices/
\(^4\)Constrained devices refer to connected things equipped with bare minimal power, energy, communication capabilities, and computing power (memory, processing, storage).
structured with CPU, RAM and persistent memory, plus enough program memory to store the algorithms implementing this approach. To demonstrate our design we implement our solution in a constrained device: the Arduino UNO\(^5\).
Section 2 presents a state of the art regarding both semantics in the WoT and Technical aspects of Constrained Devices. Section 3 describes our proposition of architecture, along with the algorithm that links API semantic descriptions with the internal capabilities of a thing. Section 4 presents our implementation and evaluates our proposition against the above criteria. Section 5 concludes the paper.
2. STATE OF THE ART
2.1 Semantic Web and the IoT
Today, efforts are focused on solving heterogeneity of hardware, software, and syntactic formats in the IoT\(^1\). Through the IERC AC4 \(^10\), Serrano et al. identified the problems yet to be solved in order to reach interoperability and underline the current lack of a widely used standard. Additionally, a number of initiatives tend to describe similar concepts and end up generating redundant ontologies, thus inducing the need of a commonly shared and accepted ontology \(^5\). This tendency is reinforced with projects such as Schema.org, a vocabulary created to promote the usage of a Web of Data which employs common semantics.
On the other hand, the Linked Data initiative\(^6\) encourages entities to publish structured data enriched with semantics and relies on the notion of hypermedia link to map them together. Lanthaler et al. point out that unfortunately, Linked data principles have not yet found widespread adoption among Web APIs\(^6\). Even though semantically annotating data is a big challenge today at a global scope, the services that deliver this data need also to be given meaning. This is especially true in IoT where heterogeneous devices, communication schemes and data are encountered. Guinard et al. proposed a semantic description of services in the WoT by means of JSON on Wireless Sensor Networks \(^7\). Their work stresses the use of RESTful architectures as part of the WoT. Lanthaler et al. share the same vision, in which the description of services that link the data also need to be specified with semantics. Their efforts resulted in Hydra \(^6\), a vocabulary designed to describe Web APIs in RDF applying Linked Data principles to RESTful services.
An example of application of Hydra in the WoT can be found in [13]. Ventura et al. demonstrate how a semantic web client is able to discover self-describing APIs and to query and build request sequences with no previous knowledge of these APIs. Their implementation uses Notation3 (N3) pre and postconditions rules to describe services, and JSON-LD\(^7\) as a vehicle to transport self-describing state transfers. Although we use this work as one of the starting points of our contribution, it is unfortunately too heavy to be embedded in constrained devices.
2.2 Constrained Devices and the Web
A Constrained Device or Node, as defined in IETF’s RFC 7228 “Terminology for Constrained-Node Networks”, is a device where "the characteristics that are often taken for granted for an Internet node are not attainable at the time of writing, due to constraints of cost and physical nature, such as limited battery and computing power, little memory, and insufficient wireless bandwidth and ability to communicate"\(^2\). Some facets often apply combinations of maximum code complexity (ROM, Flash), size of state complexity (RAM), processing power, available power, and user interface and accessibility in deployment.
Research work in the Sensor Network field faces challenges that can often be applied to constrained nodes. Wireless Sensor Networks have also implemented power saving modes of operation such as Power Aware Sensor Model, Event Generation Model, Energy workload Model among others \(^12\). Another Sensor Network initiative \(^9\) reuses concepts from smart homes such as the 6LoWPAN TCP/IP stack on top of which sensor data is expressed in JSON rather than XML, since the payload size is decreased. To tackle this issue, the W3C has initiated work on Efficient XML Interchange (EXI)\(^8\), which aims at dramatically reducing message payloads. These works stress the importance of REST architectures on top of HTTP and minimal payload size.
However, even though HTTP and TCP are widely accepted and used in today’s WWW, there exist alternatives better adapted to Constrained Devices. Constrained Application Protocol (CoAP) \(^11\) was conceived by the IETF CoRE task force\(^3\). It has been specially designed to fit Constrained Devices, by implementing a minimal header, while still enabling devices to keep track of multiple client requests, URI components, payload types, message codes, amongst other features found in traditional HTTP/TCP. As Castellani et al. mention, CoAP’s similarity to the aforementioned protocols makes it easy for HTTP clients or servers to interact, since all that is needed is a translation-proxy between them \(^3\). Moreover, CoAP servers are able to implement REST principles, even while relying on UDP, a simpler protocol compared to TCP’s and its range of technologies.
CBOR\(^10\) stands for Concise Binary Object Representation. A JSON-compatible model expressed in binary. Its code size is greatly reduced in comparison to traditional JSON. It is an advantageous approach when dealing with tight and bad quality networks, since the data to be transmitted does not require a significant number of packets. We find it disadvantageous to use since we already process JSON. Developing a module to encode/decode CBOR is an additional unnecessary load for an already limited memory.
3. ARCHITECTURE
We herein propose the conceptual architecture of a server designed to be implemented in constrained devices, and able to communicate with its clients by exchanging RDF graphs, serialized in JSON-LD. Network communications rely on the CoAP protocol that fits both constrained devices and REST. As the server exposes a semantic and RESTful API, it documents this API according to the Hydra specification. Through this means, it can handle three types of requests:
- The server responds to documentation requests by sending an RDF document generated according to the device internal configuration.
\(^5\)https://github.com/ucbl/arduinoRdfServer
\(^6\)http://linkeddata.org/
\(^7\)http://json-ld.org/
\(^8\)https://www.w3.org/XML/EXI/
\(^9\)https://datatracker.ietf.org/wg/core/documents/
\(^10\)urlhttp://cbor.io
• **Configuration requests** allow clients to choose which of the available operations on the object are to be enabled, disabled or configured. This gives the user control over which services are available at any given time. With the help of non-volatile memory, the state of enabled operations can be stored, which makes such configuration resilient to shutdowns, down-time and power shortages.
• **Operational requests** allow clients to query the sensors and actuators connected to the device and enabled in its configuration, in a semantic and RESTful manner.
The different building blocks of our architecture are depicted in Figure 1 and Figure 2. The most important of them are detailed below.
• The RAM contains complete representations of the server current configuration. Clients can only request services provided by operations stored in RAM at the time of the request. RAM variables establish the link between the semantic layer and the internal functions that access the configuration and the devices. These representations are necessary for the main algorithm to execute the correct function and write a complete response, including any result obtained from a correctly requested service.
• The Device Configuration stores information about the state and configuration of the object. It may vary from object to object, but the interest is that probably not all the possible capabilities of an object need nor can be available at any given time. It stores the service configurations that were made available by users as well as the involved physical components. It also acts as a backup to restore the setup previous to a power cut, intentional or not.
• The Semantic Service Repository stores JSON-LD Semantic annotations. The algorithm refers to this memory space whenever it needs to send or interpret JSON-LD documents.
The design of the server relies on the following technical principles. Switching to CoAP from traditional HTTP gives a more in-depth packet control and allows for streaming of large payloads. Indeed, using the CoAP Block-wise Transfer option on top of UDP as a synchronous transport solution removes package size limitations. Taking into consideration that most clients on the Web do not implement CoAP, we developed a simple translation proxy from and to HTTP meant to be ran outside the constrained device.
### 3.1 API and Semantics
To illustrate the semantic aspects of our approach, we propose the following application scenario: a crop field is populated with numerous constrained things, disseminated over the field. Each of these fixed things can bear different sensors and actuators. Mobile clients such as drones can move over the field, discover the available fixed things and interact with them. As all these things embed their own semantic descriptions, the client can more easily integrate data and service descriptions, reason about them, and provoke an “intelligent” global behavior, such as watering the parts of the field that lack water or guide other objects to cure diseases detected on the plants. Let us consider one of these single fixed things, equipped with a temperature sensor.
to sense weather conditions and an infrared LED that moving objects can use to proceed to the plant. It exposes a set of physical operations, aka Capabilities [8], and is able to serve a Hydra API documentation, as well as to respond to client requests concerning these capabilities.
By relying on Hypermedia, JSON-LD documents can reference context definitions and concepts that are served elsewhere. Using this mechanism, the constrained thing server only exposes the specific parts of its documentation and refers to a common ontology, shared with all other disseminated servers. Referencing this ontology allows to minimize the information embedded in the objects themselves, while maintaining semantic consistency. Figure 3 illustrates the minimal API description stored on the thing, and Figure 4 the global ontology.11
At the root of the API is a Hydra EntryPoint that leads to a collection of the above mentioned Capabilities. A capability instance can expose one or both of the capability_retrieve and capability_update hydra operations. Our ontology relies on the SSN vocabulary12 to define the respective outputs and inputs of these operations. In order for the things to be able to expose instances of ssn:Output/ssn:Input (which are disjoint) and hydra:Class, the ontology respectively provides the asawoo:Value and asawoo:Command classes. Things, however, are responsible to provide the data types they deal with. For instance, in our scenario, the thing uses SAREF13 for describing a temperature, but another vocabulary could have been used.
The API documentation is queried and processed by clients. They can take advantage of the descriptions in this documentation according to the level of expressivity present in the descriptions and to the clients’ ”understanding” (i.e. reasoning) capabilities. This allows them to query the services provided in RAM.
3.2 Startup
Whenever the device is powered up, reset, or flashed, the initial setup is immediately executed once. During this setup two classes are instantiated:
- Coap: our implementation of the CoAP protocol, which is used to handle incoming and outgoing packages. In it we find operations to manipulate payloads, as well as every function that will directly read and write a network packet.
- Resource Manager: a class created to handle representations of the semantic concepts, as well as the link between semantics and low level I/O functions, which most of the time involve Sensor/Actuator calls.
The server populates at startup a set of global variables concerning the enabled operations (list of services, service URIs, port mappings) from the Device Configuration, so that they are available in RAM. Although all possible operations are listed in the Semantic Service Repository, only the ones present in the configuration are instantiated as service templates that will be used to parse and serialize semantic information. Consequently, all necessary information is accessible to algorithm modules to perform operations. This behaviour is represented in Figure 1.a.
3.3 Thing Configuration
Enabling a service at runtime resembles a request processing, the only difference is instead of acting on a sensor/actuator, its provokes the writing of new information in the Device Configuration.
To enable/disable a service, the client must request the corresponding service URI and provide logical data about its new configuration. The semantics related to the availability of a service are defined by its boolean "EnabledStatus" property. Activation of a service is shown in Figure 1.b.
3.4 Request Processing
When a CoAP packet is received, relevant data relative to the currently requested service is saved, meanwhile the algorithm streams the incoming packages using block-wise,
and recycling the inbound buffers in an effort to maximize available space in memory.
Once all relevant information for a service is retrieved from the request and completeness is detected, the corresponding Sensor/Actuator function for that specific service is triggered. The return values are stored in a buffer. The server then sends the corresponding response using (once again) block-wise transfer. When writing into the outbound buffer, the JSON-LD payload is generated using the Service Template, and is complemented by the results retrieved from the operations on sensors and actuators, thus forming a complete response. The whole process is represented in Figure 2.a and Figure 2.b.
4. EVALUATION
We previously defined a set of criteria to enable constrained devices to integrate the semantic Web of Things: Discoverability, Self-description, Scalability, and Power and Computational Resource efficiency. As a proof of concept, we evaluate these criteria on an Arduino UNO implementation.
4.1 Implementation
The Arduino UNO and similar devices are microcontrollers conceived to host flashed C++ compiled code, also called sketch. We make use of libraries that let us interact with the physical/electronic modules as well as UDP packages. The Arduino UNO’s memory specification is detailed in Table 1. Arduino boards provide access to I/O ports, or pins. Either analog or digital, they connect the board to sensors and actuators through libraries provided by the SDK.
<table>
<thead>
<tr>
<th>Program Space</th>
<th>RAM</th>
<th>Non-volatile (EEPROM)</th>
</tr>
</thead>
<tbody>
<tr>
<td>32KB read-only</td>
<td>2KB read/write</td>
<td>1KB read/write</td>
</tr>
</tbody>
</table>
Table 1: Arduino UNO Memory Specification
Open source CoAP implementations are, to the best of our knowledge, not yet ported to Arduino UNO boards, which is why we developed our own. Due to its size, the Semantic Server Repository SSR needs to be stored in the device’s Program Space. The text based descriptions take several KBytes, and storing them as standard strings at runtime would easily overflow the Arduino’s RAM. AVR libraries available on Arduino boards provide a set of tools to manipulate Program Space pointers, which help overcome this issue. We use the non-volatile EEPROM memory to store the Device Configuration. By serializing the information about the ID and pins for a service, we effectively describe the physical configuration, as well as providing the necessary information to later fetch a service in the SSR, resulting in a list of enabled services in RAM. We developed a proxy translating headers from HTTP into CoAP and vice versa. It was developed with the TxThings library and the Twisted Framework in Python2. The implementation is represented in Figure 5.
4.2 Experimentation
Arduino devices provide a simple logging tool through a serial connection that allows us to print text during execution. Thanks to it and the observable behaviour of the board, we are able to have some degree of debugging. We test the 3 primary capabilities of our architecture:
- Service persistence/startup: Verifying the configuration is correctly saved. The same service should respond before and after removing the power source, effectively shutting down the device. To do so, we simply power off the device after using a service. We succeed if the service yields the same previous behaviour.
- Enabling a new service: Making a new service available by modifying its Enabled property and specifying its configuration. This is done by performing a POST request on /service_name/enable, including information about the physical configuration in the payload. If successful, the device responds with a 2.04 Changed CoAP message. We then request the service itself and verify the output matches our expectations.
4.3 Results
The CoAP protocol offers the option for any party to set the payload size. We take advantage of this fact to ensure CoAP packets never encapsulate more than 64Bytes, thus transmitting 130Bytes at most between the proxy and the Arduino. Furthermore, taking into account the synchronous nature of the protocol, the bandwidth consumed remains under the maximum mentioned previously. We recall and evaluate the criteria we defined to embed a semantic server into a constrained device:
- Since most clients on the Web rather implement HTTP than CoAP, our HTTP translation Proxy compensates the discoverability drawbacks. Yet, it is not necessary to go through this proxy, which allows other CoAP clients to communicate directly, effectively widening the spectrum of possible requesting parties.


<table>
<thead>
<tr>
<th>Algorithm & Class Instantiation</th>
<th>Footprint</th>
<th>Cumulative Available RAM (Bytes)</th>
</tr>
</thead>
<tbody>
<tr>
<td>968Bytes</td>
<td>1080 (52.7%)</td>
<td></td>
</tr>
<tr>
<td>Capability (x3)</td>
<td>279Bytes</td>
<td>725 (35.4%)</td>
</tr>
<tr>
<td>Static JSON Buffer</td>
<td>200Bytes</td>
<td>525 (25.63%)</td>
</tr>
<tr>
<td>Package-processing</td>
<td>24Bytes</td>
<td>501 (24.46%)</td>
</tr>
</tbody>
</table>
Table 2: RAM Usage
Footprint
CoAP packets never encapsulate more than 64Bytes, thus transmitting 130Bytes at most between the proxy and the Arduino. Furthermore, taking into account the synchronous nature of the protocol, the bandwidth consumed remains under the maximum mentioned previously. We recall and evaluate the criteria we defined to embed a semantic server into a constrained device:
- Since most clients on the Web rather implement HTTP than CoAP, our HTTP translation Proxy compensates the discoverability drawbacks. Yet, it is not necessary to go through this proxy, which allows other CoAP clients to communicate directly, effectively widening the spectrum of possible requesting parties.
Footprint
Footprint
• Services are serialized in JSON-LD and stored in Program Memory. Referencing further definitions on an external server allows us to save up to 31.2KBytes of data, close to 100% of total Program Memory. The remaining local semantics allows the API documentation to be self-descriptive, allowing semantic clients to conceive requests at runtime.
• Power efficiency is achieved thanks to the persistence of configuration and services; we can imagine scenarios where current is cut on an object by an external factor or in periodic cycles to maximise its lifetime.
• Computational Resource Efficiency is achieved through the properties a service needs to be available; non-configured services stay in the SSR, which means they have no representation in RAM nor the configuration, effectively reducing memory load. RAM usage can be visualised in table 2. With a cost of 93Bytes, 10 Capabilities can be instantiated simultaneously.
• Our architecture is able to apply some REST principles that facilitate scalability. Client-state representation is not kept in memory, and there is no out of the band knowledge necessary to retrieve URLs.
5. CONCLUSION
A big number of things are flourishing with the potential to integrate the Web in the coming years. As of today, no clear standard technology stack is ready to integrate them to the Web due to their heterogeneity. This is especially true for constrained devices, that can not rely on extensive resources to support typical Web technologies. Furthermore the price on hardware for Web-capable devices represents a major obstacle for the widespread adoption of these technologies. Embedding them in ever smaller devices minimizes the influence of this factor. The technical feasibility depended on the ability of the chosen tools and standards to fit in the constrained setup of the device. We can imagine better devices to embed the proposed architecture, but we intentionally chose an Arduino UNO to demonstrate that it is capable to cope with our expectations.
We herein proposed a minimal architecture to enhance constrained devices with semantics and improve their interoperability with Web standards. We contribute to a more distributed semantic Web, encouraging the creation of intelligent clients. Our contribution meet a certain number of criteria: discoverability through the use of commonly used technologies, power efficiency by implementing persistent configuration, computational resource efficiency by allowing only configured services to be available, self-description through semantic descriptions of APIs, and scalability by implementing REST principles.
We envisage further work towards implementing a RESTful agent instead of just servers, to learn and generate requests to other connected objects on the Web and then participate in physical mashups, as well as enabling the proxy to serve as a cache and content negotiator.
Acknowledgement
This work is supported by the French Agence Nationale pour la Recherche (ANR) under the grant <ANR-13-INFR-012>.
6. REFERENCES
|
{"Source-Url": "https://hal.archives-ouvertes.fr/hal-01515382/file/Constrained-semantic-web.pdf", "len_cl100k_base": 5568, "olmocr-version": "0.1.50", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 20429, "total-output-tokens": 6770, "length": "2e12", "weborganizer": {"__label__adult": 0.00048828125, "__label__art_design": 0.000935077667236328, "__label__crime_law": 0.000499725341796875, "__label__education_jobs": 0.0004062652587890625, "__label__entertainment": 0.00017499923706054688, "__label__fashion_beauty": 0.00024390220642089844, "__label__finance_business": 0.0002791881561279297, "__label__food_dining": 0.0005240440368652344, "__label__games": 0.0006480216979980469, "__label__hardware": 0.006458282470703125, "__label__health": 0.0008172988891601562, "__label__history": 0.0006194114685058594, "__label__home_hobbies": 0.00016486644744873047, "__label__industrial": 0.0007634162902832031, "__label__literature": 0.0004651546478271485, "__label__politics": 0.0003819465637207031, "__label__religion": 0.0008344650268554688, "__label__science_tech": 0.34619140625, "__label__social_life": 0.00012004375457763672, "__label__software": 0.0151824951171875, "__label__software_dev": 0.6220703125, "__label__sports_fitness": 0.00033664703369140625, "__label__transportation": 0.001155853271484375, "__label__travel": 0.00031948089599609375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30201, 0.03881]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30201, 0.31587]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30201, 0.88637]], "google_gemma-3-12b-it_contains_pii": [[0, 959, false], [959, 5198, null], [5198, 11743, null], [11743, 14892, null], [14892, 18659, null], [18659, 24397, null], [24397, 30201, null]], "google_gemma-3-12b-it_is_public_document": [[0, 959, true], [959, 5198, null], [5198, 11743, null], [11743, 14892, null], [14892, 18659, null], [18659, 24397, null], [24397, 30201, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30201, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30201, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30201, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30201, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30201, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30201, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30201, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30201, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30201, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30201, null]], "pdf_page_numbers": [[0, 959, 1], [959, 5198, 2], [5198, 11743, 3], [11743, 14892, 4], [14892, 18659, 5], [18659, 24397, 6], [24397, 30201, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30201, 0.07031]]}
|
olmocr_science_pdfs
|
2024-11-28
|
2024-11-28
|
1bfa2b469c71b34389c4841d0e2367a9871924c0
|
What do I think about Conway’s Law now?
Conclusions of a EuroPLoP 2005 Focus Group
Authors and focus group leaders:
- Lise Hvatum - hvatum1@sugar-land.oilfield.slb.com
- Allan Kelly - allan@allankelly.net
EuroPLoP is the annual European Patterns conference - more information here, http://hillside.net/europlop/
As well as reviewing Patterns the conference hosts a number of “Focus Groups” where participants discuss topics concerned with writing software, software development in general and related topics.
In July 2005 Lise Hvatum and myself hosted over four hours of discussion over two days on the subject of “Conway’s Law.” This paper describes the groups conclusions and our own thinking on the subject at the end of the session and after some reflection.
Conway’s Law is still open to debate.
We have proposed a second focus group for EuroPLoP 2006 on “Socio-Economic forces effecting software development.”
Some names have been replaced by pseudonyms.
Allan Kelly, January 2006.
Background to this paper
This work captures the (possibly confused) thinking from the two focus group leaders at EuroPLoP 2005 after the focus group was over and we had summarized the outcome. We both went into the focus group thinking of Conway’s Law as inevitable. Unless you heeded the organizational structure when developing software you would be in trouble.
Thanks to a fascinating and vital group of people attending the focus group, we were quickly and resolutely kicked out of our sandbox and for a period felt we were flying in outer space. Not in control (we could not really stick to the prepared model for how the focus group was to proceed, but then who cares about pre-made plans anyway…) but completely fascinated with the new discoveries the group was doing.
Defining Conway’s Law
When discussing Conway’s Law we need to be clear on which version we are analysing. In addition to the original definition from the article of Melvin Conway (Conway, 1968) there are a number of paraphrased versions of Conway’s Law in use. In this document we will discuss the following three versions:
• Raymond’s version:
“Conway’s Law prov. The rule that organization of the software and
the organization of the software team will be congruent; originally
stated as ‘If you have four groups working on a compiler, you’ll get a
4-pass compiler’.” (Raymond, 1996)
This version is the easiest to consider. It deals with a micro-situation.
Unless a conscious effort is made to avoid this situation it will happen.
The default position of many developers seems to be to divide the
problem into a number of chunks equal to the number of developers.
Although this may seem easy to manage these chunks are unlikely to be
even sizes and the resulting design is unlikely to be particularly good.
Sometimes this design is even a “make work” exercise because the
problem could be solved by a better design using fewer modules and
fewer programmers. This version of the law may be the best known and
the easiest to understand but it is actually the least interesting.
• Coplien and Harrison’s version:
“If the parts of an organization (e.g. teams, departments, or
subdivisions) do not closely reflect the essential parts of the product, or
if the relationship between organizations do not reflect the
relationships between product parts, then the project will be in trouble.
...
Therefore: Make sure the organizations is compatible with the product
architecture.” (Coplien and Harrison, 2004)
The pattern applies to the macro environment, and in short tells you to
“align architecture with organization”. System architecture will be
influenced by social and economic factors, of which the true (not formal)
communication structure in the organization is the strongest. To apply the
pattern, you are faced with a number of questions on how to implement it;
what exactly to build, where to start, and not the least how to change an
organization to support the product architecture.
• Conway’s original form of the law:
“organizations which design systems (in the broad sense used here) are
constrained to produce designs which are copies of the communication
structures of these organizations.” (Conway, 1968)
This version is the most interesting version and is compatible with Parnas’
“module as a responsibility assignment” (Parnas, 2001) - if you are
responsible for a module you should communicate with those who you
affect and should be talked to by those who use your code. If you have a
high communication bandwidth (e.g. sit next to each other) your interface
will be informal, if you are physically separate and communicate little you
may publish a formal API.
In writing up these notes the authors also became aware of the work of Herbsleb and Grinter (1999). This qualitative study considers a case in which developers have problems with modules with which they need to interface and for which they have no contact with the developer. Their case study exposes the fallacy of written documentation for this purpose.
Therefore, it is a foolish organization that attempts to limit communication between those who need to interface. However, it may not be obvious to an organization that two individuals or groups need to communicate so they may break this link without realising it.
**A new case study**
One of the session participants, Keith Braithwaite, introduced the group to a case study in which he claimed Conway’s Law had been broken. The full case study is contained as an appendix.
In this case a UK based company had expanded overseas and established local development teams. Initially these teams localised the software but over time they each maintained their own version of the software and the shared, single, code base started to break down as each team operated with their own copy of the source.
This scenario is completely compatible with Conway’s Law. Communication within each team was better than between teams so the system architecture fragmented into multiple versions of the code base - one per team.
As the fragmentation increased so did costs and eventually the senior management decided to break the cycle. An active decision was made to support only one code base. The company decided to adopt a variant of *Extreme Programming*, which would be adopted by all teams. Some teams where disbanded altogether and those that remained where brought together to create new communication channels.
Once the team members had all met and been trained in the new methodology they returned to their development centres - now reduced to three, UK, West Coast USA and Singapore. These teams adopted the new working style and created a new communication path by participating in thrice daily hand-over meetings on video link up - once at the start of each teams work day and once at the end.
To date the new way of working has been successful and there is a single, shared, code-base.
At least superficially this study presents a case where Conway’s Law was broken. The teams had been overcome by communication paths that created an architecture. Management had intervened and changed the architecture to overcome the power of Conway’s Law.
Herein lies a lesson for organizations outsourcing and/or off-shoring: you are inserting a barrier between two groups, you will need to replace informal communication structures either with formal structures or technology which allows new communications paths to replace the old.
Lesson #1: Informal communication is important in developing software. If a barrier to informal communication is created (e.g. outsourcing or off-shoring) it is necessary to compensate for the barrier. Failure to do so will affect the software architecture.
The system concept
Conway does give us a “get out of jail free” card:
“the need for communication depends on the system concept in effect at the time”
By changing the system concept we can change our system and re-direct our communications. For example, a team focused on performance will communicate with different people to a team focused on deadline.
If we return to the ABC case study we see we can also explain the case study in terms of the system concept. Management decided to intervene, they changed the system concept - in part through the adoption of a new methodology - and remade the communication channels - some where removed completely, others where improved (personal contact as in the Herbsleb and Grinter study) and new ones introduced (e.g. video handovers).
One question remains: Does ABC still obey Conway's Law?
On the one hand it broke the law because it escaped the tyranny of the law. On the other hand, the new situation still obeys Conway’s Law, architecture is still following communication but we have changed the communication path.
Lesson #2: We are not powerless; we can intervene and change the system concept. Removing barriers requires an active intervention.
1960’s Context
It became clear during the focus group discussion that the organizations that Conway was thinking of were typical for the 1960’s. They had a strong hierarchy, and the communication structure was basically a mirror of the reporting structure. Of course these organizations still exist today. The defence industry, public offices, and those who insist on sticking to waterfall development methodologies are good examples.
But many modern software development organizations allow for completely free communication independent of reporting lines. Developers are actually expected to contact whoever they need to for their work. Working across geographic locations and time zone do impose some boundaries.
At the same time communication costs have fallen, not only does every developer have a phone on their desks but they probably have a cell-phone, instant-messenger, global e-mail, conference calls and video links. Not only has the variety of mediums increased but the cost has fallen by an order of magnitude.
The proliferation of plentiful - and cheap - communication channels does not guarantee communication but they are a pre-requisite for good communication. As both the ABC and Herbsleb and Grinter studies show these channels are more frequently used when individuals meet and know the other individuals.
**Lesson #3: Give developers good communication links and ensure they meet one another - especially those who are based remotely.**
This echo’s Coplien and Harrison’s *Face to Face Before Working Remotely* (Coplien and Harrison, 2004).
**The Homomorphic force**
Conway also gives us the homomorphic force:
“This kind of structure-preserving relationship between two sets of things is called a homomorphism.” (Conway, 1968)
The idea of homomorphism is established in mathematics (see http://en.wikipedia.org/wiki/Homomorphic) and the authors believe it can be seen in other fields (e.g. biology, social science) but further research is required to validate this claim.
This is the reason system designs become a copy of something else. We need to understand this force in more detail - this is an area of research.
The homomorphic force is in effect the thing that many people are actually referring to when they say “Conway’s Law” - it is clear that Raymond’s version of “Conway’s Law” is actually describing the homomorphic force.
Once we accept this we can now understand Conway’s 1968 piece in three layers:
- Lowest level: Conway introduces us to the *Homomorphic force* and describes some of its effects.
- Middle: Conway’s broader argument encompassing the homomorphic force, division of a system along communication paths (akin to Parnas’ responsibilities) and effect of the *system concept*.
- Top: Conway’s entire article, which adds his 1968 context, his foreshadowing of Brooks Law (Brooks, 1995) and his solution in calling for “lean and flexible [organizations].”
It would also appear that the homomorphic force has an additional characteristic that makes it extremely powerful: it is self-reinforcing.
We know already that software architectures are difficult to change, as are organizations. We can reason that the two are mutually supporting. Once software takes on the characteristics of the wider organization it will serve to reinforce the organizational structures, which in turn will strengthen the software architecture.
Barriers that are created this way will be extremely difficult to remove. An attempt to change the architecture will conflict with the organizational structures and vice-versa.
Because of the self-reinforcing nature of the homomorphic force organizations will still copy themselves in code unless this and other forces are actively considered and managed (i.e. used or countered).
**Beyond homomorphism and communication**
Given the power of the homomorphic force it is important we seek to increase our understanding of these other forces and how they affect our designs.
Homomorphism is not the only force which effect system design, there are others. Nor are communication paths the only factors that may be reflected through the homomorphic force into system architecture. Unfortunately the homomorphic force is so powerful that other forces may be ignored and left unbalanced. This can cause problems later in the system history.
Other forces may include:
- Financial forces, e.g. in an attempt to keep its wage bill low a company may only hire recent graduates to develop software, consequently many practices of mature developers are absent. Use of outsourcing IT partners and/or global distribution of team members create new challenges and strongly affects the communication structures.
- Political forces, large corporate will often mandate a particular OS or language be used on all projects.
- Organizational forces, e.g. how democratic or bureaucratic the organizational culture is. Bureaucracy may interfere with communication, financial decision-making, recruitment, training and any number of other factors.
- Communication forces, where the reduced cost of communication has enabled quick and easy access to a much larger number of people involved on many levels and in numerous roles with a project, while the ease of communication means that it is hard to control who talks to who even if the desire to control is there from the management.
- Cultural forces, e.g. the relationship between younger engineers and management has changed considerably since 1968. This impacts communication but also decision making and the architectural freedom of the development team.
We could list more forces or go more in detail, but choose not to since it does not reflect the work of the focus group. One thing the group did agree on was that technical considerations play a relatively minor role in the design of a software system compared to external forces. What the discussion on other forces told us is that organizations have changed since 1968 (or at least some have, or maybe they are new and different organizations). This is changing the context and the relative strength and effect of the dominant forces.
It would seem that when Conway wrote his article in 1968, a number of forces where all pushing in the same directions, for example, hierarchy, bureaucracy and expensive communication. Many of these forces have changed since 1968. Forces that were strong are now weak (e.g. hierarchy) while forces that where weak are now strong (e.g. corporate democracy.) Other forces have changed direction, e.g. communication as discussed above.
Of course these forces will vary from company to company and department to department. One may still find highly hierarchical organizations (e.g. the civil service) but they are no longer the rule.
We should also seek to increase our understanding of the user role in system design. This is particularly important in the contexts of ERP, organizational change and markets. The authors hope to explore this dimension in a future.
**Homomorphic designs**
Designs that are overwhelmed by the homomorphic force can be termed “Homomorphic designs.”
Unless the organization is structured to support an optimal design and is willing to change as the architectural needs are changing (which we believe is rare), homomorphic designs are most likely not optimal. Better designs can be produced if the organization makes an effort to consider other forces - both in software and process design.
**Lesson #4: If we do not choose to actively break homomorphism it will take control of the architecture, so we must actively choose to design systems that break homomorphism.**
**The problem is: homomorphism is a very strong force but it does not result in good solutions because it does overwhelm other forces.**
(For a few (dysfunctional) organizations it may be that embracing the homomorphic design and allowing the organization and software to mirror each other may actually be an improvement over the current status quo.)
Structure is about barriers and balancing forces. Designing software is about choosing where to place barriers; homomorphism will reduce your freedom in making balanced choices in where to place these barriers. Once in place these barriers grow in strength, but some barriers will be in the wrong place and will become obstacles.
People will also create barriers themselves: to protect themselves, to protect their teams and avoid anxiety - sometimes called *social defences*. In a case study Wastell describes how software developers can create defences:
“The argument is, thus, that methodology, although its influence may be benign, has the potential to operate as a ‘social defence’, i.e. as a set of organizational rituals with the primary function containing anxiety. The grandiose illusion of an all-powerful method allows practitioners to deny their feelings impotent in the face of the daunting technical and political challenges of systems development.” (Wastell, 1996)
Obviously, such barriers often become obstacles.
We, as system designers, need to know when to create a barrier and when to remove one, when to reinforce one and when to weaken one. To do this we work in two domains: the technical and the social.
The ABC case demonstrates this. The geographically different groups built their own defensive barriers - in code. Eventually the manager decided to blow up the barricades - both social and technical behind which people were working. Simultaneously they introduced new communication channels that allowed technical changes.
The same is true in the Herbsleb and Grinter study: after engineers had visited the other site things improved because barriers had been removed.
In complex organizations it can be difficult to tell which is which. It can be difficult to tell which is a barrier preventing change and which is enhancing the design. Removing barriers can destroy designs and lose knowledge.
This is the mistake made by Business Process Re-engineering. Barriers were removed and new ones added and all the time knowledge (particularly tacit knowledge) was lost.
One way around this is to create a culture where change is accepted and understood. This means a culture that learns. Not just the individual but also the team, the organization. A learning team will be a flexible one, a team driven to learn and improve will be lean - we know this from Toyota (Kennedy, 2003, Womack et al., 1991, Cusumano and Nobeoka, 1998).
And this is what Conway calls for: organizations that are lean and flexible.
Conway was right but things are more complicated than he thought. In the twenty-first century we need a new understanding of his argument for a new context.
Appendix A: ABC Case study
ABC began as a British company based in the UK. They proceeded to own offices in the US, in Latin America (sales only), South Africa, Singapore and Australia.
The development organization was structured as follows: a “Global Team” group in the UK doing the core system; this was the oldest and most experienced development team, and they were close to experienced customers. The other sites had satellite development teams doing extensions, branding and adoptions for local markets. As an example, Singapore had to deal with several languages and became good at localization. South Africa had infrastructure problems and had to duplicate databases. The team in Australia used different technology and developed their own functionality.
After a few years, started to observe that work was duplicated, the cost was high, and it was difficult to upgrade to new core updates. As a reaction, the “Global Team” plus local team in the UK started to put up barriers to stop changes in the other locations. Feedback loops with the other teams going on to incorporate local changes into upgrades. Manager felt he was paying 5 times for the same feature, and other locations could not benefit from a feature developed at a certain location.
The manager asked the Head of the Global Team to “fix” it. The decision was made that there is no local ownership. There is one code base. Each market gets the advantage of all development independent of location. No cracks because of local development.
To implement, all developers were brought together for 6 weeks (about 30 people). A new architecture was put in place that was a better fit for the product. This architecture reflects the problem domain and not the structure of the development team.
Shortly afterwards the company found it necessary to reduce the size of the team with some positions becoming redundant. Preference was given to retain individuals who would fit best with the new collaborative environment. Of those who left the team some where retained on other projects in the development group.
Today all the teams are working on a shared code base. If one team wants to make changes:
They just do it – and if it is not good other teams will remove the change
At the end of each day there is a videoconference with other teams, due to the time difference this works like a sliding window around the world
For big changes they do a position paper on the team wiki. There is no lead architect. The global team (20+ people) will go on until they reach consensus in the discussion.
The system that is being built is deployed in live situations.
The top level of management is where the decisions meet.
Needed someone from the outside to do the change.
Appendix B: Further comments
When this report was complete the authors circulated it to the focus group participants and asked for additional comments for inclusion. We also asked Neil Harrison and Jim Coplien, authors of the Conway’s Law pattern for comments.
Kevlin Henney and Keith Braithwaite, both of whom participated in the focus group, and Neil Harrison responded and we include their comments here.
Comments from Kevlin Henney
I first came across Conway's Law in the New Hacker's Dictionary (Raymond, 1996), where it was presented as "the rule that the organization of the software and the organization of the software team will be congruent". I later came across it again presented as a pattern (Coplien, 1995). And then just a couple of years ago I had the good fortune to read the original paper by Conway (Conway, 1968), followed by the more detailed pattern write up in Organizational Patterns of Agile Software Development (Coplien and Harrison, 2004).
There have been a few things that have troubled me about the various billings of Conway's Law, and many of them simply come down to the (mis)use of the word "law". One sense of the word "law" is a strong rule that is agreed upon in some social structure, with the implication of judgement and penalty for any violation. Another common sense is in the sense of physical law, for which there is no concept of violation. It is quite clearly possible to break Conway's Law both with and without penalty, depending on other factors. This suggests that the term "law" is quite the wrong one, and what is being described here is a force. It also means that it doesn't make as much sense to talk about breaking a force as it does a law. Admittedly, Conway's Force sounds less catchy, but does appear more accurate.
When characterised as a force many things fall into place. It is not the sole determinant of software architecture, so in shaping an architecture it is one consideration of many. Its overall effect will relate to the strength of the other forces at play. This seems more in keeping with how development projects are observed to unfold. If the force exerted by the organisational communication paths were the only force, then there would be nothing more to software architecture than the communication paths in the organization. Of course, this is not what is observed.
For example, in the limit, a one-person project would produce, according to a strict interpretation of the force as a law, no modular structure in its software architecture.
Another example that should result in a flat architecture would be a small, close-knit team where code is shared transparently and effectively. That this is not always the case demonstrates, by simple contradiction, that what is at
play here is no law. That this is sometimes the case does, however, highlight
that there is something important here that cannot be ignored: organisational
structure is a necessary (but not sole) consideration in software architecture.
Hence why it makes more sense to look on it as a force rather than a law. It is
a force that is not hard to observe in action, but it is also easy to see it come
into conflict or sympathy with other forces.
From a pattern perspective, this idea of a force makes perfect sense:
conflicting forces make up the tension in a problem that the proposed
solution is intended to resolve. However, this perspective does mean that
Conway's Law (Coplien and Harrison, 2004, Coplien, 1995) as a pattern is
named after a problem force rather than a solution structure. This in turn
highlights another issue: as a pattern, if what have come to know as
Conway's Law is a force, what exactly is the solution?
The earlier version of the pattern (Coplien, 1995) was also documented with
two synonyms: Organization Follows Architecture and Architecture Follows
Organization. These are very descriptive, especially for someone who may
be unfamiliar with the Conway connection, and I have found them helpful
when reading and referring to the pattern. However, these two names also
describe two quite distinct solutions with quite different characteristics. The
first suggests that the architecture of the software dictate the structure of the
organization around it, and so the organisation is considered to be
subordinate to the software. The second suggests the converse. The advice is
quite different in each case, although both cases pursue a common cause of
architecture-organisation alignment. So is this perhaps two patterns rather
than one?
The pattern's solution text is a little ambivalent, suggesting that the important
feature is that the organisation and software architecture are aligned, and that
a secondary consideration is that the software should probably, but not
necessarily, drive the organisation. This description is also in part true of the
later documentation of the pattern (Coplien and Harrison, 2004), but
importantly this later description also states that "care should be taken to
align the structure of the architecture with the structure of the organization by
making piecemeal changes to one or the other". And in this statement lies an
apparent resolution: there are (at least) three patterns at play here.
The root pattern we can name Align Architecture and Organization, and this
captures many of the points that the original versions of the pattern focus on
as issues and benefits.
To Align Architecture and Organization we can make changes so that
Organization Follows Architecture, or so that Architecture Follows
Organization, or both, responding to feedback from each previous change
and other factors at play in the architecture and organization. This separation
makes clearer the distinct and complementary approaches at work here,
rather than including them in the slipstream of the root pattern. Hence, there
is more scope for discussing the interaction and choice of pattern application
in a given situation, and I believe that such clarity and generatively is no bad
thing.
Comments from Neil Harrison
First, I have no feedback on the report itself; as far as I can tell, it is an accurate report of what went on in the workshop.
Naturally, I do have feedback on the content of the workshop. Whether you add or change your report based on my comments is entirely up to you.
(Authors note: We chose to leave the text unchanged.)
By nature, workshops tend to be an exchange of ideas. Opinions are often given without much evidence to back them up. This is appropriate. This workshop was no exception. In particular, one person presented a single case study which was supposed to call Conway's law into question.
Conway's law has been around for over 35 years. We have seen it over and over again in our studies. And we aren't alone. One counterexample does not invalidate a widely substantiated theorem. But even more to the point, when I read the case study, it didn't contradict Conway's law at all! In fact, it reinforced it. Note what happened:
Separate teams worked on separate parts of the system (Conway's law), until the architecture deteriorated enough that they had to do something (note the lack of Architect Controls Product.) Then they redid the architecture by basically creating a single blob. And then - this is important - they redid the teams by bringing everyone together (Lock Em Up Together, Face to Face Before Working Remotely). After the team size was reduced they were down to 15 or so people. That's about the size of one team...
Note that Lock Em Up Together is about forging team unity as much as forging architectural unity.
Now it's hard to have a single team that is geographically distributed; there is a natural tendency to form local teams. And local teams will eventually cause architectural drift. The company knew this, so they took actions to prevent it. They have daily meetings, which enforce the single team concept. They are bucking natural tendencies, so they have to take overt, constant, action against it.
This will be hard for them to sustain.
By the way, note also that there is no lead architect, and the top level of management is where the decisions meet. This means either that the top manager is the de facto architect, or they again have lack of Architect Controls Product. Either way, that sounds potentially troublesome.
Other stuff:
There appeared to be general agreement in the workshop that things have changed since the 1960s; that teams have become less hierarchical, that communication channels have increases, and that Conway's Law was most appropriate for the old teams of the 1960s. So it needs rethinking in the modern world.
These are opinions. (Again, a workshop is all about discussing opinions, so this is perfectly all right.) My opinions on the above are that I disagree with basically all of them.
In the 1960's, many software developments were small; relatively few were large. Small developments had small teams with flat (or nonexistent) hierarchies. Now, many software developments are still small, in terms of people. Relatively few are large. Small developments have small teams, and large ones have large teams.
Communication has indeed increased. At the same time, we have lost much of the advantage by distributing teams, which decreases the quality of communication. We distribute teams in ways no sane organization in the 1960's would have. At best, it's a wash, but we may be even worse off than we were before, in terms of the quality of information flow.
So I guess I disagree with your last two sentences: I think that the changes that have happened in the last 35 years pale in comparison to the things that have remained the same...
Comments from Keith Braithwaite
I first came across Conway's Law while pursuing a Master's degree in Software Engineering, around a decade ago. During the following ten years I somehow did not notice that I had arrived at an opposite understanding of the "Law" from most observers--until attending Allan's and Lise's workshop where I discovered to my surprise that I was the only person there who considered that the Law described a failure mode. Rather, in my mind, after the fashion of the laws of Brooks and Parkinson. Yes, the phenomenon described by Conway's Law occurs, it even is widespread, but it's neither inevitable nor desirable. That was my view. Yet the common view amongst the workshop attendees was that the Law described an outcome so desirable that even if it did not arise naturally (as it was almost bound to do), then it should be induced. Puzzling, stimulating and challenging!
It so happens that my first work as a professional programmer was to do with compilers, and so the common shorthand form of the law, suggesting that four teams will build a four-pass compiler very obviously to me described a pathological situation, in which a far-reaching technical decision ("architecture" indeed) was driven by an artefact of staffing. And so with the Law more broadly understood: what are the chances that the reporting lines of a development organisation map onto the architecture of a system to be built in a way most beneficial to the customer? Why would a competent development organisation allow such a constraint to apply.
In preparing for the workshop, I read Conway's original paper. It asserts that there will be a 1:1 mapping between the org. chart of the organisation building a system and a graph of the information flows within the system. We did see this in operation at ABC: a hub-and-spoke organisation of the business lead to a system built from a core component with local additions.
What do I think about Conway's Law now? 16-Jan-06
This failed for us, so we chose to do something different. Amongst other things, we chose to decouple the architecture of the system from the structure of the business, in the hope that they could then both find their best respective forms.
In Conway's model a developer A working on a module can only execute work to agree an interface with another module worked on by developer B by appeal to the "least common manager" of A and B, C. And thus the homomorphism described arises, with the dataflow between the two modules corresponding to the reporting lines from A and B to C. Again: why would you put up with such overhead? At ABC we do not. If a developer working on a story (the implementation of which might cut across multiple modules) needs to agree an interface (or anything else) with another developer, then they simply do so, peer-to-peer. The least common manager likely won't, doesn't need and probably doesn't want to, know about it. The developers can, if they are in the same site, simply talk to each other. If they are in separate sites, they can communicate with one another freely via the (single) code base, via email, via the team wiki, via the twice-daily videoconference, via distributed pair-programming sessions. At the time of writing, this practice has been in place for almost two years, and continues to work well. Meanwhile, the system architecture is what(ever) it needs to be.
During the discussion of this case in the workshop it was suggested that this was indeed Conway's Law in action! One team, one code base, therefore homomorphism. If this is Conway's Law, then I would suggest that the law is content free. The suggestion that "architecture is still following communication" in the ABC case simply makes no sense to me.
Our single global team is not atomic, rather it has an internal structure--three regional sub-teams, each with a local line manager who reports to the group CTO. Communication between the three regional groups is structured around the twice daily videoconferences. Our code base similarly has structure. It is built out of several relational schemas, a J2EE container full of beans, a substantial library of POJO's, servlet engine and contents, Velocity templates (and not just for web presentation), an extensive MVP framework, O-R mapping layer, stand-alone Java applications, Ruby on Rails web apps, stand alone servlets, etc. etc. But there's no partition of anything in the code into three to match our three local groups of developers. And there is no hub-and-spoke (CTO<->regions), and there is no three layers (CTO<->Regional Head of Development<->Developer).
There continues to be no architect (and the CTO is most definitely not one). Team members around the world continue to spike, lobby their peers for, and execute architectural change as and when they see fit, to better serve their customers and users.
Our architecture does not follow our organization, nor vice versa other than in the most trivial ways. For instance, we have RDBMS's, and we have DBAs to run them, but a developer can institute a schema change, or introduce a new schema even, without consultation via the least common manager.
I invite anyone who maintains that we exhibit Conway's Law to come learn about the structure of our system (this week :) and the structure of our team, and then present back to us the homomorphism they find. I'd expect this to be a short presentation, but I'll be happy to be surprised.
We have chosen not to accommodate the homomorphic force that would tend to distort our architecture to match our organisation, or conversely our organisation to match our architecture and either way make both unreasonably hard to change (as noted in the workshop outcomes). This can be done, and based upon my experience at ABC, vs. experience elsewhere (particularly with other distributed teams) must be done. And I remain convinced that we have done it.
What do I think about Conway's Law now?
16-Jan-06
**Bibliography**
Herbsleb, J. D. and Grinter, R. E. 1999 Architectures, Coordination, and Distance: Conway's Law and Beyond, *IEEE Software*, 16, 63-70.
Kennedy, M. N. 2003 *Product Development for the Lean Enterprise*, Oaklea Press, Richmond, VA.
|
{"Source-Url": "https://www.allankellyassociates.co.uk/static/presentations/EuroPLoP2005/ConwaysLawFocusGroup.pdf", "len_cl100k_base": 7834, "olmocr-version": "0.1.53", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 32459, "total-output-tokens": 8997, "length": "2e12", "weborganizer": {"__label__adult": 0.0003638267517089844, "__label__art_design": 0.0004723072052001953, "__label__crime_law": 0.00029349327087402344, "__label__education_jobs": 0.0019931793212890625, "__label__entertainment": 5.340576171875e-05, "__label__fashion_beauty": 0.00013327598571777344, "__label__finance_business": 0.000484466552734375, "__label__food_dining": 0.0003421306610107422, "__label__games": 0.00039124488830566406, "__label__hardware": 0.000431060791015625, "__label__health": 0.0003552436828613281, "__label__history": 0.00022125244140625, "__label__home_hobbies": 7.593631744384766e-05, "__label__industrial": 0.0002884864807128906, "__label__literature": 0.0003314018249511719, "__label__politics": 0.0003437995910644531, "__label__religion": 0.0003523826599121094, "__label__science_tech": 0.003498077392578125, "__label__social_life": 0.00012493133544921875, "__label__software": 0.0033931732177734375, "__label__software_dev": 0.9853515625, "__label__sports_fitness": 0.0002715587615966797, "__label__transportation": 0.0004351139068603515, "__label__travel": 0.00019931793212890625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 39279, 0.01107]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 39279, 0.22378]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 39279, 0.96279]], "google_gemma-3-12b-it_contains_pii": [[0, 2103, false], [2103, 4667, null], [4667, 7451, null], [7451, 9942, null], [9942, 12299, null], [12299, 15033, null], [15033, 17869, null], [17869, 19584, null], [19584, 22274, null], [22274, 25083, null], [25083, 28325, null], [28325, 30953, null], [30953, 33913, null], [33913, 37145, null], [37145, 37890, null], [37890, 39279, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2103, true], [2103, 4667, null], [4667, 7451, null], [7451, 9942, null], [9942, 12299, null], [12299, 15033, null], [15033, 17869, null], [17869, 19584, null], [19584, 22274, null], [22274, 25083, null], [25083, 28325, null], [28325, 30953, null], [30953, 33913, null], [33913, 37145, null], [37145, 37890, null], [37890, 39279, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 39279, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 39279, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 39279, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 39279, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 39279, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 39279, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 39279, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 39279, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 39279, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 39279, null]], "pdf_page_numbers": [[0, 2103, 1], [2103, 4667, 2], [4667, 7451, 3], [7451, 9942, 4], [9942, 12299, 5], [12299, 15033, 6], [15033, 17869, 7], [17869, 19584, 8], [19584, 22274, 9], [22274, 25083, 10], [25083, 28325, 11], [28325, 30953, 12], [30953, 33913, 13], [33913, 37145, 14], [37145, 37890, 15], [37890, 39279, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 39279, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
4eb482de0edee8fcc90dbabda10af64d861e6aee
|
Parallel Belief Propagation for Image Denoising
15-418 Final Project Report
{vidhana, rbrigden}
May 8, 2018
1 Summary
We implemented parallel loopy belief propagation (LBP) for large graphical models using OpenMP on a multi-core CPU. Given the acceleration achieved by two of our three parallel implementations of LBP algorithms, we were able to run an unsupervised image denoising task with an 12 million variable loopy Ising model. The algorithms inherently are NP Hard and difficult to scale. We were able to achieve a 7x speedup (Carnegie Data) over the sequential baseline without using any locks.
2 Background
Graphical models provide common language for representing statistical models in machine learning. Belief propagation (graphical model inference) efficiently computes the marginal distribution over unobserved variables given the observed variables of a model. Belief Propagation in graphs is a NP-Hard inference problem. We try to see if we can do any better by using approximation based algorithms instead and scaling it for a multi-core system.
2.1 Loopy Belief Propagation
The loopy belief propagation algorithm applies to computing the marginals in undirected graphical models known as Markov Random Fields (MRFs). Unlike directed graphical models in which an edge represents a conditional dependency of one variable on another, an edge in an MRF has no directional relationship and specifies an ambiguous relationship. The celebrated Hammersley-Clifford theorem demonstrates that the joint probability of an MRF can be factored as a product of a potential function $\Psi$ applied to all maximal cliques in the graph – that is for an MRF with a set of maximal cliques $C$,
$$ P(X_1 = x_1, \ldots, X_n = x_n | \theta) = \frac{1}{Z(\theta)} \prod_{A \in C} \psi_A(x_A | \theta) $$
where \( Z \) is a normalizing function of the parameters. The belief propagation algorithm uses the observed values of some subset of the model’s variables to marginalize the values of the unobserved variables. Without being too pedantic about the specific derivation of the algorithm, consider a clarifying example of a loopy model (simply a graph with loops) with 4 variables and 4 edges. We will use this same representative example to discuss some details of our parallel implementation.
Say we wish to compute the marginal of \( a \), then we need to do the following. First set up the joint (size of all maximal cliques in this graph is 2).
\[
P(a, b, c, d) \propto \psi_{a,b}(a, b) \psi_{a,c}(a, c) \psi_{c,d}(c, d) \psi_{b,d}(b, d)
\]
Now marginalize over all the variables except \( a \).
\[
P(a) \propto \sum_b \sum_c \sum_d \psi_{a,b}(a, b) \psi_{a,c}(a, c) \psi_{c,d}(c, d) \psi_{b,d}(b, d)
\]
Notice that we can “push” these sums through some of the potentials if they do not depend on any variable in that potential.
\[
P(a) \propto \sum_b \psi_{a,b}(a, b) \sum_c \psi_{a,c}(a, c) \sum_d \psi_{c,d}(c, d) \psi_{b,d}(b, d)
\]
From here we see that two of these summation terms are going to leave the term in terms of a through marginalization. We create a useful abstraction for these kind of terms that pass information directly between adjacent nodes and call them \textit{messages}. Breaking the computation down into messages allows us to simply consider communication between adjacent nodes, making the problem amenable to parallelism. A message from a variable (node) \( i \) to \( j \) is denoted as \( m_{i \rightarrow j}(j) \)
\[
P(a) \propto m_{b \rightarrow a}(a) \ m_{c \rightarrow a}(a) \ \sum_d \psi_{c,d}(c, d) \psi_{b,d}(b, d)
\]
Notice above that we can’t formulate that last term as a message. It turns out that if this graph was a tree structure then we could run BP and get the exact
marginal values. Not all is lost – in loopy BP it turns out that we can simply pass a function of a subset of the incoming messages to a node to its neighbor nodes, updating their belief incrementally with these received messages. However, the algorithm is only guaranteed to converge to a fixed point if it converges at all (it can diverge if certain conditions are not met). Based on this, we define an iterative update for both the message values
\[ m_{i \rightarrow j}(t+1) = \sum_{x_i} \psi(x_i, x_j) \prod_{k \in N(i) \setminus j} m_{i \rightarrow k}(t) \]
where \( N(i) \) denotes the set of \( i \)'s neighbors. The belief at a node \( i \) (which is the same as the marginal estimate at convergence) is simply the product of its incoming messages!
\[ P(x_i)^{t+1} \propto \prod_{j \in N(i)} m_{j \rightarrow i}(t) \]
With this result, we note that we can calculate each node’s incoming and outgoing messages until some state of convergence is reached across all messages in the system. We investigate applying parallelism in this manner and show that the we can achieve a good speedup over a serial baseline. However, we also explore other variants of that simple algorithm that are less naturally amenable to parallelism, but exhibit better properties of convergence.
### 2.2 Ising Models for Image Denoising
We consider a similar but much larger and practical version of the square loop model in Figure 1. An Ising model is a loopy MRF composed of binary random variables in which the nodes are arranged in a grid and edges are placed between adjacent nodes. These are referred to as the latent variable nodes \( x \). Additionally, each of the latent variable nodes have a single edge connecting them to another independent node that we call an observable node \( y \). For an \( N \times N \) grid of latent variables in an Ising model, there are a corresponding set of \( N \times N \) observable nodes.
Because the maximal clique size of the Ising model is the same as the square graph, 2, we define potential functions on all edges. The domain assumption
of the Ising model is that adjacent latent variables encourage each other to maintain the same “polarity” and penalize them otherwise. Furthermore, every latent variable is highly encouraged to maintain polarity with its respective observable node. In order to obtain these useful properties, we specify the two potential functions of the Ising model
$$\psi(x_i, x_j) = \begin{bmatrix} 1.0 & 0.9 \\ 0.9 & 1.0 \end{bmatrix}$$
$$\psi(x_i, y_i) = \begin{bmatrix} 1.0 & 0.1 \\ 0.1 & 1.0 \end{bmatrix}$$
For these properties, the Ising model is very well suited for the task of image denoising. We take each observable node $y$ to correspond to a pixel in the noisy observed image and the pixels of the “true state” image with noise removed to correspond to the latent nodes $x$. If we marginalize each $x_i$ and take the most likely belief for each to be our estimate of each true pixel value, then we can reconstruct the image with these estimates as our overall “denoised” image.
As demonstrated previously, we can efficiently compute the marginals of a large set of random variables in an MRF using belief propagation. Given that the Ising model is a loopy graph on the order of $N^2$ nodes, where $N^2$ is the number of pixels in the image, it requires a significant number of message passing iterations before convergence. As such parallel acceleration is a very needed and, as we have discussed and will demonstrate, amenable to this application.
2.3 Loopy BP Algorithms We Implemented
The critical operation in all forms of loopy belief propagation is the task of reading and writing messages between adjacent nodes.
2.3.1 Batch (Synchronous)
This is an inherently parallel approach in which all the messages that every node needs to generate can be computed simultaneously. One of the key advantages of parallelizing this algorithm is that the message generation for every node is independent of other nodes and therefore there is no communication or mutual exclusion needed between different threads.
This is because the Bulk Synchronous approach requires that two copies of all messages is maintained at all times - one copy to read as input and another copy to store the resultant outputs. Both the copies are swapped at the end of every iteration.
2.3.2 Round-Robin (Asynchronous)
In asynchronous scheduling, we use the same copy of messages to both read the inputs and write the resultant messages (instead of maintaining two separate copies). Thus there is in-place updates to the messages which multiple processors could be reading from. In the round robin algorithm, we define a fixed
but random permutation (using Fisher Yates Algorithm) of all the vertices and these are then updated in that order repeatedly till convergence. Because of in-place updates, it is possible that readers get inconsistent message because another writer is currently updating that message. Therefore this algorithm requires locks to be placed on messages before reading or writing. When it is a node’s turn to generate the messages for its neighbors, it acquires locks all the slots it would use to fill up the new messages. For this algorithm, we used the atomic operation of \texttt{sync\_fetch\_and\_add} to increment a variable and return its old value (to be used to index into the permutation we discussed). Thus each processor atomically reads in the shared index variable and increments it. Once the processor reads in the value from the shared counter, it executes the algorithm on the node corresponding to that index in the permutation.
2.3.3 Wildfire (Asynchronous)
This algorithm is a further optimization over the round-robin algorithm discussed in the previous section. If one of the regions has converged while the other region still needs more iterations, the iterations over the first regions waste unnecessary cycles generating messages that are only slightly different than their previous ones. The wildfire algorithm addresses this problem by skipping the vertices that have converged.
In this algorithm, we introduce the notion of a residual which is an approximate measure of the amount of new information that has not yet been sent by a node. If we skip the vertices which have converged with respect to this notion of residual, then we have the wildfire algorithm.
3 Approach
We did not start with any existing code and wrote the algorithm based on the equations in [4] and the algorithm sketches for BSP, Round-Robin, and Wildfire in [2]. So the initial part of the project for us was to get a good handle on the domain knowledge of probabilistic graphical models.
All these algorithms work by each node in the graph estimating a probability density over possible labels for all its immediate neighbors and then sending this 'belief' to each neighbor. The calculation of the belief is different for every (source, destination) pair of vertices.
Also note that the Ising model [Fig2] converts the image into 2 sets of node - the unshaded ones and the shaded ones. The shaded ones are the noisy pixel observations of the image before it is denoised. The unshaded ones are the true pixel values which we want to infer from the algorithm based on the messages they receive from their neighbors.
The initial challenge was to figure out how to lay the data in a shared memory setting which for algorithms that involves so much of message passing between nodes of a graph. From the beginning, we were very conscious about writing the serial algorithm code such that it is very amenable for converting into a parallel
implementation. So we took inspiration from the GraphRat Assignment. After reading the graph (a 2D set of pixel values in our case), we create a ‘neighbors’ array and ‘neighbor_sizes’ array similar to the one we used in the assignment. These arrays help us determine who are the neighbors of any node in the entire graph. We also create a ‘write_array’ which is an array of messages and whose size matches the neighbors array. If node A has node B and node C as neighbors and node A happens to be the first node in the graph [Fig1], then the 0th, 1st and 2nd indexes of our ‘neighbors’ array would be A, B, C [Fig3]. Also the 1st index of the ‘write_array’ would be the slot in which A would fill in the message it wants to send to B and the 2nd index would be the slot in which A would fill in the message it wants to send to C.
This approach is very different than the traditional interpretation of message passing algorithms, which tend to rely on graph structures built using pointers between adjacent nodes. Such a method did not guarantee us good spatial locality and we decided to adapt the traditional algorithm to structures and operations that are more amenable to parallelism, such as setting up the message tables to respect message sending patterns (only need to read and write to neighbors) and combining the read step into the write step.
To update their beliefs (and to later calculate the messages for their own neighbors), B and C would need to read their incoming messages first. We create a look-up table such that each node knows exactly which indices in the ‘write_array’ to read (For example B should read the message that A generated for it from index 1 of the ‘write_array’).
Figure 3 and Figure 4 describe the difference between our synchronous implementation and the asynchronous ones. Note the need for locking makes the asynchronous algorithms much harder to parallelize effectively.
We wrote our serial and parallel BP implementations in C using the constructs provided by OpenMP for parallelization. We used a personal desktop computer with a 20-core Xeon CPU for all of our experiments. This was our choice for the experiments as we didn’t want to use latedays or the ghc machines due to heavy load on these systems and the unpredictability in the way different users utilize these machines.
We divided the ‘neighbors’ array such that each thread gets equal contiguous portions of the ‘neighbors’ and ‘write_array’ to work on. This was a reasonable strategy because all the nodes have almost equal amount of work (as each node in the Ising model have almost the same number of neighbors (min 1, max 5)).
We had a whole plethora of correctness and performance bugs that we came across in our experiments. They have been described in much detailed in section 3.4 (Analysis of Limitations).
3.1 Results
We successfully implemented a few parallel belief propagation algorithms and demonstrated notable performance gains over sequential baselines. We found that for practical applications like image denoising on large images (with $2574 \times 2574$ pixels and more than 12 million nodes), the 9x speedup that we measured
with the parallel Wildfire algorithm means the difference between someone waiting 13 minutes (a typical time for the sequential baseline) and a minute and a half.
### 3.2 Experimental Setup
We wrote a number of different scripts in Python that helped us set up our experiments. One would let us generate binary image data add noise to it as well as tell us the distance between a denoised image and the ground truth by counting the number of incorrect pixels. In order to run the denoising on standard PNG image files, we wrote a Python script to pipe a binary PNG image over STDOUT in a format. Our BP implementation in C++ would read in this line by line and initialize our data structures correctly. Once the inference was completed, the image estimate was then written back to disk by
piping the binary representations through STDOUT to a Python script that did the writing.
Ultimately, we focused our experiments on 3 different graphs. The first graph was an 8 node toy Ising model that we hand crafted for debugging and testing purposes. The second graph was a $256 \times 256$ binary image of rice grains ($256 \cdot 256 \cdot 2 = 131,072$ nodes) that proved to be a good benchmark task. To push the algorithms further and explore how different workloads affected the performance of the BP algorithms, we generated a noisy $2574 \times 2574$ pixel binary portrait of Andrew Carnegie using independent Bernoulli noise and benchmarked on that denoising task. From this point on, we will refer to the rice image denoising problem as ‘Rice’ and the Andrew Carnegie portrait denoising as ‘Carnegie’.
3.2.1 Performance Metrics
In our problem we specifically optimize each parallel BP algorithm for speedup over both a synchronous sequential baseline and a sequential baseline for the respective algorithm (eg. speedup of Wildfire parallel over Wildfire sequential). A very important consideration that needs to be taken into account is the rate of convergence of improves for both of the asynchronous BP algorithms. That is, although Round Robin and Wildfire both have more computational overhead and contention issues with maintaining locks over messages and beliefs, they reduce the amount of computation overall. For Wildfire, we were able to optimize out some of this overhead and ease some of the contention issues to the point where that improved convergence boost made the algorithm faster than the synchronous parallel implementation. For Round Robin, the overhead and contention issues encountered offset its benefit of decreased iterations for convergence.
3.3 Experiments
We compare the speedups of the the three parallel loopy BP algorithms with respect to a sequential baseline on both the Rice and Carnegie problems.
3.3.1 Sensitivity to Problem Size
We initially hypothesized that these parallel BP algorithms, specifically the asynchronous variety, would achieve better speedups on larger problems. We considered this because of the nature of the locking of messages and beliefs required in the asynchronous case. As the number of nodes increase in the problem and the number of simultaneous workers remains fixed, the likelihood that two workers may be writing to/reading from the same neighbor’s message significantly decreases. We confirmed this empirically as our parallel BP achieved greater speedups on the larger Carnegie problem. This improved scaling with problem size works out in the Ising model because edges are only between spatial neighbors (trivial spatial locality), though this is not guaranteed for arbitrary loopy graphical models.
3.4 Analysis of Limitations
Using our target 20-core CPU, we were only able to achieve a speedup of 7x on the larger Carnegie problem, which is less than half of an ideal linear speedup. The issues we face in gaining a speedup differed depending on the algorithm. The parallel synchronous algorithm did not have many dependencies, but we noted issues with the locality of message writes. The overhead of locking messages and beliefs on writes for the asynchronous parallel BP algorithms, as well as the contention over atomically fetching and incrementing the shared work assignment counter $i$, significantly limiting performance. These issues arose from a dependency that the asynchronous algorithms needed to have an execu-
Figure 7: Speedups of parallel loopy BP algorithms over their own respective sequential baselines on the Rice problem.
1. Most data structures are ordered by the vertices of the graph and their spatial relation. In the image denoising graphs, this that the latent variable vertexes were arranged in row major order and all of the observable variables were placed at the end of the array. In retrospect this memory ordering did not align with the access pattern of message passing belief propagation, in which new message updates (writes) receive messages (reads) from adjacent edges. For example, a node attempting to read a message from its adjacent observable variable and be required to read and write to a different cache line.
2. We realized that OpenMP would give good results only when used correctly. It is very easy to make mistakes such as declaring variables, which are private to each loop, outside the omp pragma causing unnecessary sharing of this variable between different iterations of for loop. We started seeing speedup only when we fixed all these bugs that were not so obvious to us in the very beginning.
3. The dynamic scheduling of threads in OpenMP works by picking up 1 iteration of the loop at a time by a thread whereas the static scheduling works.
by assigning a continuous range of iterations to each loop. In our experiments the dynamic schedule performed far worse than the static schedule. This maybe because the use of the internal work queue to give an iteration to the each thread was more overhead than the work accomplished in 1 iteration.
4. We realized that OpenMP abstraction was difficult to work in a 'while' loop setting. For every node, we want to test for convergence before doing a fresh round of the entire message generation and transmission of messages from this node to its neighbors. We had to re-think our 'round robins' and 'wildfire' (both asynchronous) algorithms in terms of 'for loops' to fit into the OpenMP paradigm. This was one of the major implementation challenges to get right.
5. Using locks in the asynchronous versions of our loopy belief algorithms was as The algorithms are very tricky to get right. There are various nuances such that different convergence criteria (global convergence, local convergence based on beliefs) for different algorithms that can make the algorithm really hard to implement. Furthermore there are hyperparameters like the threshold at which we declare correctness (or convergence). Also we figured out that if nodes update their beliefs based on all the incoming messages directly, then the denoising would be very patchy. Rather the nodes should take a weighted average of the newly computed belief and their old beliefs before updating the new belief (essentially a smoothing parameter). This parameter essentially controls the runtime and the number of iterations it takes for all the three algorithms to converge. If not tuned correctly, the algorithm starts to diverge instead
of converging.
4 References
1. Parallel Splash Belief Propagation by Gonzalez et. al.
2. Scaling up Machine Learning by Bekkerman et al (Chapter 10)
5 Code
Our project code can be found in the following repository. [https://github.com/rbrigden/418-fp](https://github.com/rbrigden/418-fp)
6 Division of Work
Equal work was performed by both project members.
|
{"Source-Url": "http://www.andrew.cmu.edu/user/rbrigden/418FinalReport.pdf", "len_cl100k_base": 4792, "olmocr-version": "0.1.53", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 25124, "total-output-tokens": 5500, "length": "2e12", "weborganizer": {"__label__adult": 0.0004417896270751953, "__label__art_design": 0.0005674362182617188, "__label__crime_law": 0.0006422996520996094, "__label__education_jobs": 0.0015249252319335938, "__label__entertainment": 0.0001245737075805664, "__label__fashion_beauty": 0.0002562999725341797, "__label__finance_business": 0.0003247261047363281, "__label__food_dining": 0.0005826950073242188, "__label__games": 0.0006837844848632812, "__label__hardware": 0.0022487640380859375, "__label__health": 0.0013761520385742188, "__label__history": 0.0004723072052001953, "__label__home_hobbies": 0.0001819133758544922, "__label__industrial": 0.0009784698486328125, "__label__literature": 0.0003139972686767578, "__label__politics": 0.0004992485046386719, "__label__religion": 0.0007710456848144531, "__label__science_tech": 0.3408203125, "__label__social_life": 0.00017881393432617188, "__label__software": 0.0088043212890625, "__label__software_dev": 0.63671875, "__label__sports_fitness": 0.00051116943359375, "__label__transportation": 0.0008568763732910156, "__label__travel": 0.0002868175506591797}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22612, 0.03382]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22612, 0.53058]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22612, 0.92401]], "google_gemma-3-12b-it_contains_pii": [[0, 1802, false], [1802, 3729, null], [3729, 5807, null], [5807, 8415, null], [8415, 11354, null], [11354, 14512, null], [14512, 15303, null], [15303, 17251, null], [17251, 18818, null], [18818, 20098, null], [20098, 21803, null], [21803, 22612, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1802, true], [1802, 3729, null], [3729, 5807, null], [5807, 8415, null], [8415, 11354, null], [11354, 14512, null], [14512, 15303, null], [15303, 17251, null], [17251, 18818, null], [18818, 20098, null], [20098, 21803, null], [21803, 22612, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 22612, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22612, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22612, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22612, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 22612, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22612, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22612, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22612, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22612, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22612, null]], "pdf_page_numbers": [[0, 1802, 1], [1802, 3729, 2], [3729, 5807, 3], [5807, 8415, 4], [8415, 11354, 5], [11354, 14512, 6], [14512, 15303, 7], [15303, 17251, 8], [17251, 18818, 9], [18818, 20098, 10], [20098, 21803, 11], [21803, 22612, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22612, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-08
|
2024-12-08
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.