Synthesis of complex dynamic character motion from simple animations Top: Simple input animation depicting hopscotch (a popular child game consisting of hops, broad jumps and a spin jump). Bottom: Synthesized realistic hopscotch animation.In this paper we present a general method for rapid prototyping of realistic character motion. We solve for the natural motion from a simple animation provided by the animator. Our framework can be used to produce relatively complex realistic motion with little user effort.We describe a novel constraint detection method that automatically determines different constraints on the character by analyzing the input motion. We show that realistic motion can be achieved by enforcing a small set of linear and angular momentum constraints. This simplified approach helps us avoid the complexities of computing muscle forces. Simpler dynamic constraints also allow us to generate animations of models with greater complexity, performing more intricate motions. Finally, we show that by learning a small set of key parameters that describe a character pose we can help a non-skilled animator rapidly create realistic character motion. Our system transforms simple animations into realistic character motion by applying laws of physics and the biomechanics domain knowledge. The input to our system consists of an articulated character with its mass distribution, and an arbitrary character animation containing values of joint angles on the character at each frame. Animators are free to provide input animations with an arbitrary level of detail. In all of our examples we started with rough low-quality animations. Figure 1 shows a synthesized realistic hopscotch motion and its original simple animation.. We frame the motion synthesis problem as a spacetime optimization. The unknowns to this problem include the values of joint angles at each frame, along with parameters that determine the behavior of angular and linear momentum. The entire synthesis process breaks down to four key stages (see figure 2):. Constraint and stage detection. Automatically detect environment constraints that correspond to user-intended motions, and separate the original motion sequence into constrained and unconstrained stages.. Transition pose generation. Establish transition poses between constrained and unconstrained animation stages.. Momentum control. Generate physical constraints according to the Newtonian laws and the biomechanics knowledge. Objective function generation. Construct the objective function that favors motion that is smooth, similar to the input motion, and balanced when stationary.. Each stage improves specific aspects of the input motion sequences by introducing constraints or objective function components to the spacetime optimization problem. We then use a sequential quadratic programming method to find the optimal animation. In the subsequent sections we describe each of these steps in detail. In this paper we present a general method for rapid prototyping of dynamic character motion that could be used by both experts and non-skilled animators. Animators can use our system to produce relatively complex realistic motion with little effort on behalf of the animator. Creating the initial simple animation often takes less than two minutes, while modification of the transition poses can be avoided completely by accepting suggestions presented by the learned-pose estimator. In addition, a skilled animator can fine-tune transition poses as well as add any number of additional keyframes to achieve desired details.. We show that realism can be approximated by a small number of constraints on the behavior of linear and angular momentum. This approach helps us avoid the complexities of Newtonian constraints. Since we don't solve for muscle forces, we also avoid computing the right distribution of muscle usage needed to produce naturallooking motion. Simpler dynamic constraints allow us to generate more complex animations in terms of the character model and motion description complexity. Simpler constraints also allow greater variability of the resulting motion. This feature enables the animator to add more expressive detail to the motion by providing additional keyframes.. We also show that by learning a small set of key parameters that describe a pose, we can create realistic transition poses. We show that the sample space can be populated either by realistic motion (e.g. motion capture data), or by storing each of the previously created poses. In both cases, a very small data set creates useful pose suggestions.. Our methods are best suited for synthesis of highly dynamic motion, since such motions are mainly governed by Newtonian physics. One clear future research direction would be to extend these methods so that they apply to low-energy character motion such as walking, reaching, or picking up an object.. Many aspects of our approach could be potentially applied to other animation problems, most notably realistic editing of motion capture data. The animator could start from a motion capture sequence instead of a simple animation. The automatic constraint detection methods could be useful in processing motion capture data, since they can accurately find the foot-ground contact points. Transforming a motion capture sequence by adding additional keyframes would create a new realistic animation keeping as much of the captured detail as possible.. It is worth noting that our synthesis approach does not fundamentally need to start with an input animation. A skilled animator could, alternatively, specify the environment constraints and keyframes explicitly. This is probably the most likely approach for using our algorithms in the production environment. To make our methods more accessible to a wider audience, we need to develop a more effective user interface. In the future, we hope to make our tools accessible to animators of varying skill levels. We used our framework to generate a wide range of animations on a male, female and child figure, all of which comprise 51 DOFs, including 16 Euler rotations, 3 translations, and 32 quaternion rotations. We also created a three-legged creature with 58 DOFs. Inequality constraints enforce bounds on each DOF. We obtained the body dimensions and mass distributions from the biomechanics literature [de Leva 1996; Pearsall et al. 1994] . To start the animation process, the animator creates a simple animation as an input to the synthesis process. In some cases the animator also selects the parts of the body to be used for constraint detection (e.g. feet and hands). Once motion phases have been determined, the animator can also change the relative timing between each phase. In some cases, the animator adjusted the learned transition poses to achieve a desired effect. For the karate-kick animation, the animator also created an additional pose.. We solve our optimizations using SNOPT [Gill et al. 1996 ], a general nonlinearly-constrained optimization package. The optimization times depend on the duration of the motion sequence. All of the simple animations took only a few minutes to sketch. For all examples, the synthesis process took less than five minutes.. Broad jump. We synthesized a broad jump motion that clearly improves a crude input animation where only global translations of the character (3 out of 51 DOFs) are keyframed. The original animation is created by interpolating only 3 keyframes at takeoff, peak, and landing. The appropriate movement on the arms and legs results from enforcing the momentum constraints and learning the realistic transition poses.. Twist jumps. The input motion for this sequence consists of two jumps, each with a 90 • turn. The output animation shows the preparation before each take-off. The character twists away from the turn to increase the potential energy so that it can generate enough angular momentum at take-off to accomplish the 90 • turn.. Hopscotch. Much like for the broad jump example, the animator created an animation of a popular child game, consisting of hops, broad jumps and a spin jump. Each hop only requires 3 keyframes, each of which has fewer than 7 DOFs specified. This example shows that our system can deal with asymmetric motions by coordinating different parts of body to accommodate the momentum constraints. This example also demonstrates smooth transitions among different types of jump styles (figure 1).. Running. The input for the running motion sequence required keyframing of 7 DOFs. Originally, the upper body is completely stiff since no upper body DOFs were keyframed. The angular momentum constraint creates a counter-body movement by the shoulders and arms to counteract the angular momentum generated by the legs. In the synthesized animation the arms clearly twist to counter the leg movement.. Handspring. We generated a rough sketch of an advanced handspring motion on an uneven terrain (figure 7). This hazardous movement of landing and jumping with arms would be difficult to capture in the real world. The constraint detector successfully finds constraints on both the feet and hands. Since there were no handstands within the learning example database, the animator had to substantially modify the suggested handstand transitions poses. This example demonstrates that momentum constraints are general enough to capture the dynamics of movement regardless the orientation of the model. High-bar. Figure 8 shows a character performing a high-bar gymnastic exercise. The two positional constraints on the hands during bar-contact time create a "hanging" constrained stage. The constraints of linear momentum and angular momentum apply equally to the bar-contact and the more common ground constrained stage.. Skating. This example demonstrates sliding constraint detection. The motion is similar to the 180 • spin jump, except that the character slides a single leg along a straight line through the take-off phase and landing phase. The resulting motion resembles an ice-skating figure (figure 9 ).. Karate kick. The karate kick animation was created by an incremental synthesis process. First the animator created a simple side-jump animation. The first synthesis pass created a realistic side jump. The animator then introduced an additional keyframe at the peak of the jump indicating a leg kick. The second synthesis pass created the final karate-kick animation by enforcing the original constraints augmented by the additional mid-flight constraint.. Other humanoid characters. Our framework can also animate characters with different skeletal structures and mass distributions. We created a child character whose limbs are shorter and whose torso is relatively larger. Our algorithm successfully scaled down the poses learned from motion database to accommodate a different skeletal structure. In another example, we removed the left knee DOF of the character and generated a motion sequence of the twist jumps. The character had to drastically twist the pelvis while landing to place the stiff leg on the ground properly.. Non-humanoid characters. Our method also generalizes to non-humanoid characters. We created a strange three-legged creature and synthesized a number of animations experimenting with various locomotion gaits. In figure 10 we show the creature jumping to the side and doing a 180 • turn jump. Synthesis of natural motion has its roots in a variety of research areas ranging from robotics and spacetime optimization to biomechanics and kinesiology.. Robot controller simulation has been successfully applied to the domain of realistic computer animation [Raibert and Hodgins 1991; van de Panne and Fiume 1993; Hodgins 1998 ]. Controllers drive actuator forces based on the current state of the environment. Actuator forces, through simulation, produce realistic motion. Once the controllers have been fine-tuned and synchronized to each other, a wide range of realistic animations can be produced, ranging from human running, diving [Hodgins et al. 1995] , leaping and vaulting [Wooten 1998 ], to motion of non-human characters Laszlo et al. 2000; Torkos and van de Panne 1998 ]. Although there have been some recent promising advances towards automatic controller synthesis [Hodgins and Pollard August 1997; Faloutsos et al. 2001] , creating controllers for a given task remains a difficult process. In addition, simulated robot controllers do not expose sufficient control to allow for expressive animations.. A number of researchers take the approach of modeling physical behavior on simpler machines, instead of full complex characters [Torkos and van de Panne 1998; Popović and Witkin 1999; van de Panne 1997; Pollard 1999 ; Discreet n. d.; Bruderlin and Calvert 1989] . In these methods, the physically modeled motion of simple machines is mapped onto the full character. Our simplified physics constraints are in part inspired by the idea that simpler physical models can approximate the behavior of more complex models. In contrast to the approach described by Popović [1999] , we do not simplify the character, nor do we compute full dynamics of the simplified character. Instead, we compute significantly simpler momentum constraints directly on the complex character. Simpler and more general dynamics constraints allow us to synthesize realistic motion starting from highly unrealistic motion.. The spacetime constraints framework, in contrast to simulation, casts the motion synthesis into a variational optimization problem [Witkin and Kass 1988; Cohen 1992; Liu et al. 1994; Rose et al. 1996] . The animator specifies an objective function that is a metric of performance or style (e.g. total power consumption of all of the character's muscles). The algorithm minimizes the objective function while satisfying the pose and Newtonian physics constraints across all animation frames. Optimal energy movement and intuitive control give this method great appeal. Unfortunately, for complex characters the Newtonian physics constraints are highly nonlinear, preventing the spacetime optimization from converging to a solution. Spacetime constraints are also highly sensitive to the starting position of the optimization -if the initial state is far away from the solution, the optimization often does not converge. To date, these drawbacks prevent spacetime constraints from being used in generating complex character motion. Our framework uses spacetime constraint optimization, but we circumvent its drawbacks by choosing a simpler set of dynamics constraints.. Realistic motion can also be obtained directly from the real world. Recently, a number of methods for editing motion capture data have been proposed [Witkin and Popović 1995; Bruderlin and Williams 1995; Gleicher 1998; Gleicher 1997; Gleicher and Litwinowicz 1998; Rose et al. 1998; Gleicher 2001; Lee and Shin 1999; , including a few that try to preserve physical properties of the motion [Popović and Witkin 1999; Pollard and Reitsma 2001; Pollard and Behmaram-Mosavat 2000; Zordan and Hodgins 1999] . In general, these methods produce motion that does not deviate significantly from the input motion. Motion editing tools rely on the existence of captured motion that is similar to what the animator intends to create. Also, it is inherently difficult to introduce new expressive content into the animations, since most editing tools are designed to preserve the original motion features.. Research in biomechanics and kinesiology provides a great source of information on the kinematic and dynamic behaviors of animals [Blickhan 1999; Hull 1991; Yeadon 1990; Alexander 1990; Alexander 1989; Pandy et al. 1990] . Their analysis of ground and flight stages helped us in designing realistic motion constraints. Blickhan and Full [1993] demonstrate the similarity in the multilegged locomotion of kinematically different animals. They show striking similarities between a human run, a horse run and the monopod bounce (i.e. pogo-stick). This similarity motivates our approach of finding the least common denominator for a varied set of dynamic motions.. Our motion sketching approach to synthesizing motion was inspired by the effectiveness of Igarashi's sketching interface for 3d free-form design [1999] , and the work on sketching realistic rigidbody motion [Popović et al. 2000] .

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


CPO Semantics of Timed Interactive Actor Networks We give a denotational framework for composing interactive components into closed or open systems and show how to adapt classical domain-theoretic approaches to open systems and to timed systems. For timed systems, instead of the usual metric-space-based approaches, we show that existence and uniqueness of behaviors are ensured by continuity with respect to a simply defined prefix order. Existence and uniqueness of behaviors, however, does not imply that a composition of components yields a useful behavior. The unique behavior could be empty or smaller than expected. We define liveness and show that appropriately defined causality conditions ensure liveness and freedom from Zeno conditions. In our formulation, causality does not require a metric and can embrace a wide variety of models of time. Wegner [45] argues that interaction is more expressive than algorithms. Indeed there is a family of approaches to computing being studied by diverse communities that are distinctly interactive rather than algorithmic. These go under the names of coordination languages, agents, actors, and process networks. They all refactor software into components that co-exist and engage in dialog with one another. Key to the expressiveness of such component interactions is "entanglement" [46] , where outputs from a component depend on previous outputs, in dialog with the environment. This is distinct from classical models of computing based on the Turing-Church thesis, which do not model such interaction.. In today's prevailing software engineering technologies, components are object oriented. In practice, the components of object-oriented design interact principally through transfer of control (method calls). The components are passive, and things get done to them, much like physical "objects" from which the name arises.. 1 Methods implement classical algorithmic transformations of system state, and compositions of objects simply provide convenient architectural partitioning of such algorithmic transformations. Object-oriented techniques offer little or no help in designing interactive systems.. In this paper, we will use the term "actors" for interactive components.. 2 In contrast to objects, actors are concurrent, in charge of their own actions. Their environment (which can include other actors) provides them with data, and they react and provide the environment with additional data. Actors engage in dialog with their environment, whereas objects are passive slaves to it. An immediate consequence is that actor-oriented designs tend to be highly concurrent.. The term "actors" has, of course, been used for models of this type. In the classical actor model of Hewitt and Agha [3, 25] , components have their own thread of control and interact via message passing. The term "actors" was also used by the dataflow community [21] to refer to chunks of computation that would react to the availability of input data by "firing" and producing output data.. We are using the term "actors" more broadly, inspired by the analogy with the physical world, where actors control their own actions. In fact, the most widespread use of interactive models fitting our notion of actors is not rooted in any of these classical communities, but is rather focused on embedded software (where interaction is intrinsic). For example, the synchronous/reactive languages [9] are "actor-oriented" in our sense. Components react at ticks of a global clock, rather than reacting when other components invoke their methods. In the synchronous language Esterel [11] , components exchange data through variables whose values are determined by solving fixed point equations. The Lustre [24] and Signal [10] languages focus more on the flow of data, but are semantically similar. Asynchronous dataflow models based on Kahn process networks [26] are also actor-oriented in our sense, and are used for media intensive embedded signal processing software [20] . Discrete-event (DE) systems are also actor oriented, and are commonly used in hardware design (VHDL and Verilog are DE languages) and in modeling and design of networked systems [14, 6] . In DE, components interact via timed events, which carry data and a time stamp, and reactions are chronologically ordered by time stamp.. Wegner argues that interactive models are less amenable to formalism than algorithmic ones [45] . This is debatable, however. While the formalisms may be more complex (this should be expected), they are no less rigorous. Surrounding the actororiented approach are a number of semantic formalisms that complement traditional Turing-Church theories of computation by emphasizing interaction of concurrent components rather than sequential transformation of data. These include stream formalisms [26, 13, 41] and discrete-event formalisms [48, 28] . A few such formalisms are rich enough to embrace a significant variety of actor-oriented models of computation, including interaction categories [1] , behavioral types [31, 5] , interaction semantics [43] , and the tagged-signal model [30] .. As in object-oriented design, composition and abstraction are two central concepts in actor-oriented design. Actors can be composed to form new actors, which we call composite actors. We call actors that are not composite actors atomic actors; they may be predefined as language primitives (as is typical, for example, in the synchronous languages), or they may be user-defined, as is typical in coordination languages [4, 38, 16] . In a compositional formalism, a composite actor is itself an actor. This paper builds on domain theory [2] , developed for the denotational semantics of programming languages [47, 42] . But unlike many semantics efforts that focus on system state and transformation of that state, we focus on concurrent interactions, and do not even assume that there is a well-defined notion of "system state.". Our objective is to provide domain-theoretic semantics to timed concurrent systems, which traditionally rely instead on metric space approaches [48, 28, 7, 8, 19] . Our approach does not require a metric and embraces a wide variety of models of time (for another treatment that does not rely on metric spaces, see [12] ). Wegner argues that temporal properties cannot be modeled with the rigor of mathematical functions [45] . We show here that they can be. In particular, we develop a timed version of the fixed-point semantics for process networks as introduced by Kahn [26] . Our version uses the tagged-signal model [30] . We focus on timed systems because in embedded systems, software engages in dialog with the physical world, and time is an essential part of the semantics of the physical world.. In the next section, we review the tagged signal model and define signals, which encompass the communication histories between actors. In section 3, we define compositions of interacting actors and open systems. We show that familiar fixedpoint semantics, which are traditionally applied to closed systems, can be extended to open systems. In section 4, we specialize to timed systems, and show that the same fixed point semantics give conditions for existence and uniqueness of behaviors. In contrast to other authors [12, 37, 48] , we do not require causality for existence and uniqueness of behaviors. Causality, however, is useful for liveness, the timed analog of freedom from deadlock. We define strict causality without the use of a metric, and like Naundorf [37] , show that strict causality in a feedback loop is sufficient for liveness. This contrasts with other authors [12, 48] , who require a stronger form of causality called delta causality or time guardedness. Moreover, we extend Naundorf by including open systems, by giving conditions for freedom from Zeno behaviors, and by showing that the fixed point is constructive. We close with a discussion of Zeno conditions in timed systems. We have given a domain-theoretic denotational framework for timed interactive systems. We have shown that classical CPO-based techniques determine existence and uniqueness of (least fixed point) solutions, while causality determines liveness. In particular, strict causality, the definition of which does not require a metric space, ensures live feedback loops, which in turn ensures freedom from Zeno conditions. Our approach contrasts with metric space approaches, where contractions and the Banach fixed point theorem ensure existence and uniqueness of fixed points together with liveness. Separating liveness concerns from existence/uniqueness concerns allows us to admit non-causal components. Moreover, our approach does not require a metric space and consequently embraces easily a wide variety of models of time, including super-dense time.

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


On Applying Or-Parallelism and Tabling to Logic Programs Logic Programming languages, such as Prolog, provide a high-level, declarative approach to programming. Logic Programming offers great potential for implicit parallelism, thus allowing parallel systems to often reduce a program's execution time without programmer intervention. We believe that for complex applications that take several hours, if not days, to return an answer, even limited speedups from parallel execution can directly translate to very significant productivity gains.It has been argued that Prolog's evaluation strategy -SLD resolution -often limits the potential of the logic programming paradigm. The past years have therefore seen widening efforts at increasing Prolog's declarativeness and expressiveness. Tabling has proved to be a viable technique to efficiently overcome SLD's susceptibility to infinite loops and redundant subcomputations.Our research demonstrates that implicit or-parallelism is a natural fit for logic programs with tabling. To substantiate this belief, we have designed and implemented an or-parallel tabling engine -OPTYap -and we used a shared-memory parallel machine to evaluate its performance. To the best of our knowledge, OPTYap is the first implementation of a parallel tabling engine for logic programming systems. OPTYap builds on Yap's efficient sequential Prolog engine. Its execution model is based on the SLG-WAM for tabling, and on the environment copying for or-parallelism.Preliminary results indicate that the mechanisms proposed to parallelize search in the context of SLD resolution can indeed be effectively and naturally generalized to parallelize tabled computations, and that the resulting systems can achieve good performance on shared-memory parallel machines. More importantly, it emphasizes our belief that through applying or-parallelism and tabling to logic programs the range of applications for Logic Programming can be increased. Logic programming provides a high-level, declarative approach to programming. Arguably, Prolog is the most popular and powerful logic programming language. Pro-log's popularity was sparked by the success of the sequential execution model presented in 1983 by David H. D. Warren, the Warren Abstract Machine (WAM ) [56] . Throughout its history, Prolog has demonstrated the potential of logic programming in application areas such as Artificial Intelligence, Natural Language Processing, Knowledge Based Systems, Machine Learning, Database Management, or Expert Systems.. Logic programs are written in a subset of First-Order Logic, Horn clauses, that has an intuitive interpretation as positive facts and as rules. Programs use the logic to express the problem, whilst questions are answered by a resolution procedure with the aid of user annotations. The combination was summarized by Kowalski's motto [23] :. Ideally, one would want Prolog programs to be written as logical statements first, and for control to be tackled as a separate issue. In practice, the limitations of Prolog's operational semantics, SLD resolution, mean that Prolog programmers must be concerned with SLD semantics throughout program development.. Several proposals have been put forth to overcome some of these limitations and therefore improve the declarativeness and expressiveness of Prolog. One such proposal that has been gaining in popularity is tabling, also referred to as tabulation or memoing [29] . In a nutshell, tabling consists of storing intermediate answers for subgoals so that they can be reused when a repeated subgoal appears during the resolution process. It can be shown that tabling based execution models, such as SLG resolution [8] , are able to reduce the search space, avoid looping, and that they have better termination properties than SLD based models. For instance, SLG resolution is guaranteed to terminate for all logical programs with the bounded term-size property [8] .. Work on SLG resolution, as implemented in the XSB logic programming system [53] , proved the viability of tabling technology for applications such as Natural Language Processing, Knowledge Based Systems and Data Cleaning, Model Checking, and Program Analysis. SLG resolution also includes several extensions to Prolog, namely support for negation [4] , hence allowing for novel applications in the areas of Non-Monotonic Reasoning and Deductive Databases.. One of the major advantages of logic programming is that it is well suited for parallel execution. The interest in the parallel execution of logic programs mainly arose from the fact that parallelism can be exploited implicitly from logic programs. This means that parallelism can be automatically exploited, that is, without input from the programmer to express or manage parallelism, ideally making parallel logic programming as easy as logic programming.. Logic programming offers two major forms of implicit parallelism, Or-Parallelism and And-Parallelism. Or-parallelism results from the parallel execution of alternative clauses for a given predicate goal, while and-parallelism stems from the parallel evaluation of subgoals in an alternative clause. Some of the most well-known systems that successfully supported these forms of parallelism are: Aurora [26] and Muse [2] for or-parallelism; &-Prolog [20] , DASWAM [47] , and ACE [31] for and-parallelism; and Andorra-I [46] for or-parallelism together with and-parallelism. A detailed presentation of such systems and the challenges and problems in their implementation can be found in [17] . Arguably, or-parallel systems have been the most successful parallel logic programming systems so far. Experience has shown that orparallel systems can obtain very good speedups for applications that require search. Examples can be found in application areas such Parsing, Optimization, Structured Database Querying, Expert Systems and Knowledge Discovery applications.. The good results obtained with parallelism and with tabling rises the question of whether further efficiency improvements may be achievable through parallelism. Freire and colleagues were the first to research this area [13] . Although tabling works for both deterministic and non-deterministic applications, Freire focused on the search process, because tabling has frequently been used to reduce the search space. In their model, each tabled subgoal is computed independently in a separate computational thread, a generator thread. Each generator thread is the sole responsible for fully exploiting its subgoal and obtain the complete set of answers. Arguably, Freire's model will work particularly well if we have many non-deterministic generators. On the other hand, it will not exploit parallelism if there is a single generator and many non-tabled subgoals. It also does not exploit parallelism between a generator's clauses. As we discuss in Section 7, experience has shown that interesting applications do indeed have a limited number of generators.. Ideally, we would like to exploit maximum parallelism and take maximum advantage of current technology for tabling and parallel systems. To exploit maximum parallelism, we would like to exploit parallelism from both tabled and non-tabled subgoals. Further, we would like to reuse existing technology for tabling and parallelism. As such, we would like to exploit parallelism from tabled and non-tabled subgoals in much the same way. As with Freire, we would focus on or-parallelism first, and we will focus throughout on shared-memory platforms.. Towards this goal, we proposed two new computational models [37] , Or-Parallelism within Tabling (OPT ) and Tabling within Or-Parallelism (TOP ). Both models are based on the idea that all open alternatives in the search tree should be amenable to parallel exploitation, be they from tabled or non-tabled subgoals. The OPT model further assumes tabling as the base component of the parallel system, that is, each worker 1 is a full sequential tabling engine. OPT triggers or-parallelism when workers run out of alternatives to exploit: at this point, a worker will share part of its SLG derivations with the other. In contrast, the TOP model represents the whole SLG forest as a shared search tree, thus unifying parallelism with tabling. Workers are logically positioned at branches in this tree. When a branch completes or suspends, workers move to nodes with open alternatives, that is, alternatives with either open clauses or new answers stored in the table.. The main contribution of this work is the design and performance evaluation of what to the best of our knowledge is the first parallel tabling logic programming system, OPTYap [40] . We chose the OPT model for two main advantages, both stemming from the fact that OPT encapsulates or-parallelism within tabling. First, implementation of the OPT models follows naturally from two well-understood implementation issues: we need to implement a tabling engine, and then we need to support or-parallelism. Second, in the OPT model a worker can keep its nodes private until reaching a sharing point. This is a key issue in reducing parallel overheads. We remark that it is common in or-parallel works to say that work is initially private, and that is made public after sharing.. OPTYap builds on the YapOr [38] and YapTab [39] engines. YapOr was previous work on supporting or-parallelism over Yap's Prolog system [45] . YapOr is based on the environment copying model for shared-memory machines, as originally implemented in Muse [1] . YapTab is a sequential tabling engine that extends Yap's execution model to support tabled evaluation for definite programs. YapTab's implementation is largely based on the ground-breaking design of the XSB system [43; 35] , which implements the SLG-WAM [49; 44; 42] . YapTab has been designed from scratch and its development was done taking into account the major purpose of further integration to achieve an efficient parallel tabling computational model, whilst comparing favorably with current state of the art technology. In other words, we aim at respecting the no-slowdown principle [19] : our or-parallel tabling system should, when executed with a single worker, run as fast or faster than the current available sequential tabling systems. Otherwise, parallel performance results would not be significant and fair.. In order to validate our design we studied in detail the performance of OPTYap in shared-memory machines up to 32 workers. The results we gathered show that OPTYap does indeed introduce low overheads for sequential execution and that it compares favorably with current versions of XSB. Furthermore, the results show that OPTYap maintains YapOr's speedups for parallel execution of non-tabled programs, and that there are tabled applications that can achieve very high performance through parallelism. This substantiates our belief that tabling and parallelism can together contribute to increasing the range of applications for Logic Programming. We have presented the design, implementation and evaluation of OPTYap. OPTYap is the first available system that exploits or-parallelism and tabling from logic programs. A major guideline for OPTYap was concerned with making best use of the excellent technology already developed for previous systems. In this regard, OPTYap uses Yap's efficient sequential Prolog engine as its starting framework, and the SLG-WAM and environment copying approaches, respectively, as the basis for its tabling and or-parallel components.. Through this research we aimed at showing that the models developed to exploit implicit or-parallelism in standard logic programming systems can also be used to successfully exploit implicit or-parallelism in tabled logic programming systems. First results reinforced our belief that tabling and parallelism are a very good match that can contribute to expand the range of applications for Logic Programming.. OPTYap introduces low overheads for sequential execution and compares favorably with current versions of XSB. Moreover, it maintains YapOr's effective speedups in exploiting or-parallelism in non-tabled programs. Our best results for parallel execution of tabled programs were obtained on applications that have a limited number of tabled nodes, but high or-parallelism. However, we have also obtained good speedups on applications with a large number of tabled nodes.. On the other hand, there are tabled programs where OPTYap may not speed up execution. Table access has been the main factor limiting parallel speedups so far. OPTYap implements tables as tries, thus obtaining good indexing and compression. On the other hand, tries are designed to avoid redundancy. To do so, they restrict concurrency, especially when updating. We plan to study whether alternative designs for the table data structure can obtain scalable speedups even when frequently updating tables.. Our applications do not show the completion algorithm to be a major factor in performance so far. In the future, we plan to study OPTYap over a large range of applications, namely, natural language, database processing, and non-monotonic reasoning. We expect that non-monotonic reasoning applications, for instance, will raise more complex dependencies and further stress the completion algorithm. We are also interested in the implementation of pruning in the parallel environment. A first proposal on how to exploit implicit parallelism in tabling systems was . In this model, each tabled subgoal is computed independently in a single computational thread, a generator thread. Each generator thread is associated with a unique tabled subgoal and it is responsible for fully exploiting its search tree in order to obtain the complete set of answers. A generator thread dependent on other tabled subgoals will asynchronously consume answers as the correspondent generator threads will make them available. Within this model, parallelism results from having several generator threads running concurrently. Parallelism arising from non-tabled subgoals or from execution alternatives to tabled subgoals is not exploited. Moreover, we expect that scheduling and load balancing would be even harder than for traditional parallel systems.. More recent work [15] , proposes a different approach to the problem of exploiting implicit parallelism in tabled logic programs. The approach is a consequence of a new sequential tabling scheme based on dynamic reordering of alternatives with variant calls. This dynamic alternative reordering strategy not only tables the answers to tabled subgoals, but also the alternatives leading to variant calls, the looping alternatives. Looping alternative are reordered and placed at the end of the alternative list for the call. After exploiting all matching clauses, the subgoal enters a looping state, where the looping alternatives, if they exist, start being tried repeatedly until a fixpoint is reached. An important characteristic of tabling is that it avoids recomputation of tabled subgoals. An interesting point of the dynamic reordering strategy is that it avoids recomputation through performing recomputation. The process of retrying alternatives may cause redundant recomputations of the non-tabled subgoals that appear in the body of a looping alternative. It may also cause redundant consumption of answers if the body of a looping alternative contains more than one variant subgoal call. Within this model, parallelism arises if we schedule the multiple looping alternatives to different workers. Therefore, parallelism may not come so naturally as for SLD evaluations and parallel execution may lead to doing more work.. There have been other proposals for concurrent tabling but in a distributed memory context. Hu [21] was the first to formulate a method for distributed tabled evaluation termed Multi-Processor SLG (SLGMP). This method matches subgoals with processors in a similar way to Freire's approach. Each processor gets a single subgoal and it is responsible for fully exploiting its search tree and obtain the complete set of answers. One of the main contributions of SLGMP is its controlled scheme of propagation of subgoal dependencies in order to safely perform distributed completion. An implementation prototype of SLGMP was developed, but as far as we know no results have been reported.. A different approach for distributed tabling was proposed by Damásio [10] . The architecture for this proposal relies on four types of components: a goal manager that interfaces with the outside world; a table manager that selects the clients for storing tables; table storage clients that keep the consumers and answers of tables; and prover clients that perform evaluation. An interesting aspect of this proposal is the completion detection algorithm. It is based on a classical credit recovery algorithm [28] for distributed termination detection. Dependencies among subgoals are not propagated and, instead, a controller client, associated with each SCC, controls the credits for its SCC and detects completion if the credits reach the zero value. An implementation prototype has also been developed, but further analysis is required. Marques et al. [27] have proposed an initial design for an architecture for a multi-threaded tabling engine. Their first aim is to implement an engine capable of processing multiple query requests concurrently. The main idea behind this proposal seems very interesting, however the work is still in an initial stage.. Other related mechanisms for sequential tabling have also been proposed. Demoen and Sagonas proposed a copying approach to deal with tabled evaluations and implemented two different models, the CAT [11] and the CHAT [12] . The main idea of the CAT implementation is that it replaces SLG-WAM's freezing of the stacks by copying the state of suspended computations to a proper separate stack area. The CHAT implementation improves the CAT design by combining ideas from the SLG-WAM with those from the CAT. It avoids copying all the execution stacks that represent the state of a suspended computation by introducing a technique for freezing stacks without using freeze registers. Zhou et al. [57; 48] developed a linear tabling mechanism that works on a single SLD tree without requiring suspensions/resumptions of computations. The main idea is to let variant calls execute from the remaining clauses of the former first call. It works as follows: when there are answers available in the table, the call consumes the answers; otherwise, it uses the predicate clauses to produce answers. Meanwhile, if a call that is a variant of some former call occurs, it takes the remaining clauses from the former call and tries to produce new answers by using them. The variant call is then repeatedly re-executed, until all the available answers and clauses have been exhausted, that is, until a fixpoint is reached.

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


Dynamic updates for web and cloud applications The center of mass for newly-released applications is shifting from traditional, desktop or server programs, toward web and cloud computing applications. This shift is favorable to end-users, but puts additional burden on application developers and service providers. In particular, the newly emerging development methodologies, based on dynamic languages and multi-tier setups, complicate tasks such as verification and require end-to-end, rather than program-local guarantees. Moreover, service providers need to provide continuous service while accommodating the fast evolution pace characteristic of web and cloud applications. A promising approach for providing uninterrupted service while keeping applications up-to-date is to permit dynamic software updates, i.e., applying dynamic patches to running programs. In this paper we focus on safe dynamic updates for web and cloud applications; we point out difficulties associated with dynamic updates for these applications, present some of our preliminary results, and lay out directions for future work. We are currently witnessing a shift in how applications are developed and deployed. Desktop applications are transiPermission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. APLWACA '10 June 6, Toronto, Canada. Copyright c 2010 ACM 978-1-60558-913-8/10/06. . . $10.00 tioning to web applications, and server applications are transitioning to "solution stacks" and cloud computing. For example, office suites are moving from local applications to web applications such as Google Docs and Microsoft Office Web Apps. More generally, traditional client-server applications-where the client is "thin" and provides little functionality-are giving way to "thick," feature-rich clients. On the server side, developing applications has recently been facilitated by open source frameworks such as Django, Ruby on Rails, or Google App Engine. Rather than writing C/C++/Java/SQL code for each tier (front, application, database), developers can use one of these frameworks which allow easy software construction and deployment.. The Cloud Computing paradigm has gained popularity for hosting applications in recent years, as it provides businesses with pay-as-you-go computation and storage services. Data infrastructures and applications associated with cloud computing and web applications require regular maintenance and updates (to provide the newest features or incorporate the latest security fixes), while also having to provide 24/7 service. Traditional maintenance and update practices are ill-suited for these environments, because they are based on stop-restart (stopping the system, followed by restart to install updates) or rolling upgrades (where one part of the infrastructure is updated at a time, rendering it unavailable to clients). This temporary unavailability can lead to failures [21] , customer dissatisfaction, or even loss of revenue; as service providers use a pay-per-use model for cloud services, unavailability results in loss of business. For example, in 2009, Google offered to compensate users of Google Apps Premier Edition customers for periods of unavailability [25] due to two major Gmail outages [12, 28] ; these outages took place during rolling upgrades. Further anecdotal evidence from Facebook and Oracle [13] stresses the need for continuous availability. Therefore, on-the-fly updates are becoming a required feature for maintaining client satisfaction in light of more frequent patches [23] and regular maintenance.. In prior work, we have shown that dynamic updates are effective for Internet servers (such as FTP servers, SSH servers, media streaming and web caching servers [18] [19] [20] ); in more recent work, we have explored on-the-fly changes to database schemas. However, web applications and cloud computing present unprecedented challenges in software updating in general, and dynamic software updating in particular. Our paper points out how the models underlying these novel applications complicate updates: the dynamic nature of the applications makes verification tasks difficult, and their distributed architecture raises consistency issues. We discuss these challenges, point out how state-of-the-art solutions fail to completely address them, and present our preliminary results on two fronts: (1) providing end-to-end dynamic update mechanisms, and (2) identifying and eliminating update safety issues due to cross-tier and cloud-wide inconsistencies. As Web 2.0 and cloud services are gaining popularity, the computing paradigm is shifting from large monolithic applications to thick clients, solution-stack based servers, and cloud-based computation and storage services. These novel applications depend on continuous server availability, which puts pressure on service providers to keep their services running 24/7 and employ on-the-fly updates. Our paper points out that the models underlying these novel applications complicate on-the-fly updates: the dynamic nature of the applications makes verification tasks difficult, and their distributed architecture opens the way for update-induced inconsistencies. To address these issues, we present our preliminary results and intended future work on dynamic update mechanisms and dynamic update safety for web and cloud applications.

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


Efficient network QoS provisioning based on per node traffic shaping AbstractIn addition, w e establish that these bounds can also be achieved w h e n the shapers at each hop have the same "minimal" envelope. T h e m a i n disadvantage of this class of service disciplines is that the end-to-end delay guarantees are obtained as the s u m of the worst case delays at each node, but w e show that this problem can be alleviated through In this paper, we consider the problem of providing per connection end-to-end delay (and throughput) guarantees in high speed networks. Various scheduling policies have been suggested in the literature for this purpose. Among them, policies based on Fair Queueing, alternatively known as Generalized Processor Sharing (GPS) 17, 11, 121, have attracted special attention since they guarantee throughput to individual connections and provide smaller end-to-end delay bounds than other policies, for connections that cross several nodes. A key factor in obtaining these smaller delay bounds is the ability to take into account (delay) dependencies in the successive nodes that a connection has to cross, which is in general very difficult to do with other policies.. One notable attempt at addressing this general problem is that of [6] which introduced the concept of service burstiness, and used it to provide a framework to characterize service disciplines and evaluate their end-to-end delay performance. However, the generality of the framework in [6] did not result in as tight end-to-end delay bounds as those obtained by focusing on a specific policy. For example, the bounds available based on the techniques of [6] are no better than the looser bounds found in [12] .. In this paper we concentrate on Rate-Controlled Service (RCS) disciplines, which have also been proposed in the literature [14] to provide performance guarantees to individual connections. In this class of service disciplines, the traffic of each connection is reshaped at every node to ensure that the traffic offered to the scheduler arbitrating local packet transmissions conforms to specific characteristics. In particular, it is typically used to enforce, at a node inside the network, the same traffic parameter control as the one performed at the network access point, which is based on the parameters negotiated during connection establishment. Reshaping makes the traffic at each node more predictable and, therefore, simplifies the task of guaranteeing performance to individual connections; when used with a particular scheduling policy, it allows the specification of worst case delay bounds at each node [14] . End-to-end delay bounds can then be computed as the sum of the worst case delay bounds at each node along the path. The main advantages of an RCS discipline, especially when compared to GPS, are simplicity of implementation and flexibility. Also, in the single node case the RCS discipline that uses the Non Preemptive Earliest Deadline First (NPEDF) scheduling policy, is known to be optimal [8] . However, for the more interesting case of general networks with many nodes, optimality does not hold. In section 4.1 we show with simple examples that when a connection has to cross many nodes, GPS outperforms the "naive" ratecontrolled NPEDF discipline. As a result, it has been argued that despite its potentially greater complexity, a GPS-based service discipline should be the solution of choice to provide performance guarantees to individual connections (see for example [3] ).. A key result of this paper is to establish that RCS disciplines can be designed so as to outperform GPSbased ones, even in a network environment. This is achieved by proper selection of the traffic reshaping performed a t each node. Specifically, any end-to-end delay bounds that can be guaranteed by the GPS discipline, can also be achieved by an RCS discipline by using a simple algorithm to determine how to reshape at each node. The sum of the worst case delay bounds of this RCS discipline is then no larger than the delay guarantees provided by the GPS discipline. We also show that RCS dlisciplines have the additional flexibility of providing end-to-end delay bounds that cannot be guaranteed tly the GPS discipline. Furthermore, because of traffic reshaping, the network buffer requirements of RCS disciplines are in general significantly smaller than those of the GPS discipline (see [6] for related discussions). Based on these advantages and their implementation simplicity, we believe that RCS disciplines are very effective candidates for providing end-to-end performance guarantees to individual connections in integrated services networks. The paper is structured as follows. In Section 2 we introduce our traffic model, and in particular our assumptions concerning the input traffic, as well as the general structure oi our shapers. Section 3 is dedicated to the description of RCS disciplines and to the derivation of several results concerning the delay guarantees that, can be provided given the traffic and shaper models of Section 2. Section 4 is devoted to a comparison with the GPS service discipline. Section 4.1 considers first the simpler version of GPS, i.e., Rate Proportional Processor Sharing (RPPS), as it is of greater practical significance, while Section 4.2 considers the more cornplicated case of general GPS for which similar results are established. A brief conclusion summarizes the main findings of this paper as well as outlines a couple of related results that can be found in [9] . For the sake of brevity, the proofs to the Lemmas and Propositions have not been included in this paper, but they can be found in [9] .

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


Dependence language model for information retrieval This paper presents a new dependence language modeling approach to information retrieval. The approach extends the basic language modeling approach based on unigram by relaxing the independence assumption. We integrate the linkage of a query as a hidden variable, which expresses the term dependencies within the query as an acyclic, planar, undirected graph. We then assume that a query is generated from a document in two stages: the linkage is generated first, and then each term is generated in turn depending on other related terms according to the linkage. We also present a smoothing method for model parameter estimation and an approach to learning the linkage of a sentence in an unsupervised manner. The new approach is compared to the classical probabilistic retrieval model and the previously proposed language models with and without taking into account term dependencies. Results show that our model achieves substantial and significant improvements on TREC collections. The independence assumption is one of the assumptions widely adopted in probabilistic retrieval theory. It states that terms are statistically independent from each other. Although this assumption makes the development of retrieval models easier and the retrieval operation tractable, it does not hold in textual data. This issue has motivated much research on term dependencies over the last decades. Most dependence models, however, have not delivered consistent improvements in effectiveness in large scale retrieval experiments. There are two reasons for this. First, it is practically difficult to estimate dependencies on a large scale. Second, it is theoretically challenging to integrate both single words and dependencies in a weighting schema. Without a theoretically motivated integration model, documents containing dependencies (e.g. phrases) may be over-scored if they are weighted in the same way as single words [18] .. Some language modeling approaches also try to incorporate word dependency by using bigrams (e.g. [27] ). However, while some of the word dependencies exist between adjacent words, others are more distant. A bigram model can hardly cover these latter dependencies. On the other hand, many "noisy" dependencies (those that are not truly connected) will also be assumed between adjacent words in a bigram model. At the end, the bigram language model showed only marginally better effectiveness than the unigram model.. Instead of assuming a dependency between every pair of adjacent words, we believe that on the one hand, more distant dependencies should be taken into account; and on the other hand, only the strongest dependencies should be recognized in order to make the approach tractable.. This paper presents a new method of capturing word dependencies. We extend the state-of-the-art language modeling approaches to information retrieval [21, 24, 33] by introducing a dependency structure, called linkage, which is inspired by the link grammar [8, 20] . The linkage structure assumes that term dependencies in a sentence form an acyclic, planar graph, where two related terms are linked. This dependency structure limits the dependencies to the most important relationships that are useful for retrieval. This not only reduces the processing time but also limits the estimation errors in computing dependence scores due to the sparse data problem. In our implementation, an existing dependency parsing [5] and some learning techniques (i.e. expectation maximization -EM) are extended to detect the linkage of a term sequence (which is not necessary a grammatical sentence) in an unsupervised manner. At the retrieval step, the linkage detected in a query is also expected to be generable from the linkage of a relevant document. Therefore, our model incorporates the requirements not only on words as in a unigram model, but also on linkage between words. In comparison with the bigram model, we will show that our model is a generalization of this latter.. In the rest of this paper: Section 2 reviews previous research trying to relax the independence assumption. Section 3 presents our dependence model and introduces several modeling assumptions to make the model tractable for information retrieval tasks. Section 4 presents in detail the methods of model parameter estimation, including the smoothing method and an approach to unsupervised learning of the linkage. A series of experiments on TREC collections is presented in Section 5. The comparison of our approach to both the probabilistic retrieval models and the previous language models will show that our model achieves substantial and significant improvements. Conclusions and the contributions of this work are summarized in Section 6. * This work was done while Wu and Cao were visiting Microsoft Research Asia. We thank Stephen Robertson and Chengxiang Zhai for their comments on early drafts of the paper. Thanks also go to the four anonymous reviewers, one of whom alerted us to the closely related work of Nallapati and Allan [23] .. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. We have presented a new dependence language modeling approach to information retrieval. In this approach, we introduce the linkage of a query as a hidden variable, which expresses the term dependencies within a sentence and forms an acyclic, planar, undirected graph. The approach then suggests generating a query from a document in two stages: first to generate the linkage, and then to generate each term in turn depending on other related terms according to the linkage. This is a general approach that covers several state-of-the-art language model approaches as special cases. We have also discussed how the proposed dependence model resolves the two problems of the classical dependence models: term dependency estimation and weight normalization. We demonstrated that our dependence model is applicable in the information retrieval system by (1) learning the linkage efficiently in an unsupervised manner; and (2) smoothing the model with different smoothing techniques. Our experiments on six standard TREC collections indicate the effectiveness of our dependence model: It outperforms substantially over both the classical probabilistic retrieval model and the state-of-the-art unigram and bigram language models. Table 5 . Sample queries (where stop words are bracketed in Query column) together with their dependencies (links) and the impact on IR, where dependencies in Set A are syntactic meaningful in the sentence (i.e. query) and dependencies in Set B are not. BM represents the BIR model. We performed experiments using the Okapi system which is considered as a representative implementation of the BIR model. The retrieval approach models within-document frequencies by means of a mixture of two Poisson distributions [25] . It hypothesizes that occurrences of a term in a document have a stochastic element that reflects the distinction between those documents which are 'about' the concept (or 'elite') represented by the term and those which are not. For the great number of term weighting functions provided by Okapi, we choose BM2500 for it has achieved good performance in previous experiments [26] .. UG is our implementation of the unigram language model approach to information retrieval proposed in [33] . It serves as the baseline language model approach in our experiments. Over all six TREC collections, UG achieves the performance similar to, or slightly worse than, that of BM. It has been observed that in general the classical probabilistic retrieval model and the unigram language model approach perform very similarly if both have been fine-tuned. The slightly worse performance of UG in our experiment might be due to our 'over-tuned' Okapi system (i.e. BM2500 have more weighting parameters to be tuned empirically).. DM is the dependence model described in Equations (2) to (4). We create the linkage annotated corpus in an unsupervised manner as described in Section 4.1, using all six TREC collections (i.e. the ALL collection in Table 1 ). We iterate the learning process two times. By comparing DM with BM and UG, we can see that our dependence model achieves substantial improvements in average precision in all six collections. In five out of six collections, the improvement of DM over UG is statistically significant i.e. pvalue < 0.05 according to t-test. It indicates that the additional two terms in Equation (4), i.e., parsing score and term dependencies score, provide useful term dependency information for document retrieval. In our pilot study, we also compare the two versions of the dependence model of Equation (4) with and without the parsing score term. We find that the model with parsing score consistently outperforms the one without it. This may indicate the normalization capability of our dependence model described in Section 3: The parsing score serves as a normalization factor (or penalty) to balance the impact of single terms and term dependencies on information retrieval.. BG is our implementation of the bigram language modeling approach to information retrieval. The query generation probability is estimated by P(Q|D) = P(q 1 |D)∏ i=2…m P(q i |q i-1 , D). It assumes that the query term is only depending on its one preceding term. To deal with the sparse data problem, we used two smoothing methods. First, we linearly interpolated the bigram models trained on the document D and the entire collection C, respectively. Second, for both bigram models, the bigram probability was linearly interpolated with the unigram probability. As described in Section 3, the bigram model is a special case of our dependence model by assuming a pre-defined linkage. The results show that this is a good assumption in practice: BG is slightly worse than DM in five out of six TREC collections but substantially outperforms UG in all collections. We then investigate in detail the linkages detected by the parser. It turns out that around 50% of the links are between two adjacent terms which are also captured by the bigram model. We can see here that a bigram model can only capture part of the interesting dependencies.. BT1 and BT2 are our implementations of the bi-term language models originally described in [29] . They are approximations of the bigram language model by relaxing the constraint of term order. In BT1, the bi-term probability of the term pair (q i-1 , q i ), P BT1 is viewed as an average of bigram probability P BG of the ordered pairs (q i-1 , q i ) and (q i ,q i-1 ), where P BG is the smoothed bigram probability given by the BG described above.. In BT2, the bi-term probability is computed as the ratio of the frequency of the term pair to the minimum of the frequencies of terms q i-1 and q i .. To handle the data sparse problem, the bi-term probability P BT2 is smoothed by unigram probability P(q i |D), which is in turn smoothed using its collection probability P(q i |C). As shown in Tables 2 and 3 , though bi-term models outperform UG substantially, they do not outperform BG as presented in [29] . They also have a lower effectiveness than our model DM.. In summary, several conclusions can be drawn from the experiments.. • Our dependence model outperforms both the unigram language model and the classical probabilistic retrieval model substantially and significantly.. • In the language model approaches to information retrieval, models that capture term dependencies achieve substantial improvements over the unigram model. • Bigram language model turns out to be a good approximation of the proposed dependence model in practice for it is simpler and achieves only slightly worse performance.. • Although bi-term language models are expected to be good approximations of the bigram language model, they have not delivered substantial improvements in effectiveness in our experiments. There has been a large amount of work dealing with term dependencies in both the probabilistic IR framework and the language modeling framework.. In classical probabilistic IR models, such as the binary independence retrieval (BIR) model [18] , both queries and documents are represented as a set of terms that are assumed to be statistically independent. With respect to representations, two research directions can be taken in order to relax the independence assumption [9, 16] .. The first is to produce a better model that integrates dependencies while using the same representation units (i.e. words). For example, there have been many attempts to improve the BIR model by considering various forms of term dependencies [7, 10, 17, 30] . In these approaches, documents and queries are still represented as a set of words/terms. Term dependencies are usually defined as statistical co-incidence between the terms on the scale of whole documents. Thus in principle, the formulation of relevance probabilities of documents given single terms should be elaborated to cover probabilities of document being relevant given combinations of terms [18] . Most dependence models, however, have not brought significant improvements in retrieval effectiveness. One important practical issue is that there would be too many term dependencies to be estimated. For example, a blind definition of term dependencies would be every possible combination of terms. As a consequence, the gain from improved independence assumption may not outweigh the loss from increased estimation errors. In our approach, we only retain the most probable term dependencies that are useful for information retrieval. These term dependencies are derived from the linkage on the scale of a sentence (or a query).. The second direction is to develop models for more detailed representations of queries and documents. In addition to terms which are single words or stems, compound terms, or phrases have also been used as representation units [1, 28] . Phrases are defined by collocations (adjacency, proximity) and selected on statistical ground (possibly with syntactic knowledge, such as POS tags of component terms). A phrase may then be treated as an indecomposable unit or a decomposable unit (i.e., both the phrase and its component single words are regarded as representation features). Unfortunately, the experiments do not provide a clear indication whether the retrieval effectiveness can be improved in this way. One possible reason is that, since phrases are different in nature from words, it may not be appropriate to apply the same weighting schemes for both of them. Otherwise, phrases are likely to be systematically over-scored in the independent model [18] . This problem is also referred to as the weight normalization problem.. Some tend to explain the unsuccessful trials of dependence models by the fact that dependency information might have already been (implicitly) captured in the classical probabilistic models [6] . It can also have been incorporated via the use of other techniques such as passage retrieval or query expansion as in Local Context Analysis [31] . So the need for introducing empirical dependency information is less important than had been generally thought. For example, Cooper [6] points out that in the case of the BIR model, the usual independence assumptions can be replaced by a weaker linked dependence assumption. This partially explains why the BIR model is so effective that most dependence models extended on top of it cannot bring much improvement.. Language modeling approaches to IR usually do not model relevance explicitly. Instead, documents are ranked according to their capability of generating the given query, i.e. P(Q|D). The first language model proposed in [24] uses unigrams and does not consider any dependency between words. Since then, there have been several attempts to capture term dependencies [13, 22, 27, 29] . In most of the cases, unigrams are simply replaced by bigrams or biterms. In the latter approaches, two adjacent (ordered or no) words are assumed to be related. Therefore, these models have the capacity of representing some of the word dependencies. However, genuine dependencies do not only exist between adjacent words. They may also occur between more distant words such as between "distributed" and "network" in "distributed personal computer network". Such distant dependencies cannot be correctly covered by a bigram or bi-term model. On the other hand, as we assume that every pair of adjacent words can be connected, a huge number of parameters have to be estimated. Because of data-sparseness, more errors will be generated. These errors may compromise the benefit that one may obtain from the term dependencies correctly detected.. This paper presents a more general dependence language model in which word dependencies are not restricted to adjacent words. However, given a sentence, we only consider the strongest word dependencies in order to reduce estimation errors. As we will show, our model is a generalization of the bigram model previously proposed.

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