scieee AI-readable full text Open interactive document viewer

Repositorio Institucional de Documentos

Abstract

Las Redes de Petri (RdP) son un formalismo ampliamente aceptado para el modelado y análisis de Sistemas de Eventos Discretos (SED). Por ejemplo sistemas de manufactura, de logística, de tráfico, redes informáticas, servicios web, redes de comunicación, procesos bioquímicos, etc. Como otros formalismos, las redes de Petri sufren del problema de la ¿explosión de estados¿, en el cual el número de estados crece explosivamente respecto de la carga del sistema, haciendo intratables algunas técnicas de análisis basadas en la enumeración de estados. La fluidificación de las redes de Petri trata de superar este problema, pasando de las RdP discretas (en las que los disparos de las transiciones y los marcados de los lugares son cantidades enteras no negativas) a las RdP continuas (en las que los disparos de las transiciones, y por lo tanto los marcados se definen en los reales). Las RdP continuas disponen de técnicas de análisis más eficientes que las discretas. Sin embargo, como toda relajación, la fluidificación supone el detrimento de la fidelidad, dando lugar a la pérdida de propiedades cualitativas o cuantitativas de la red de Petri original. El objetivo principal de esta tesis es mejorar el proceso de fluidificación de las RdP, obteniendo un formalismo continuo (o al menos parcialmente) que evite el problema de la explosión de estados, mientras aproxime adecuadamente la RdP discreta. Además, esta tesis considera no solo el proceso de fluidificación sino también el formalismo de las RdP continuas en sí mismo, estudiando la complejidad computacional de comprobar algunas propiedades. En primer lugar, se establecen las diferencias que aparecen entre las RdP discretas y continuas, y se proponen algunas transformaciones sobre la red discreta que mejorarán la red continua resultante. En segundo lugar, se examina el proceso de fluidificación de las RdP autónomas (i.e., sin ninguna interpretación temporal), y se establecen ciertas condiciones bajo las cuales la RdP continua preserva determinadas propiedades cualitativas de la RdP discreta: limitación, ausencia de bloqueos, vivacidad, etc. En tercer lugar, se contribuye al estudio de la decidibilidad y la complejidad computacional de algunas propiedades comunes de la RdP continua autónoma. En cuarto lugar, se considera el proceso de fluidificación de las RdP temporizadas. Se proponen algunas técnicas para preservar ciertas propiedades cuantitativas de las RdP discretas estocásticas por las RdP continuas temporizadas. Por último, se propone un nuevo formalismo, en el cual el disparo de las transiciones se adapta a la carga del sistema, combinando disparos discretos y continuos, dando lugar a las Redes de Petri híbridas adaptativas. Las RdP híbridas adaptativas suponen un marco conceptual para la fluidificación parcial o total de las Redes de Petri, que engloba a las redes de Petri discretas, continuas e híbridas. En general, permite preservar propiedades de la RdP original, evitando el problema de la explosión de estados. Fraca Santamaría, María Estíbaliz; Silva Suárez, Manuel; Júlvez Bueno, Jorge Emilio

Full text

2015 55 María Estíbaliz Fraca Santamaría Fluidization of Petri nets to improve the analysis of Discrete Event Systems Departamento Director/es Informática e Ingeniería de Sistemas Silva Suárez, Manuel Júlvez Bueno, Jorge Emilio Director/es Tesis Doctoral Autor Repositorio de la Universidad de Zaragoza – Zaguan http://zaguan.unizar.es UNIVERSIDAD DE ZARAGOZA © Universidad de Zaragoza Servicio de Publicaciones ISSN 2254-7606 Departamento Director/es Director/es Tesis Doctoral Autor Repositorio de la Universidad de Zaragoza – Zaguan http://zaguan.unizar.es UNIVERSIDAD DE ZARAGOZA © Universidad de Zaragoza Servicio de Publicaciones ISSN 2254-7606 Departamento Director/es María Estíbaliz Fraca Santamaría FLUIDIZATION OF PETRI NETS TO IMPROVE THE ANALYSIS OF DISCRETE EVENT SYSTEMS Director/es Informática e Ingeniería de Sistemas Silva Suárez, Manuel Júlvez Bueno, Jorge Emilio Tesis Doctoral Autor 2015 Repositorio de la Universidad de Zaragoza – Zaguan http://zaguan.unizar.es UNIVERSIDAD DE ZARAGOZA © Universidad de Zaragoza Servicio de Publicaciones ISSN 2254-7606 Departamento Director/es Director/es Tesis Doctoral Autor Repositorio de la Universidad de Zaragoza – Zaguan http://zaguan.unizar.es UNIVERSIDAD DE ZARAGOZA © Universidad de Zaragoza Servicio de Publicaciones ISSN 2254-7606 UNIVERSIDAD DE ZARAGOZA P H D T H E S I S PhD in Systems Engineering and Computer Science Doctorado en Ingenier´ıa de Sistemas e Inform´atica Fluidization of Petri nets to improve the analysis of Discrete Event Systems Fluidificaci´ on de Redes de Petri para mejorar el an´ alisis de Sistemas de Eventos Discretos M. Est´ ıbaliz Fraca Santamar´ ıa Thesis Advisors: Manuel Silva Su´arez Jorge E. J´ulvez Bueno Departamento de Inform´atica e Ingenier´ıa de Sistemas (DIIS) Universidad de Zaragoza May 2015 . A Laura Recalde A M´ onica Sanagust´ ın Mujeres sonrientes, trabajadoras, coherentes, luchadoras, que disfrutasteis de vuestras cortas vidas en plenitud. Hab´ eis sido y ser´ eis referencia para m´ ı. La investigaci´ on, el desarrollo de una profesi´ on, el compromiso..., son una aventura de darse a los dem´ as, de ser un eslab´ on en la historia de la humanidad, de sembrar y ser inspiraci´ on para otros, que ser´ an quienes recojan los frutos. . v Agradecimientos - Acknowledgement Quiero aprovechar este espacio para dar las gracias a todas las personas que de una manera o de otra hab´eis contribuido al desarrollo de esta tesis doctoral. En especial, a mis directores de tesis, Jorge J´ulvez y Manuel Silva. A Jorge, que me explicaste con ilusi´on tu primera idea sobre “estudiar un formalismo nuevo entre las redes de Petri continuas y las discretas, las HAPN”, y que durante estos casi cinco a˜nos has sido c´omplice, paciente, apoyo, escucha y aliento. Siempre con una sonrisa, y ayud´andome con cada l´ınea de cada demostraci´on, de cada idea, de cada ejemplo. A Manolo, que has estado ah´ı siempre atento, con tu capacidad de abstracci´on y tu memoria infinitas. Con cuidado de que no nos meti´eramos en terrenos demasiado ´asperos, o que no tuvieran la suficiente relevancia. Siempre planificando y pensando en qu´e hacer despu´es. Recuerdo un folio de future work encabezado con “Estibaliz” que me diste en verano de 2011, y del cual he estado comprendiendo algunos de los conceptos hace poco. Gracias a los dos por permitirme desarrollar la tesis en el GISED, que es un grupo con prestigo internacional en la investigaci´on de las Redes de Petri gracias a vosotros. A Cristian Mahulea, que has estado siempre cercano, disponible, atento y la vez silencioso. A Levid, compa˜nero de Chapter book, de viajes, de quedadas de tapas, de conversaciones sobre redes de Petri y sobre todo amigo; a Xu, my collegue of the Petri nets’s Thesis during these years, we have shared supervisor, topic, and trips. A Renato, de quien siempre he admirado tu completa e interesante tesis doctoral, y a´un hoy lo sigo haciendo. A Jos´e Manuel Colom, a Jos´e Merseguer, a Javier Campos. A Laura Recalde, porque muchas de las ideas que aqu´ı hemos desarrollado las ten´ıas t´u ya en mente; y porque la alegr´ıa e ilusi´on que dejaste a tu alrededor lleg´o hasta m´ı a trav´es de los dem´as. Gracias a mis compa˜neros del laboratorio L1.01. Hab´eis sido mucho m´as que unos compa˜neros con quienes compartir un caf´e cada ma˜nana. Primero a los que ya pasasteis, gracias a Carlos, a Javi, a Dorian, a Diego, a Rosario, a Nacho, a Mar´ıa Jos´e. Me hicisteis sentirme como en casa desde el primer d´ıa, a trav´es de caf´es, quedadas, conversaciones sobre la investigaci´on, sobre el mundo, sobre la vida. Y por supuesto gracias a quienes a´un est´ais disfrutando de la etapa del doctorado, gracias a Ra´ul, a Sara, a Alejandro, a Javier, a Jorge (aunque seamos contempor´aneos), a Dani (aunque seas del laboratorio aqu´el). Mucha suerte en el resto de esta aventura. Disfrutad de estos a˜nos de poder pegaros horas y horas con una demostraci´on o experimento, de no tener horarios, de poder ser flexibles. No dej´eis de tomar caf´es ma˜naneros, y seguid aprovechando los mediod´ıas para conversar, re´ır y dibujar en la pizarra. ¡Cuidad del cactus!. Tambi´en a muchos otros doctorandos y visitantes del departamento: Yasir, Henry, Alejo, Maril´u, Ricardo, Jes´us, Alejandro, C´esar, Marta, V´ıctor, Jos´e Manuel, Fernando, Edgar, Alejandro... Con todos recuerdo una conversaci´on, unas tapas, un comentario de complicidad, unas risas... ¡Por el DIIS pas´ais gente muy especial! xii 1 Introduction In science and engineering disciplines, a model is an abstract representation of reality, in which some details have been omitted and only the relevant characteristics (with respect to an objective) have been preserved. Formal models provide mathematical and unambiguous methods and techniques for the modelling, design, analysis and verification of a lot of kinds of systems. A formalism states how a certain formal model can be built. A family of formalisms can be considered as a modelling paradigm, a conceptual framework that allows to obtain several instances from some common concepts and principles. A given system can be modelled by distinct formalisms from the same modelling paradigm, obtaining some advantages such as coherence and economy. The discrete state systems whose evolution is completely determined by the occurrence of some discrete events are denoted as Discrete Event Systems (DES). They appear in many fields, for instance in manufacturing, logistics, computer networks (web services, communication networks...), traffic systems, population dynamics, biochemical processes, etc. The discipline devoted to the modelling, analysis and verification of those systems is also denoted as DES. The research on DES has been approached from several disciplines, such as systems theory, computer science and operational research. The modelling and analysis of DES is considered in this thesis. Petri Nets (PN) are one of the most widely used formalisms for DES. They constitute the modelling paradigm considered in this work, having powerful analysis and synthesis techniques and a direct graphical representation. PN consist of places (drawn as circles) which represent the state, and transitions (drawn as rectangles or bars) which represent the events among states. In contrast to other formalisms, the state of a system is a collection of local states, and it is represented with tokens contained in the places. The PN formalism has been especially used to model concurrent and dis tributed systems in which concurrency and synchronization relations appear [Pet81; Bra83; Sil85; DA10]. Different Petri net formalisms can be used for the diverse phases of the life-cycle of a 1 2 1. Introduction system. For instance, the basic untimed model can be used to study basic relationships with non determinism, and a timed model can be used for performance evaluation. Fluidization of Petri nets Petri nets are a powerful formalism for the modelling and analysis of DES. However, some analysis techniques are inefficient for the analysis of highly populated systems. As other formalisms for DES, the analysis of PN suffers from the state explosion problem: the set of reachable states grows exponentially with respect to the initial population of the system, and hence the analysis techniques based on the exploration of the state space become intractable for high workloads. A classical technique to overcome this difficulty is known as fluidization, which proposes to relax the integrality constraints of the original discrete model, and deals with a continuous (or hybrid) approximation. Such a relaxation aims at computationally more efficient analysis methods, at the price of losing some precision. It is the kind of relaxation which appears when a Integer Programming Problem (IPP) is relaxed to a Linear Programming Problem (LPP), which has more efficient analysis techniques. In the field of PN, total fluidization of classical Discrete Petri Nets (DPN) results in Continuous Petri Nets (CPN). The idea of the fluidization of Petri nets was proposed at the net level (see [DA10] for a comprehensive view) in 1987 in the field of manufacturing systems by David and Alla in [DA87]. Developed in parallel, the fluidization at the level of the state equation was proposed at the same meeting (the 8th European Workshop on Application and Theory of PN, Zaragoza) by Silva and Colom (see [STC98]), focusing on the use of linear programming techniques to analyse the net systems. Continuous PN are obtained by removing the integrality constraint of the firing of transitions, which means that the firing count vector and consequently the marking are no longer restricted to be in the naturals, but relaxed into non-negative real numbers [DA10; Sil+11]. If no time interpretation is chosen, untimed (or autonomous) continuous Petri nets are obtained. Moreover, as in discrete PN, distinct time interpretations can be considered. The most common approaches consider time associated to transitions, dealing to different firing semantics. Timed Continuous PN (TCPN) under infinite server semantics are one of the most used and accepted time interpretations [MRS09; Sil+11]. Continuous PN can be seen as a relaxation of a discrete PN system. Moreover, continuous PN have been also used to directly model and analyse systems in different application fields. In [Cab+10], a method based on CPN is proposed for the fault diagnosis of manufacturing systems that manage systems intractable with discrete Petri nets (for modelling of manufacturing systems see also [ZA90]). In [RL+10], the authors introduce a bottom-up modelling methodology based on CPN to represent a cell metabolism and solve a regulation control problem. When not every transition of a discrete PN system is fluidified, Hybrid Petri Nets (HPN) [BGS01; DA10] are obtained, in which some transitions are continuous and the rest of them are discrete. Applications of HPN include the modelling of manufacturing systems [BGM00], 3 the simulation of water distribution systems [GMLMA12] or the analysis of traffic in urban networks [V´az+10], among others. Limitations of continuous PN At first glance, the simple way in which the basic definitions of discrete models are extended to continuous ones may make us naively think that their behaviour will be similar. However, the behaviour of the continuous model can be completely different just because the integrality constraint has been dropped. In other words, not all DEDs can be satisfactorily fluidified. In the context of PN, the relaxation from discrete PN to continuous PN obtains more tractable analysis techniques, at the price of loosing some fidelity to the discrete system, such as losing some system capabilities, e.g., mutual exclusion [DA10; Sil+11]. Considering untimed PN, some qualitative properties of the discrete PN may be lost by fluidization. In continuous PN, a transition can be fired in real amounts. Hence, some markings (or states) which were not reachable by the original discrete system become reachable by the continuous system. Because of these new firings that are possible and markings which become reachable, important properties of the original discrete model such as deadlockfreeness, liveness, reversibility, etc. are not preserved, in general, by the fluidization of untimed PN [RTS99]. When a time interpretation is considered (i.e., timed PN), some quantitative properties may also be lost by the fluidified system. These discrepancies between discrete Stochastic Petri Nets (SPN) and TCPN have been studied in the literature, and some techniques have been proposed to improve the accuracy of the original fluid approximation such as [LL12; VS12]. However, more research is needed to establish the conditions under which the fluid approximation is not good, and to propose approaches to improve such fluid approximation. Objectives of the thesis The general goal of this thesis is to contribute to the study and improvement of the fluidization of discrete PN, in order to overcome the limitations of continuous PN. Considering both untimed and timed PN, one of the objectives of this thesis is the study of the fluidization processes, i.e., to establish qualitative and quantitative properties which are preserved by fluidization and under which conditions. Another important objective is to improve the fluidization process, i.e., to reduces the differences between a discrete PN and its continuous counterpart. This improvement is specially important when “relatively” small populations are considered, neither very small ones (for which fluidization would not be needed) nor very large ones (in which fluidization gives reasonably good results). Some alternative fluidization techniques are proposed for this aim. They will offer a trade-off between the fidelity to the original discrete PN, and the avoidance of the state explosion problem. The obtained improvement will be bigger (in relative terms) when the marking of the system is small. The possible techniques include: modification of the structure of the discrete net before its fluidization, definition of new semantics or 4 1. Introduction structures for the firing of transitions, and definition of a new formalism which proposes the partial fluidization of transitions. Partial fluidization is considered in the formalism of Hybrid Adaptive Petri Nets (HAPN), which proposes a partially hybrid PN in which transitions can be discrete or continuous depending on its workload. Finally, it is also interesting to study not only the fluidization processes, but also the continuous PN formalism itself. Research on complexity issues provides a better understanding of the formalism. The objective is to improve the known lower and upper bounds of checking some properties in CPN [RTS99; JRS03; RHS10], and to show that a property (such as reachability set inclusion) which is undecidable for DPN can become decidable for CPN. Contributions and publications The main contributions obtained by this thesis for the analysis and improvement of the fluidization of PN are enumerated below: •Improvement of the original discrete system. Some preliminary transformations of the discrete PN at the structure level to improve the fluidified system are suggested. The proposed techniques can be found in [FJS14a], and in a paper submitted to an indexed journal [FJS s]. •Study of the fluidization of untimed PN. The thesis establishes the conditions that a discrete PN has to fulfil to preserve some qualitative properties (such as boundedness, deadlock-freeness, liveness, etc) when it is fluidified. This work has been presented in a conference paper [FJS12], among the finalists for the “best student paper award”, and an extended version has been published in a journal [FJS14a]. •Determination of the computational complexity of checking some properties in untimed PN. The upper bounds for some decision procedures have been improved, and novel lower bounds have been determined. These results have been published in [FH13], which obtained the “outstanding paper award” recognition, and in the journal paper [FH15]. •Preservation of quantitative properties by the fluidization of discrete stochastic PN. The conditions under which the throughput approximation is not good have been studied, and the fluidization process has been improved by means of a new semantics for the firing of transitions. Most of these results are included in the conference paper [FJS14b], also finalist for the “best student paper award”. A generalization of the work has been submitted to an indexed journal [FJS s]. •Definition and study of a conceptual framework for the partial fluidization of untimed PN, hybrid adaptive PN. It is a generalization of discrete, continuous and hybrid PN, and it also allows adaptation to the workload of the system. An algorithm to characterize the reachability set of a net system in this formalism has been designed. And the preservation of certain properties of the discrete system has been studied. The 5 definition and some preliminary properties preservation results were published in the conference paper [Fra+11]. And the computation of its reachability graph and reachability set are included in the journal paper [FJS15]. Document organization The document is organized in four parts. The first of them presents some definitions and previous concepts of discrete PN and it proposes some basic transformations over the original discrete system to improve the fluidified one. Part II studies the fluidization process of untimed PN: preservation of untimed properties of the discrete system, and complexity analysis of some properties in continuous PN. The fluidization of timed PN is considered in Part III, which focuses on the approximation of the throughput of discrete systems. Finally, the formalism of HAPN and some techniques for its reachability analysis are proposed in Part IV. The objectives of each part and each chapter are described below: ◦Part I. Previous concepts and transformations of the discrete system In this part, the discrete PN formalism is considered before its fluidization. First, some concepts and definitions are provided. Then, some transformations of the original discrete system are proposed. These transformations do not modify the behaviour of the discrete PN system, but they can improve the fluidization process. •Chapter 2. Previous concepts on discrete Petri net systems This chapter presents the formal definitions and concepts related to discrete Petri nets. Untimed PN are defined first, as well as some reachability concepts and properties. Then, a time interpretation is considered, dealing with discrete stochastic Petri nets. •Chapter 3. Previous transformations of the original discrete system An interesting technique to improve the fluidization is to apply some previous transformations to the original PN system, preserving its discrete behaviour. When the transformed PN is fluidified, its behaviour is more faithful to the one of the original discrete PN. These previous transformations performed on the discrete PN system are described in this chapter. ◦Part II. On the fluidization of untimed Petri nets This part focuses on the fluidization of untimed PN. The preservation of homothetic properties by the continuous PN is established. Moreover, the computational complexity of the CPN formalism itself is examined. •Chapter 4. Previous concepts on the fluidization of untimed Petri nets This chapter presents the fluidization of untimed Petri nets. Some basic concepts about continuous Petri nets are included in this chapter, such as its definition, its reachability analysis and certain system properties. 6 1. Introduction •Chapter 5. Preservation of homothetic properties by continuous Petri nets This chapter studies the preservation of untimed properties such as boundedness, deadlock-freeness, liveness, etc. when a DPN system is fluidified. It states a sufficient condition (homothetic monotonicity) for property preservation. It also examines the preservation of deadlock-freeness in different net subclasses. •Chapter 6. Complexity analysis of continuous Petri net properties In contrast with Chapter 4, in which the fluidization process is considered, this chapter considers the continuous PN formalism itself. In fact, it continues with the complexity analysis of deciding the considered properties (boundedness, deadlock-freeness, etc) in CPN. ◦Part III. On the fluidization of timed Petri nets When a time interpretation is added to the CPN, Timed Continuous PN (TCPN) are obtained. The approximation of quantitative properties from discrete systems such as steady state throughput is investigated. •Chapter 7. Previous concepts on the fluidization of timed Petri nets This chapter presents some formal definitions and concepts about fluidization of timed Petri nets. It presents the addition of a time interpretation to the untimed CPN. The throughput approximation of discrete stochastic Petri nets is considered. •Chapter 8. The “bound reaching problem” In this chapter, the bound reaching problem is identified, a particular situation in which the differences between the discrete and the continuous behaviour are particularly acute. Moreover, a new semantics to fluidify the PN systems which suffer from such bound reaching problem is derived from infinite servers semantics. ◦Part IV. Hybrid adaptive Petri nets In this part, an alternative fluidization formalism is proposed, the Hybrid Adaptive Petri Nets (HAPN). It is a general formalism that includes discrete, continuous and hybrid PN, and it allows a partial fluidization of transitions. Each transition has an associated threshold, such that it behaves as continuous if its enabling degree is above the threshold, and otherwise it behaves as discrete. •Chapter 9. Hybrid adaptive Petri nets: definition and deadlock-freeness preservation This first chapter dedicated to HAPN presents the definition of the untimed formalism. Moreover, reachability set inclusion and preservation of deadlockfree- ness of DPN systems by HAPN is studied. •Chapter 10. Reachability analysis of Hybrid Adaptive Petri nets This chapter characterizes the reachability property of HAPN. A method to obtain 7 the reachability graph and reachability space of HAPN is proposed. Due to the fact that HAPN includes HPN, the method can be also applied to HPN. •Chapter 11. Conclusions and perspectives Finally, Chapter 11 summarizes the conclusions of the thesis and identifies some research lines which still remain open. Part I Previous concepts and transformations of the discrete system 9 16 2. Previous concepts on discrete Petri net systems Proposition 2.11 [GVC99] Let N=hP∪ {p}, T, P re,P ostiD. Assuming there exists a marking solution of the state equation m=m0+C[P, T ]·σenabling at least one transition t∈p•, then pis a concurrent implicit place if ∃y,z, ν such that: yT·C[P, T ]≤C[p, T ] zT·P re[P, p•] + ν·1T≥P re[p, p•] yT·m0+ν < m0[p] + 1 y≥z≥0, ν ≤0 2.1.3 System properties Some common properties of PN systems are presented in this section for discrete PN. They are divided in two general groups: synchronic properties, and deadlock-freeness and liveness properties. Synchronic properties Synchrony theory [Sil87; SC88] is a branch of the Net Theory that studies transition firing dependences (synchronic properties). Considering PN systems, these dependences are qualitatively characterized as synchronic relations.The synchronic properties describe some behavioural properties of PN systems in terms of quantitative assertions. Some of the synchronic properties are lead,distance,places bounds,places mutual exclusion,B-fairness, etc, which may be interesting for the analysis of manufacturing systems. p1 p2 p3 p4 p5 p6 t1t2 t3 t4 t5 t6 Figure 2.2: PN system to show the fireability of its T-semiflows: x1= (1,1,1,1,0,0), x2= (0,0,0,0,1,1).x2can be fired in isolation but x1can not be fired without firing x2. Let us illustrate the fireability of T-semiflows by means of a simple example. Consider the PN system in Fig. 2.2, with initial marking m0= (1,0,0,0,0,0). It has two T-semiflows: x1= (1,1,1,1,0,0) and x2= (0,0,0,0,1,1). If the PN system 2.1. Untimed Petri nets 17 is considered as discrete, then x1and x2cannot be fired in isolation (i.e., any sequence σ= [t1(t6t5)∗t6t2t3(t5t6)∗t5t4]∗is fireable). A synchronic property that holds in a given PN system from a certain initial marking is said to be behavioural, while a synchronic property which holds for every initial marking is called structural. Boundedness and B-fairness are considered in this work, as representative of synchronic properties. Definition 2.12 Boundedness (B). •A place pis bounded if ∃b∈R>0such that for all m∈RSD(N,m0),m[p]≤b. •A system hN,m0iDis bounded if every p∈Pis bounded. The structural bound of a place p,SB(p), can be computed as SB(p) = max{m[p]| m=m0+C·σ,m,σ≥0}. Definition 2.13 B-Fairness (BF). •Two transitions t, t′are in B-fair relation if ∃b∈R>0such that for all m∈ RSD(N,m0), for every finite (infinite) firing sequence σfireable from m, it holds that if σ(t) = 0 then σ(t′)≤b; and if σ(t′) = 0 then σ(t)≤b. •A system hN,m0iDis B-fair if every pair of transitions t, t′∈Tis in B-fair relation. A net Nis structurally bounded (resp. structurally B-fair) if ∀m0,hN,m0iDis bounded (resp. B-fair). The structural bound of a place p, and the structural enabling bound of a transition tare respectively defined as: SB(p) = ⌊max{m[p]|m=m0+C·σ,m,σ≥0}⌋ SEB(t) = ⌊max{e|∀p∈•t, e ≤m[p] Pre[p, t],m=m0+C·σ,m,σ≥0}⌋ Consider the PN system in Fig. 2.3. The structural bound of places p3and p4is SB(p3) = SB(p4) = 2. However, both places cannot have two tokens at the same marking, and the structural enabling bound of t5is SEB(t5) = 1. Deadlock-freeness and liveness properties Some well known properties in discrete systems [Mur89; DiC+93], and often required for real systems, are recalled below. Definition 2.14 Deadlock-Freeness (DF). A system hN,m0iDis deadlock-free if ∀m∈ RSD(N,m0),∃t∈Tsuch that tis enabled at m. 18 2. Previous concepts on discrete Petri net systems t1t2 t3 t4 t5 p1p2 p3p4 Figure 2.3: A PN net system. The structural enabling bound of t5is equal to 1. For example, the PN system in Fig. 2.1(b) is deadlock-free, while the one in Fig. 2.1(a) is not deadlock-free, because it can reach deadlock marking md= (0,2,0). Definition 2.15 Liveness (L). A system hN,m0iDis live if for every transition tand for every marking m∈RSD(N,m0)there exists m′∈RSD(N,m0)such that tis enabled at m′. A home state is a marking that can be reached whatever the current state. This property can express for instance that recovering from faults is always possible. Definition 2.16 Home state. A marking mhis a home state if ∀m′∈RSD(N,m0), mh∈RSD(N,m′). When m0is a home state, it is said that hN ,m0iis reversible. Definition 2.17 Reversibility (R). A system hN,m0iDis reversible if for any marking m∈ RSD(N,m0)it holds that m0∈RSD(N,m0). A net Nis structurally deadlock-free (resp. structurally live; resp. structurally reversible) if ∃m0s.t. hN ,m0iis deadlock-free (resp. live; resp. reversible). 2.1.4 Petri net system subclasses PN subclasses are usually defined by imposing some constraints on the structure of the net system. Some of them are defined below. Definition 2.18 (Petri net subclasses) 2.1. Untimed Petri nets 19 •Ordinary Petri nets are PN in which arc weights are equal to 1, i.e. P re,P ost ∈ {0,1}|P|x|T|. •State machines (SM) are ordinary Petri nets where each transition has one input and one output place, i.e., ∀t, |•t|=|t•|= 1. •Marked graphs (MG) [Com+71] are ordinary Petri nets where each place has one input and one output transition, i.e., ∀p, |•p|=|p•|= 1. •Join free (JF) nets are Petri nets in which each transition has at most one input place, i.e., ∀t, |•t| ≤ 1. •Choice free (CF) nets [TCS97] are Petri nets in which each place has at most one output transition, i.e., ∀p, |p•| ≤ 1. •Free choice (FC) nets [Hac72] are ordinary Petri nets in which conflicts are always equal, i.e., ∀t, t′, if •t∩•t′=∅, then •t=•t′. •Equal Conflict (EQ) nets [TS96] are Petri nets in which conflicts are always equal, i.e., ∀t, t′, if •t∩•t′=∅, then P re[P, t] = P re[P, t′]. Mono-T-Semiflow (MTS) nets [CCS91] are conservative Petri nets which have a unique T- semiflow whose support contains all the transitions. Considering not only the PN structure, but also the initial marking, DSSP systems are defined. They model relations in which certain modules (modelled by state machines) cooperate through buffers (modelled by places which connect the modules). For example, in the DSSP in Fig. 2.4 (a), three state machines are connected with buffers b1, b2, b3. They are more general than Equal Conflict nets, and have some characteristics in common. A property of DSSP is that all behavioural conflicts in hN,m0iDare behaviourally equal: If t,t′are in conflict and both are enabled, then P re[P, t] = Pre[P, t′]. They are defined as follows. Definition 2.19 A PN system hN,m0iDis a DSSP[RTS98], with N=hP, T, Pre, P osti where Pis the disjoint union of P1,...,Pnand B, and Tis the disjoint union of T1,...,Tn, and the following holds: 1. For every i∈ {1..n}, let Ni=hPi, Ti, P re[Pi, Ti], P ost[Pi, Ti]i. Then, hNi,m0[Pi]i is a live and safe state machine. 2. For every i, j ∈ {1..n}, if i6=jthen Pre[Pi, Tj] = Post[Pi, Tj] = 0. 3. For each buffer b∈B: (a) dest(b)∈ {1..n}exists s.t. b•⊆Tdest(b). (b) If t, t′∈p•, where p∈Pdest(p), then Pre[b,t] = Pre[b,t′]. ADSSP marking is a marking for a DSSP net which respects the monomarkedness of the state machines (in continuous systems, the sum of all the tokens of each SM is equal to 1). 20 2. Previous concepts on discrete Petri net systems 121 t1 1 t1 2 p1 1 t2 1t2 2 t2 3 t2 4 p2 1 p2 2 p2 3 t3 1t3 2 p3 1 p3 2 b1 b2 b3 23 3 Figure 2.4: A consistent DSSP system 2.2 Linear Enabling Functions Linear Enabling Functions (LEF) were introduced for discrete PN systems in [TCS93; BCS94], to characterize the enabling of transitions such that •ti>1by a single linear expression. The concept of linear enabling functions is presented in Section 2.2.1. Then, the LEF are used to check homothetic DF of a discrete PN system (Section 2.2.2). Finally, the addition of representative places for join transitions is presented in Section 2.2.3. These representative places will be used in Chapter 8 to apply the ρ-semantics proposed there to join transitions. 2.2.1 The concept of Linear Enabling Functions The purpose of LEF is to represent the enabling of a transition by a single linear expression. In order to define LEF, transitions are classified in four Classes (obtained from the classification in five classes proposed in [BC94], from which the last two classes have been fused): •Class 1. Transitions with a single input place: |•t|= 1. •Class 2. Transitions with several input places, and for all of them its SB is equal to the weight of the arc to the transition: ∀p∈•t,SB(p) = Pre[p, ti]. •Class 3. Transitions with several input places, and all of them except one, denoted as pi, fulfil that its SB is equal to the weight of the arc to the transition: ∀p∈•t\ {π}, SB(p) = Pre[p, ti]. •Class 4. Transitions that do not belong to precedent classes. It is, that SB(p)> Pre[p, ti]for more than one of its input places p. 2.2. Linear Enabling Functions 21 tttt ww1w1 w1 w2w2 w2 SB(p1) = w1 SB(p2) = w2 SB(p1)> w1 SB(p2) = w2 SB(p1)> w1 SB(p2)> w2 pp1p1 p1 p2p2 p2 (a) (b) (c) (d) Figure 2.5: Classification of transition trelated to the definition of LEFs. (a) Class 1, (b) Class 2, (c) Class 3, and (d) Class4. The enabling degree of a transition tof Class 1, Class 2 or Class 3 can be represented with a single LEF [BCS94], as it is summarized below. •Class 1. Transition tis enabled when m p∈•t[p]≥Pre[p, t]. •Class 2. Transition tis enabled when P p∈•t m[p]≥P p∈•t Pre[p, t]. •Class 3. Transition tis enabled when m[π] + SB(π)·P p∈{•ti\π} m[p]≥Pre[π, ti] + SB(π)·P p∈{•ti\π} Pre[p, ti]. •Class 4. Its enabling cannot be directly represented by a single LEF, and some previous transformations of the PN should be done (see [BCS94]). One of the possible transformations is presented in Fig. 2.6. 2.2.2 Checking homothetic deadlock-freeness The aim of this section is to characterize homothetic deadlock-freeness for structurally bounded Petri nets, by means of the basic definition of deadlock and the use of LEF. A PN system hN,m0iDis homothetic deadlock-free if it is deadlock-free for m0and for any proportional initial marking m′ 0=k·m0, for every kin the naturals. A first method to check homothetic DF of hN,m0iDcan be to check monotonic DF, which implies homothetic DF. Monotonic DF can be checked with the siphon-trap property [Bra83; JC03]: If every siphon of Ncontains a marked trap which is marked at m0, then hN,m0iDis monotonic DF (with some marking restrictions in the case of non-ordinary PN). However, checking this property is NP-complete, even for ordinary nets [OWW10]. In this section, a linear technique is presented to provide a sufficient condition for homothetic DF. For this purpose, a technique for the study of DF in discrete PN systems considered in [STC98] is recalled. It will allow us to analyse not only DF of a given system hN,m0iD, but also homothetic DF (for any scaled initial marking k·m0). 22 2. Previous concepts on discrete Petri net systems Figure 2.6: Transformation performed over a transition of Class 4. Places paand pbare added, with SB(pa) = SB(pb) = 1, and the firing sequences are preserved. After the transformation, tbecome a transition of Class 3 because only p2holds SB(p2)> Pre[p2, t], and the added transition tpis also of Class 3, because only one of its input places (p1) holds SB(p1)> Pre[p1, t]. The following general sufficient condition for DF, based on the state equation, exploits the definition: “a deadlock corresponds to a marking in which no transition is fireable”. Let hN,m0iDbe a PN system. If there does not exist any solution (m,σ) to the following system, then hN,m0iDis deadlock-free. m=m0+C·σ m≥0,σ≥0, Wp∈•tm[p]≤Pre[p, t]−1,∀t∈T (2.4) Nevertheless, notice that the system above contains |T|“complex conditions” (one for each transition) which are non linear, due to the “∨” connective. Thus, (2.4) can be handled by solving independently a set of Qt∈T|•t|systems of linear inequalities, a quantity that grows exponentially: the number of linear systems is multiplied by |•t|for each join transition. Let us illustrate the key idea with the example in Fig. 2.7(a). Initially, the system that characterizes the sufficient condition for DF is: If there does not exist a solution to the following system, then the net system is DF (thus 23= 8 linear systems should be explored): m=m0+C·σ, m≥0,σ≥0, (m[p1] = 0 ∨m[p2] = 0),{t1is not enabled} (m[p1] = 0 ∨m[p3] = 0),{t2is not enabled} (m[p4] = 0 ∨m[p5] = 0) {t3is not enabled} (2.5) In [STC98], some transformation rules are considered in order to reduce the number of systems generated by (2.4), using LEF. Furthermore, in Theorem 34 of [STC98], it was proved that the system (2.4) can be rewritten as a single system of linear inequalities for every structurally bounded PN system. 2.2. Linear Enabling Functions 23 t1t2 t3 p1 p2 p3 p4p5 2 2k k t1t2 t3 tp tq p1 p2 p3 p4p5 papb pc pd 2 k 2k Figure 2.7: (a) PN system; (b) the same PN system, where tp,tq,pa,pb,pcand pdhave been added in order to study DF with a single linear system. First, the PN is transformed to a PN in which every transition has at most one input place whose SB is larger than the weight of its input arc. Then, the following rule is applied, which is analogous to the enabledness function for transitions of Class 3. Reduction rule. Let tbe a transition in Class 3 (i.e., •t=π∪ {p′}, where SB(p)≤ Pre[p, t]for every p∈π. Then, the set of integer solutions of (2.5) is preserved if the disabledness condition corresponding to tis replaced by the following one: SB(p′)·X p∈π m[p] + m[p′]≤SB(p′)·P re[p, t] + P re[p′, t]−1 The PN system (Fig. 2.7(a)) is first transformed to the one in Fig. 2.7(b), a transformation that preserves the reachable sequences (hence,it preserves DF): place p1is transformed to “p1,tp,pa,pb”. Then, a term related to transition tpneeds to be added in order to express a deadlock: m[p1] = 0 ∨m[pb] = 0. Now, the rule can be applied to t1(with p′=p1 and π={pb}) because SB(p1) = 2 ·kand SB(pb) = 1. The term is transformed to SB(p1)·m[pb] + m[p1]≤SB(p1)·Pre[pb, t] + P re[p1, t]−1, i.e., m[p1] + 2 ·k·m[pb]≤ 2k. Moreover, SB(pa) = 1 and SB(p2) = k. Hence, non enabledness of t1,(m[p1] = 0∨m[p2] = 0), is reduced to k·m[pa] + m[p2]≤k. The other terms are analogously reduced. 24 2. Previous concepts on discrete Petri net systems The resulting system is: m=m0+C·σ, m≥0,σ≥0, k·m[pa] + m[p2]≤k, {t1is not enabled} k·m[pa] + m[p3]≤k, {t2is not enabled} 3 2k·m[pc] + m[p4]≤3 2k, {t3is not enabled} m[p1] + 2k·m[pb]≤2k, {tpis not enabled} k·m[pd] + m[p5]≤k{tqis not enabled} (2.6) In this example, (2.6) has no solution, so the PN system is DF. In general, if a solution exists, it can be either a reachable deadlock or a spurious marking of the discrete net system (a killing spurious marking). In other words, system (2.6) only provides a sufficient condition for DF of discrete PN systems (semidecision). If (2.6) has not real solutions, then the system is homothetically DF. In this example, system (2.6) obtained for the PN in Fig. 2.7(b), has no solution in the real domain. Consequently, hN,m0iDis homothetically DF. 2.2.3 Representative places for join transitions The LEF of a transition of Class 2 or Class 3 can be represented in the PN system with an implicit place which is a representative place of the enabling of the discrete transition. Notice that transitions of Class 1 has a unique input place, hence it can be considered as its representative place. Transitions of Class 4 may also require a previous transformation to Classes 2 or 3. The representative place of a transition tiis defined as a linear combination of the input places of the transition, and it is added to the system as explained below: •Class 2. The representative place riof a transition tiis built as a linear combination of the places in •ti, which represents the LEF for ti. Place ricorresponds to the linear combination of every place p∈•ti, and it is built as: C[ri, T ] = X p∈•ti C[p, T ](2.7) And its initial marking is obtained as: m0[ri] = X p∈•ti m0[p](2.8) •Class 3. The representative place riof a transition tiis a linear combination of the places in •ti, which represents the LEF for ti. Place riis built as: C[ri, T ] = C[π, T ] + SB(π)·X p∈{•ti\π} C[p, T ](2.9) 2.2. Linear Enabling Functions 25 And its initial marking is obtained as: m0[ri] = m0[π] + SB(π)·X p∈{•ti\π} m0[p](2.10) (a) (b) Figure 2.8: Without the grey places, PN system with two different initial markings: (a) m0= (2,0,0,0,0,0) and (b) m′ 0= (3,0,0,0,2,0). The addition of the representative places r1 drawn in grey colour preserves their firing sequences as discrete PN systems. Consider the PN in Fig. 2.8(a) without the grey places with m0= (2,0,0,0,0,0). Transition t1belongs to Class 2, because SB(p4) = 2 = Pre[p4, t1], and SB(p6) = 2 = P re[p6, t1]. Hence, the enabling of t1can be represented by m[p4] + m[p6]≥ Pre[p4, t1] + P re[p6, t1), i.e., m[p4] + m[p6]≥4. The representative place r1has been added, which is created as the addition of places p4and p6, i.e., p4+p6. Consider now m′ 0= (3,0,0,0,2,0) (Fig. 2.8(b), without the grey places). In this case, transition t1belongs to Class 3. Considering π=p6, it holds SB(p6) = 5 > Pre[p6, t1] = 2, and all the other input places of t1, i.e., •t1\ {π}={p4}, hold the equality, SB(p4) = Pre[p4, t1] = 2. The enabling of transition t1in the discrete PN system can be represented by the following condition: m[p6] + SB(p6)·m[p4]≥Pre[p6, t1] + SB(p6)·Pre[p4, t1]. Representative place r1has been created as p6+SB(p6)·p4, which corresponds to p6+5·p4 (see the grey places r1in Figs.2.8(a) and (b)). The added place riis constructed as a linear combination of the places of the original PN system (both in Class 2 and Class 3). Consequently, its marking is also a linear combination of markings in •ti\ {ri}, and it will be never the one constraining the enabling degree of ti. Hence, by construction, it is implicit in the discrete system. 32 3. Previous transformations of the original discrete system Pr2Pr1 p0 p1 p2 p3 p4 q0 q1 q2 q3 q4 r3 r1 r2 s1 s2 s′ 3s3 s4 s5t1 t2 t3 t′ 3 t4 t5 u1 Figure 3.2: Without the dotted place u1and the related arcs, it is a deadlock-free discrete system. It deadlocks as continuous, reaching md= (0,0,0,1,0,0,0,0,1,0,0,0,1), which was a spurious deadlock of the state equation ([GV99], p. 111). 3.3 Rational vertex cutting places The aim of this technique is to cut the non-integer vertices of the polytope of LRSC. Consider the example in Fig. 3.6(a). It has four reachable markings as discrete: m0= (1,0,1,0,0),m1= (0,1,0,3,0),m2= (0,0,1,0,3), and m3= (0,0,1,1,1). The polytope of the markings contained in its LRSCis the convex set defined by the those markings as vertices and (0,0,1,1.5,0) as other vertex. Some of the markings of the LRS(N,m0) are outside the “integer hull”, such as md= (0,0,1,1.5,0), which moreover it is a vertex of the polytope. Marking mdis not reachable by the discrete PN because md6∈ N|P|. Because it is a vertex and it is not reachable, in the nearest vertices, at least one of the places which are empty at md(i.e., p1,p2and p5) should be marked (with a marking equal or greater than 1, in the discrete model), otherwise it would not be a vertex. Hence, we can assure that the following inequality holds for every discrete marking: m[p1] + m[p2] + m[p5]≥1. This inequality can be forced by the addition of a place vwhich is implicit in the discrete (but not in the continuous) PN: m[p1] + m[p2] + m[p5]−m[v] = 1. From this equation, place v is defined as C[v, T ] = C[p1, T ] + C[p2, T ] + C[p5, T ], and m0[v] = m0[p1] + m0[p2] + m0[p5]−1, as depicted in Fig. 3.3. Place v, here denoted as rational vertex cutting place, adds the invariant m[p1] + 2 · m[p3] + m[p4] + m[v] = 3 to the net, and mdbecomes not reachable in the continuous system. Given a non-integer vertex mv, a place vcan be added to force the following relation: 3.3. Rational vertex cutting places 33 X i|mv[pi]=0 m[pi]≥1. The obtained rational vertex cutting place vis implicit in the discrete PN and it cuts the marking mvin the continuous system. Enumerating all the vertices of the polytope is computationally costly [AF92]. However, checking if a given solution mvis a vertex of a polytope can be done in polynomial time, as discussed below. A vertex mvof the polytope defined by LRS(N,m0)is a solution which is not a linear combination of other solutions in LRS(N,m0), i.e. 6 ∃ m1,m2∈LRS(N,m0)with m16=m2s.t. mv=αm1+βm2for arbitrary α, β > 0. Hence, any vertex is a minimal support vector: Proposition 3.3 A solution mv∈LRS(N,m0)is a vertex of LRS(N,m0)⇒mvis a minimal support solution in LRS(N,m0) The reverse is not true if Nis not conservative. For example, consider the PN system in Fig. 3.3. Every marking is minimal support, but here only m0= (1) is a vertex. A polynomial time method is presented below to check if a given solution of the state equation is a vertex. p1 t11 2 Figure 3.3: Non consistent, non conservative PN system. Proposition 3.4 A solution mv∈LRS(N,m0)is a vertex iff ∀pi∈P,viis equal to 0, where viis defined by the following maximization problem: vi=max (mv[pi]−m1[pi]) s.t. m1=m0+C·σ1,m1,σ1≥0(3.1) m2=m0+C·σ2,m2,σ2≥0 mv= 0.5m1+ 0.5m2 Proof. (⇒) Assume mvis a vertex. By definition, 6 ∃ma,mbs.t. ma6=mband mv= 0.5·m1+ 0.5·m2. Hence, the maximization problem (3.1) finds that m1=m2=mvis the optimal solution. (⇐) Assume mvis not a vertex. Then, there exists two interchangeable solutions m1,m2∈ LRS(N,m0)s.t. m16=m2and mv= 0.5·m1+ 0.5·m2. Hence, there exists at least a place pis.t. m1[pi]<mv[pi]<m2[pi]. Therefore, vi>0. Proposition 3.4 can be checked in polynomial time, by solving a set of |P|LPP, from which the first phase of the classical simplex approach is common, because only the objective function changes. If Nis consistent, the number of variables and restrictions can be reduced, by replacing mk=m0+C·σkby B·mk=B·m0, for k={1,2}, where Bis a basis of p-flows of N[STC98]. Then, viis defined as: 34 3. Previous transformations of the original discrete system p1 p2p3p4p5 t1t2 t3 t4t5 v 1 1 2 2 2 3 33 Figure 3.4: Petri net system. The rational vertex cutting place drawn in grey colour cuts the undesired spurious deadlock md= (0,0,1,1.5,0), which was not cut by any marking truncation place. vi=max (mv[pi]−m1[pi]) s.t. B ·m1=B·m0,m1≥0(3.2) B·m2=B·m0,m2≥0 mv= 0.5·m1+ 0.5·m2 3.4 Marking truncation places A particular case of the rational vertex cutting place is presented here. The marking truncation places can be efficiently computed and added. Given that a marking of a discrete PN system belongs to N|P|, a place pjwill never have more tokens than its structural enabling bound in the naturals, SB(p). However, this bound can be overlooked by the continuous system. The addition of an implicit place qjis proposed, which is a complementary place of each pj(i.e., P re[qj, T ] = Post[pj, T ]and Post[qj, T ] = P re[pj, T ]) which truncates the marking of pjto the nearest integer, and consequently, undesired markings are avoided. The initial marking of such complementary place is: m0[qj] = SB(pj)−m0[pj](with SB(pj) defined in the naturals). For example, consider the PN in Fig. 3.5. The marking truncation place q3is added, which is complementary to p3and whose initial marking is m0[q3] = ⌊1.5⌋ − 0 = 1. It is implicit in the discrete system, but it modifies the behaviour of the continuous one. It avoids to have more than 1 token in p3, hence it avoids some spurious markings of the original system such as m3= (0,1,1.5,0) (which is a continuous deadlock), in which m3[p3] = 1.5 was bigger than SB(p3) = 1. Places q1,q2and q4would not modify the continuous system, so they have not been added. An interesting question is whether these cuts obtain the “convex hull” of the polytope defined by the reachable markings of hN ,m0iDas the Gomory-Chv`atal cuts would do. 3.5. Enabling truncation places 35 3 32 p1p2 p3 p4 t1t2 t3 q3 1 1 Figure 3.5: Petri net system. The marking truncation place q3drawn in grey colour is implicit in the discrete system, but removes the undesired markings from its LRSC. p1 p2p3p4p5 t1t2 t3 t4t5 q4 1 1 32 3 3 3 33 (a) Figure 3.6: Petri net system. The marking truncation place drawn in grey colour does not cut the spurious deadlock marking md= (0,0,1,1.5,0), which is a vertex of the reachable polytope. However, this technique is less powerful that the rational vertex cutting places. For example, consider again the PN system in Fig. 3.6(a). The marking truncation place q4is added to limit that of p4. However, mdis still reachable by the continuous PN (the rest of the places qjwould not avoid it either). Hence, the marking truncation places do not always obtain the “integer hull” of the polytope defined by the LRSC. 3.5 Enabling truncation places Finally, the enabling truncation places presented here do not modify the reachability set of the continuous PN system, but they limit its flow at a given marking if time is considered. They can have an effect over the throughput even if SB(p)is integer (case in which the 36 3. Previous transformations of the original discrete system p1 p2 t1 t2 k k q tp1 1 Figure 3.7: Petri net system. Considering k≤q≤2·k, the enabling truncation place drawn in grey colour is implicit as discrete but it can modify the throughput of the continuous system (see Section 7.2.1). marking truncation place would have no effect). Analogously to the marking of a place, a transition tiwill never be fired an amount higher than its structural enabling bound:SEB(ti). The addition of an implicit place tpi is proposed, to truncate the maximal possible firing of the transition to the highest possible integer. Such highest integer corresponds to SEB(ti). Consider the PN in Fig. 3.5 with k= 3,q= 5 and λ= (1,5). The SEB of t1is SEB(t1) = ⌊1.67⌋= 1. Hence, an enabling truncation place tp1with initial marking equal to 1 is added (see place tp1, drawn in grey colour Fig. 3.5). The added place does not modify the LRSCof the PN, but it will have an effect over the behaviour of the TCPN when the system will be fluidified (see Chapter 7). 3.6 Conclusions In this chapter, some basic transformations to be done over a discrete PN system before its fluidization have been proposed. These transformations consider both the structure of the net and its initial marking, and they are based on the addition of some places which are implicit in the discrete system, which cut some vertex (or sets of markings on its surface) of the potential polytope. The aim of most of these techniques is to remove from the state equation the markings which are not reachable by the discrete PN system. Some of those non reachable markings are the solutions of the state equation in which a previously marked trap is empty. A technique to remove those markings was proposed in the literature for discrete PN [STC98], and recalled for discrete PN. Analogously, a technique to avoid markings in which a siphon is emptied has been proposed here. The weakness of this technique is that it does not assure a priori that the removed marking was spurious, it has to be checked in advance. These two techniques can eliminate both integer or non integer 3.6. Conclusions 37 solutions from the state equation. Due to the fact that RSD(N,m0)⊆LRSC(N,m0), if there is a vertex of the state equation in the real numbers which is not natural, this marking is not reachable either. That vertex be also removed from the state equation by the addition of the rational vertex cutting places. A particular case of those markings are those solutions in which the marking of a place pis bigger than its natural structural bound SB(p). These markings can be removed from the state equation by means of the marking truncation places proposed here. Finally, the addition of other implicit places, called enabling truncation places, is proposed which do not alter the set of reachable markings, but they can modify the flow of the continuous PN in some situations. Part II On the fluidization of untimed Petri nets 39 4 Previous concepts on the fluidization of untimed Petri nets “Everything must be made as simple as possible. But not simpler”. Albert Einstein This chapter introduces the concepts related to the fluidization of untimed PN. The formal definition of continuous PN is presented first. Then, basic reachability concepts are introduced, and also some properties of systems which are used in the rest of the document are defined: synchronic properties such as boundedness and other behavioural properties such as deadlock-freeness,liveness,home state and reversibility. 41 48 5. Preservation of homothetic properties by continuous Petri nets Introduction At first glance, the simple way in which the basic definitions of discrete models are extended to continuous ones may make us naively think that their behaviour will be similar. However, the behaviour of the continuous model can be completely different just because the integrality constraint has been dropped. In other words, not all DEDS can be satisfactorily fluidified. Consider, for instance, the net system in Fig. 5.1 (a). If considered as discrete, the system is deadlock-free: from m0= (3, 0), both t2and t1can be fired alternatively, and no deadlock can be reached. However, if considered as continuous, transition t2can be fired in an amount of 1.5from m0, leading to a deadlock marking md= (0, 1.5). 3__2 (a) t1t2 t3 p1 p2 p3 p4p5 2 (b) Figure 5.1: (a) Not homothetically deadlock-free PN system [RTS99] (b) homothetic deadlock-free PN system. Notice that deadlock-freeness of the discrete system in Fig. 5.1 (a) highly depends on its initial marking. In fact, if the initial marking is doubled, i.e., if we consider m′ 0= (6, 0), then the system deadlocks by firing t2an amount of 3. Let us now consider the PN in Fig. 5.1 (b), which exhibits a different behaviour. Considered as discrete, it is deadlock-free for m0= (2, 1, 0, 0, 0). Moreover, it is deadlock-free for any initial marking proportional to m0, i.e., m′ 0=k·m0, with k∈N. When the PN system is fluidified, i.e., the PN system in Fig. 5.1 (b) is considered as a continuous system, it preserves deadlock-freeness. We will exploit this idea to extract conditions for the preservation of properties. The present work explores the kind of features that a discrete net system must exhibit so that a given property is preserved when it is fluidified. It focuses on classical properties as boundedness, B-fairness, deadlock-freeness, liveness and reversibility. The main ideas used here are: (a) the property of homothetic monotonicity of continuous firing sequences (needed for Lemma 5.4); (b) the fact that every real number could be approximated by a rational number (used in Lemma 5.5). Properties preservation is built over these two ideas. Furthermore, homothetic monotonicity of boundedness, B-fairness and deadlock-freeness properties in discrete Petri nets are studied, as well as property preservation for some subclasses. Some 5.1. Preliminary concepts and definitions 49 techniques to improve the fluidization are also considered, where the spurious deadlocks are removed with the addition of some implicit places. This chapter is organized as follows. Section 5.1 introduces some concepts that will be used in the rest of the chapter, such as monotonicity and homothetic monotonicity. Section 5.2 sets the main results concerning homothetic properties in a discrete net system and its relations with the fluid counterpart. In Section 5.3, some results about homothetic boundedness and homothetic B-fairness of discrete PN are presented. Finally, preservation of properties for different net (system) subclasses is studied in Section 5.4 and some conclusions are summarized in Section 5.5. 5.1 Preliminary concepts and definitions Some concepts used in this chapter are defined here. First, let us introduce an additional reachability set to be used in this work, the rational reachability set (RSQ(N,m0)): the set of markings that can be reached from m0considering only firings in the set of rational numbers (Q). We will denote hN,m0iQthe net system in which only rational amounts are fired by the transitions. Definition 5.1 RSQ(N,m0) = {m| ∃ σ=α1tγ1...αktγks.t. m0 α1tγ1 −→ m1··· αktγk −→ mk=mwhere αi∈Q>0,∀i∈ {1..k}}. The most important concept which is considered in this chapter is marking homothetic monotonicity. Here, marking monotonicity and marking homothetic monotonicity are defined below for Π. Along this chapter, let Πrepresent one of the following properties defined in Chapters 2 and 4: boundedness (B), B-fairness (BF), deadlock-freeness (DF), liveness (L) or reversibility (R). In this work, we limit ourselves to the use of those concepts with respect to the marking. I.e., we consider marking monotonicity and marking homothetic monotonicity, in which the initial marking of the PN system is scaled. However, monotonicity with respect to other properties of interest are considered in other works, such as performance monotonicity w.r.t. (with respect to) the firing rates in timed PN systems [MRS09]. Definition 5.2 Monotonicity. Given a system hN,m0iD, a property Πis monotonic w.r.t. m0if: Πholds in hN ,m0iD=⇒Πholds in hN,m′ 0iDfor every m′ 0≥m0. For example, in the PN system in Fig. 5.2, DF is not monotonic for k= 1, because it is deadlock-free for k= 1,k= 3, and k≥5; but it deadlocks for k= 2 and for k= 4. Moreover, it is live for k≥6. Definition 5.3 Homothetic monotonicity. Given a system hN,m0iD, a property Πis homothetically monotonic (for short, homothetic) w.r.t. m0if: Πholds in hN ,m0iD=⇒Πholds in hN, k ·m0iD,∀k∈N+. 50 5. Preservation of homothetic properties by continuous Petri nets 2 63 t2 t3 t1 p1p2 k Figure 5.2: Non monotonic deadlock-free PN system Homothetic monotonicity of DF can be illustrated with the example in Fig. 5.1 (b). The discrete net system is DF for m0= (2,1,0,0,0), and for any proportional initial marking k·m0, i.e., it is homothetically DF. Nevertheless, the system is not monotonically DF for m0, for example, for m′ 0= (2,2,0,0,0) it deadlocks, where m′ 0≥m0. Notice that monotonicity is more restrictive than homothetic monotonicity, i.e., if Πis monotonic then Πis also homothetically monotonic. Some classical results on studying monotonicity of certain properties such as liveness are the rank theorems [STC98], which give necessary or sufficient conditions from the structure of the net (with polynomial complexity), or the siphon-trap property [Bra83], which gives a necessary and sufficient condition for the behavioural property (with higher complexity). 5.2 Homothetic monotonicity and property preservation by fluidization The aim of this section is to set certain conditions that a discrete PN system has to fulfil to preserve a certain property after being fluidified to a continuous PN system. It will be proved that, given a property Πwhich exhibits homothetic monotonicity in hN,m0iD,Π is preserved by fluidization (i.e. in hN,m0iC). We focus on the well-known properties defined in Chapter 4. First, two technical results (Lemmas 5.4 and 5.5) about reachability are presented. 5.2.1 Reachability Based on the definition of hN,m0iQprovided in the previous section, the following lemma states that for any marking mreachable in hN,m0iQ, there exists a k∈Nsuch that a scaled marking k·mis reachable in hN, k ·m0iD. Lemma 5.4 Given a PN structure Nand an initial marking m0∈N,m∈RSQ(N,m0) =⇒ ∃k∈Nsuch that k·m∈RSD(N,k·m0). Proof. Let us suppose m∈RSQ(N,m0), i.e., m0σ −→m, where σ=α1tγ1···αntγn, and αi∈Q,∀i∈ {1···n}. Because each αiis a rational amount, it can be considered as its irreducible fraction: αi=ni di. 5.2. Homothetic monotonicity and property preservation by fluidization 51 We can multiply the rational sequence σby the l.c.m. (least common multiple) of the denominators of the irreducible fractions, to obtain a sequence σ′in the naturals: σ′=k·σ, where k=l.c.m.(di|ni di=αi,∀αi∈σ). It holds α′ i∈Nfor every α′ iin σ′. Because of the properties of the continuous PN (see Proposition 4.5), the initial marking (m0), the firing sequence (σ) and the resulting marking (m) can be scaled by kin the continuous PN: k·m0k·σ −→k·m. Because it is a natural sequence fireable in the continuous PN, σ′=k·σis also fireable from k·m0in the discrete system: k·m0σ′ −→k·m. Now it is proved that, for any marking mreachable with a real firing sequence, another marking m′exists that is reachable with rational firings, such that it is as close to mas desired, and the set of empty places coincide. Lemma 5.5 For every σ=α1tγ1...αitγi, with αj∈R>0,j∈1..i, s.t. m0σ −→m, with m0∈N|P|,m∈RSC(N,m0), and every ε,ε′>0, there exists σ′=α′ 1tγ1...α′ itγis.t. m0σ′ −→m′, with m′∈RSQ(N,m0)such that: • ||m′−m|| < ε and •m′[p] = 0 ⇔m[p] = 0 • ∀j≤i,|α′ j−αj|< ε′ Proof. Given σ=α1tγ1...αitγi, with αj∈R>0,∀j∈ {1..i}such that m0σ −→m; then for any ε, ε′>0, we will build the firing sequence σ′=α′ 1tγ1. . . α′ itγi,α′ j∈Q,∀j∈ {1..i}, such that m0σ′ −→m′. Where ||m′−m|| < ε,|α′ j−αj|< ε′and (m′[p] = 0 ⇔m[p] = 0). It will be proved by induction on the length of the sequence σ:|σ|=i. •Base case (|σ|= 1). Let σ=α1tγ1. Then, a α′ 1∈Q, has to be chosen. The firing of α1tγ1yields m= m0+C[P, tγ1]α1; and the firing of a given α′ 1tγ1yields m′=m0+C[P, tγ1]α′ 1. Subtracting both equations and considering its norm, we obtain ||m′−m|| =||C[P, tγ1] (α′ 1−α1)||. Since all the elements in Care finite numbers, a rational α′ 1∈Qclose enough to α1can be chosen to satisfy ||m′−m|| < ε and |α′ 1−α1|< ε′. Moreover, since m0∈N, if the firing of α1emptied some places, then α1∈Qand α′ 1=α1can be chosen. Otherwise (if no place has been emptied), then α′ 1∈Qas close as desired to α1can be chosen that does not empty places. •Inductive hypothesis (|σ|=i) Given σ=α1tγ1...αitγi, such that m0σ −→mi; there exists σ′=α′ 1tγ1···α′ itγi, such that α′ j∈Q,∀j∈ {1..i}and m0σ′ −→m′ i, where ||m′ i−mi|| < ε,|α′ i−αi|< ε′ and (m′ i[p] = 0 ⇔m[p] = 0). 52 5. Preservation of homothetic properties by continuous Petri nets •Inductive step (|σ|=i+ 1) Let consider the i+ 1 firing. We can distinguish two cases: (a) The firing of αi+1tγi+1 does not empty places in •tγi+1 . Then, it holds that m= mi+C[P, tγi+1 ]αi+1, and m′=m′ i+C[P, tγi+1 ]α′ i+1. Again, subtracting both equations and considering its norm, we obtain ||m′−m||=||(m′ i−mi) + C[P, tγi+1 ] (α′ i+1−αi+1)||. We have to force that ||m−m′|| < ε and |α′ i+1 −αi+1|< ε′. Given that miand m′ ifulfil the inductive hypothesis, the quantity ||m′ i−mi|| can be as small as desired. Moreover, since the elements of the matrix Care finite numbers, a rational α′ i+1 close to αi+1 can be chosen such that ||C[P, tγi+1 ](α′ i+1 −αi+1)|| is as small as desired and no places in •tγi+1 are emptied. (b) The firing of αi+1tγi+1 empties places in •tγi+1 . Then, α′ i+1 =enab(tγi+1 ,m′ i)is chosen, in order to empty the same input places. The amount α′ i+1 is in Q, because m′ i(and hence the enabling degree) is rational. Since miand m′ ifulfil the inductive hypothesis, they can be as close as desired. Thus, the firing of α′ i+1 empties the same places than αi+1, and mi+1 and m′ i+1 can be as close as desired, as well as αi+1 and α′ i+1. Lemmas 5.4 and 5.5, will help to prove some properties related to the preservation of B, BF; and DF, L, and R. 5.2.2 Synchronic properties: boundedness and B-fairness Some properties are included in the general concept of synchronic properties [SC88], which are considered here. For a continuous PN system hN,m0iCin which every transition can be fired (i.e., there are no empty siphons at m0), behavioural and structural synchronic relations coincide, as noticed in [SR02]. Moreover, here it is proved (Propositions 5.6 and 5.7) that in any PN system hN,m0iD, a synchronic property ΠS(boundedness or B-fairness) is equivalent in the homothetic discrete system hN, k ·m0iDand in the continuous PN system hN,m0iC. The corresponding properties in the limit (i.e., with infinite sequences) are considered in Section 5.3. The proof is done for the two synchronic properties defined in Section 4.3. Proposition 5.6 hN,m0iDis homothetically bounded ⇐⇒ hN,m0iCis bounded. Proof. (=⇒) Let us suppose the hN,m0iCis unbounded, i.e., ∀b∈R+∃p∈P∃m∈ RSC(N,m0)s.t. m[p]> b. If mis not in RSQ(N,m0), but m[p]> b, because of Lemma 5.5, ∀ε > 0,∃m′s.t. ||m′−m|| < ε, so we can find another m′∈RSC(N,m0) as near to mas desired, such that also m′[p]> b. And because of Lemma 5.4, if m′∈ RSQ(N,m0), then ∃k∈Ns.t. k·m′∈RSD(N, k ·m0). Hence, in the discrete PN, ∀b∈R+,∃k·m∈RSD(N, k ·m0)s.t. k·m[p]> b. Consequently, ∃k∈Ns.t. the discrete system hN, k ·m0iDis unbounded. 5.2. Homothetic monotonicity and property preservation by fluidization 53 (⇐=) Let us suppose ∃k∈Ns.t. the discrete system hN, k ·m0iDis unbounded. It means ∀b∈R+,∃p∈P∃m∈RSD(N, k·m0) s.t. b < m[p]. If m∈RSD(N, k·m0), then also m∈RSC(N, k·m0). Because of Property 4.5, for each marking m∈RSC(N, k·m0), the marking m′=m kis reachable in hN,m0iC. For every c∈R+s.t. it holds, also for c·k it holds (since it holds for every real): ∃p∈P∃m∈RSD(N, k ·m0) s.t. m[p]> c ·k. Consequently, for every real c, it holds that ∃p∈Ps.t. m[p]> c ·k. And it implies m′[p] = m[p] k> c, where m′[p]∈RSC(N,m0). Hence, hN ,m0iCis unbounded. Using similar arguments, the following result considers B-fairness. Proposition 5.7 hN,m0iDis homothetically B-fair ⇐⇒ hN,m0iCis B-fair. Proof. (=⇒) Let us suppose hN,m0iCis not B-fair, then ∃m∈RSC(N,m0), ∃t, t′s.t. ∀b∈R+,∃σfireable from ms.t. σ(t) = 0 and σ(t′)> b. By Lemma 5.5, if m(or σ) is not in Q, then there exists another m′(or other σ′) in Qwith the properties shown in the lemma. Then, by Lemma 5.4, ∃k∈Ns.t. k·m′∈RSD(N, k ·m0). And, by applying again Lemma 5.4, from k·m′it is also possible to fire σ′′ =k·σ′such that σ′′(t) = 0 and it makes σ′′(t′)> k ·b≥b,∀b∈R+. Consequently, ∃k∈Ns.t. the discrete system hN, k ·m0iDis not B-fair. (⇐=) Let us suppose ∃k∈Ns.t. the discrete system hN, k ·m0iDis not B-fair. It means ∃m∈RSD(N, k ·m0), ∃t, t′s.t. ∀b∈R+,∃σfireable from ms.t. σ(t) = 0 and σ(t′)> b. Due to the fact that m∈RSD(N, k ·m0), then a marking m′=1 kmis reachable in hN,m0iC, from which σ′=σ kcan be fired. It holds that σ′(t)=σ(t) k= 0 and σ′(t′)= σ(t′) k>b k. This reasoning can be done for every b∈R+. Hence, hN,m0iCis not B-fair either. 5.2.3 Deadlock-freeness Some results about the preservation of a homothetic property ΠL(deadlock-freeness, liveness and reversibility) when the system is fluidified are presented in the sequel. The results and their proofs are analogous for deadlock-freeness, liveness and reversibility. For a didactic purpose, in this section the results are explained for DF, and in the following section they are extended to liveness and reversibility. As previously defined, DF in continuous PN only considers the markings that are reachable with finite firing sequences (reachability); while lim-DF considers also infinite firing sequences (lim-reachability). Both concepts will be considered here. A technical result is presented first. It sets that, given a reachable deadlock marking md (the subscript ddenotes deadlock) in RSC(N,m0), either its firing sequence is in Q(so it is in RSQ(N,m0)) or it is in R r Q and then there exists another “close” deadlock that is in Q (also in RSQ(N,m0)). In summary, hN,m0iCis DF if and only if hN ,m0iQis DF. Lemma 5.8 md∈RSC(N,m0)is a deadlock ⇐⇒ ∃m′ d∈RSQ(N,m0)s.t. it is a deadlock. 54 5. Preservation of homothetic properties by continuous Petri nets t1t2 p1p2 2 k Figure 5.3: PN system which deadlocks as discrete for any k. It is deadlock-free as continuous, but it lim-deadlocks (md= (0,0) is lim-reachable). Proof. (=⇒) Assume md∈RSC(N,m0)rRSQ(N,m0). Because of Lemma 5.5, ∀ε > 0 another m′ d∈RSQ(N,m0)exists such that ||m′ d−md|| < ε ∀ps.t. md[p] = 0, also m′ d[p] = 0. Since ∀t∈T,tis not enabled in md, then also ∀t∈T,tis not enabled in m′ d. Hence, ∃m′ d∈RSQ(N,m0)that is a deadlock in the continuous system. (⇐=) It trivially holds: if ∃md∈RSQ(N,m0), then mdis also reachable in RSC(N,m0)and it is also a deadlock. Let us now prove that, if a discrete PN is homothetically DF, it will also be DF as continuous. Proposition 5.9 hN,m0iDis homothetically DF =⇒ hN,m0iCis DF. Proof. Let us suppose hN,m0iCdeadlocks. It means ∃m∈RSC(N,m0)that is a deadlock. Because of Lemma 5.8, if mis a deadlock, then there exists m′∈RSQ(N,m0) that is a deadlock. Because of Lemma 5.4, ∃k∈Ns. t. m′′ =k·m′, where m′′ ∈RSD(N, k ·m0). Since ∀t∈T,∃p∈•t, m′[p] = 0, then also ∀t∈T, ∃p∈•t, k ·m′′[p] = 0, and consequently m′′ it is also deadlock: hN, k ·m0iDdeadlocks. Proposition 5.9 can be illustrated by the example in Fig. 5.1 (b). However, hN,m0iC is DF 6=⇒ hN ,m0iDis homothetically DF; as the PN in Fig. 5.3 shows. The net system is DF when considered as continuous (illustrated in [RTS99]); but hN, k ·m0iDdeadlocks for every kwhen considered as discrete. The previous results deal with DF. What happens if lim-DF is considered? A continuous system which is lim-DF, could be homothetically DF as discrete. When this is not the case, a minimum value of kcan be considered for homothetic monotonicity. We will denote that a property ΠLis homothetic from nif ∃n∈N, s.t. ∀k≥n, with k∈N, ΠLholds in hN, k ·m0iD. Now, the implication can be formulated (in “some sense” it is the inverse of Proposition 5.9). Proposition 5.10 hN ,m0iCis lim-DF =⇒ ∃n∈Ns.t. hN,m0iDis homothetically DF from n. Proof. Let us suppose ∀n∈N∃k≥n,k∈N, such that the discrete system hN, k ·m0iD deadlocks. It means there exists an infinite ordered set A={a1, a2, a3...}, such that ∀ai∈ A,ai< ai+1 and hN, ai·m0iDdeadlocks. For each aifor which it deadlocks, ∃md∈RSD(N, ai·m0) s.t. mdis a deadlock. It holds that ∀t∈T, ∃p∈•t, md[p]< Pre[p, t]. Because of the definitions of continuous firings (Property 4.5), marking md aiis reachable in hN ,m0iC. 5.2. Homothetic monotonicity and property preservation by fluidization 55 Figure 5.4: PN system which is live as discrete for any k·m0, with k∈N+(homothetically deadlock-free). It is deadlock-free as continuous, but not lim-deadlock-free (md= (0,0,0,0,2) is lim-reachable). Given that aitends to infinite, making ai→ ∞, then md ai[p]→0, and it will reach a deadlock in the limit. Consequently, the continuous hN,m0iCis not lim-deadlockfree. However, the reverse is not true (the stated Proposition 5.9 does not hold for lim-DF): hN,m0iDis homothetically DF 6=⇒ hN,m0iCis lim-DF. Given the net system in Fig. 5.4, it is homothetically DF for m0=(1, 0, 0, 0, 0) considered as discrete. Even more, it can be easily proved that the discrete system is fully monotonic DF for m0because every siphon contains a marked trap (see, for example, [Bra83]). However, when the net system is considered as continuous, the infinite firing sequence σ=t1t21 2t31 2t41 2t21 4t31 4t41 4t21 8t3 1 8t4... can be fired, leading to the deadlock marking md= (0,0,0,0,2): the continuous system reaches a deadlock in the limit (as already noticed in [RTS99]). Observe that mdempties the trap and siphon {p1, p2, p3, p4}. Emptying a trap in a continuous net system can only be done considering an infinitely long firing sequence. A trap cannot be emptied in a discrete system, thus mdis a spurious solution in the discrete net system; it is a deadlock, hence it is a killing spurious solution. 5.2.4 Liveness and reversibility The lemmas and properties presented here are analogous to the ones presented for DF (Section 5.2.3); even the proofs are technically analogous. Figure 5.5 summarizes the relations among a certain property ΠL(DF, L or R), when considered in the discrete system (homothetically ΠL), in the continuous system (ΠL) and in the limit (lim-ΠL). Analogously to Lemma 5.8: Lemma 5.11 hN,m0iCis ΠL⇐⇒ hN,m0iQis ΠL. The proof of this lemma when ΠL= L is similar to the one of Lemma 5.8, but instead of considering a marking mdwhich is a deadlock, a marking mlfrom which ∃ts.t. tcannot 56 5. Preservation of homothetic properties by continuous Petri nets N, m0iDis homothetically ΠL hN,m0iCis ΠL hN,m0iCis lim-ΠL ⇒ 6⇒ 6⇒ ⇒ ⇒ 6⇒ Figure 5.5: Relations w.r.t. a property ΠL∈ {DF, L, R}. t1 t2 t3 t4 p1p2p3 22 k Figure 5.6: If k≥2, non reversible, non live discrete PN system. It is reversible and live as continuous. be enabled from mlmust be considered. In the lemma when ΠL= R, a marking mrfrom which the initial marking is not reachable must be considered. Given these lemmas, a general result about preservation of a homothetic property by fluidization can be formulated (similar to Proposition 5.9). Theorem 5.12 hN,m0iDis homothetically ΠL=⇒ hN ,m0iCis ΠL. The proofs of the theorem for liveness (ΠL= L) and for reversibility (ΠL= R) would be similar to the proof of Proposition 5.9. The lemmas obtained from Lemma 5.11 for ΠL= L and ΠL= R would be also used in these proofs. As an illustrative example, consider the Petri net example in Fig. 5.1 (b). It is homothetically live and homothetically reversible. Thus it preserves these properties when fluidified. If the opposite implication is considered, again, even in the case of considering not every kbut a big enough k, the implication is not true: hN,m0iCis ΠL6=⇒ ∃n∈N,hN,m0iDis homothetically ΠLfrom n. Let us consider the example in Fig. 5.6. As continuous, it is live and reversible for m0= (1, 0, 0): the marking can decrease by firing t1and t2, but it can also be increased in the same amount by firing t3and t4. However, if the net system is discrete, it is neither live nor reversible for m0 = (1, 0, 0), for any proportional initial marking k·m0. This is true because for any value of k, transitions t1and t2can be fired until m[p1]<2. Then, no transition is enabled, it is deadlocked and the system is neither live nor reversible. Let us now consider the properties in the limit, i.e., lim-ΠL. In this case, it holds (similar to Proposition 5.10): Theorem 5.13 hN,m0iCis ΠL=⇒ ∃n∈Ns.t.hN,m0iDis homothetically ΠLfrom n. 5.3. Homothetic boundedness and homothetic B-fairness in discrete Petri nets 57 The proofs of Theorem 5.13 for ΠL= L and for ΠL= R would be analogous to that of Proposition 5.10, in which also Lemma 5.4 would be used. Analogously to lim-DF, the reverse is not true: hN,m0iDis homothetically ΠL6=⇒ hN ,m0iCis lim-ΠL. Again, the PN system in Fig. 5.4 is live and reversible for m0=(1, 0, 0, 0, 0) if it is considered as discrete. However, when considered continuous, the infinite firing sequence σ =t1t21 2t31 2t41 2t21 4t31 4t41 4t21 8t31 8t4... would reach the deadlock marking md=(0, 0, 0, 0, 2) in the limit, so the system is not lim-live and not lim-reversible from md. 5.3 Homothetic boundedness and homothetic B-fairness in discrete Petri nets The aim of this brief section is to propose a characterization (necessary and sufficient condition) of homothetic boundedness and homothetic B-fairness for discrete PN systems. By definition, if a net Nis structurally bounded (structurally B-fair), then hN,m0iDis homothetically bounded (homothetically B-fair). However, the opposite is not true: hN,m0iDis homothetically bounded 6⇒ N is structurally bounded. For instance, if there is an empty siphon in hN,m0iD, some transitions can never be fired. Thus, the system can be bounded and homothetically bounded for that m0, but Ncan be unbounded for a different initial marking. Furthermore, if ∄empty siphon in m0(a very reasonable condition for real systems), then every transition can be fired sooner or later from m0or from a given k·m0, and then homothetic boundedness implies structural boundedness. It is analogous when B-fairness is considered. Theorem 5.14 Let Nbe a net system and m0be a marking in which every siphon of the net is marked. The following statements are equivalent: .(1) Nis structurally bounded .(2) hN,m0iDis homothetically bounded .(3) hN,m0iCis bounded .(4) hN,m0iCis lim-bounded Proof. (2) ⇔(3). Because of Proposition 5.6. (1) ⇔(3). Proved in [RTS99]. (3) ⇔(4). Stated in [RTS99]. Theorem 5.15 Let Nbe a net system and m0be a marking in which every siphon of the net is marked. The following statements are equivalent: .(1) Nis structurally B-fair .(2) hN,m0iDis homothetically B-fair .(3) hN,m0iCis B-fair .(4) hN,m0iCis lim-B-fair 6 Complexity analysis of continuous Petri net properties “Complexity is the prodigy of the world. Simplicity is the sensation of the universe. Behind complexity, there is always simplicity to be revealed. Inside simplicity, there is always complexity to be discovered”. Gang Yu An interesting issue in the study of the formalism of continuous Petri nets is its complexity analysis. This chapter continues with the research about the computational complexity, started in other works from the literature, of deciding the most common properties of untimed continuous Petri nets. The considered properties are reachability, boundedness, deadlockfreeness, liveness and reachability set inclusion. Decidability results about properties such as boundedness and reachability set inclusion have been established. Moreover, new decision procedures for reachability and limreachability problems are proposed, with a better computational complexity than the previously known methods. A characterization of reachability set inclusion is proposed. It is an example of a property which is undecidable in discrete PN, and it becomes decidable in the continuous PN formalism. The question of establishing lower bounds for CPN properties had not been considered before. In this chapter, those lower bounds are investigated for reachability, boundedness, deadlock freeness and liveness problems, with the aim of characterizing the exact complexity class. 65 66 6. Complexity analysis of continuous Petri net properties Introduction Given a new formalism, an interesting issue is to establish the decidability and the theoretical computational complexity of checking some of its properties. Because of that reason, the characterization of properties in the context of Continuous Petri nets and the analysis of its computational cost has been considered in some works in the literature. One of the seminal papers in which CPN are formally defined and studied is [RTS99], in which finite reachability is considered, and the concept of lim-reachability is introduced. In that paper, it is established that assuming not empty siphons at m0and consistency of the PN structure N, the reachability space of a CPN is defined by its state equation, and hence it can be obtained in polynomial time. Boundedness property is also determined to be in polynomial time under these assumptions. Concerning the decidability of lim-reachability of general CPN, in [RTS99] it is said: “For the moment, nothing can be said about the complexity of computing the lim-RSCin the general case, not even if it is decidable or not.” Some years later, in [JRS03], the concepts of reachability and lim-reachability are studied again, providing a formal characterization of both concepts, as it is stated: “Reachability and lim-reachability spaces can be fully characterized using, among other elements, the state equation.” Ana¨ ıf implementation of the characterization proposed in [JRS03] would result exponential time decision procedures for reachability and lim-reachability. These procedures are improved in this Chapter, with the aim to obtain a more accurate complexity bounds. Regarding deadlock-freeness and liveness, it was shown in [RHS10] that (lim-)deadlockfreeness and (lim-)liveness belong in coNP. However, no lower bounds had been established before for the complexity of these properties. Table 6.1 summarises the results already known about the complexity of the associated decision problems. From this results, it can be concluded that fluidization reduces the computational complexity of checking some properties w.r.t. discrete PN systems. Moreover, an open issue is if fluidization makes decidable some properties which are undecidable in the discrete formalism. In this work it is proved that reachability set inclusion problem, which is known to be undecidable for discrete systems [EN94], is decidable for continuous ones. Along this chapter, −→ denotes a finite firing sequence, −→∞denotes an infinite one, and −→(∞)denotes a sequence either finite or infinite. The chapter is organized as follows. In Section 6.1, characterizations of reachability and boundedness are developed in an alternative way, with the aim to easy the decision methods. Afterwards in Section 6.2, the decision procedures for reachability, boundeness and reachability set inclusion are designed, and its computational complexity class is determined. Finally, complexity lower bounds are provided in Section 6.3: polynomial time for reachability and boundedness, and coNP for deadlock-freeness, liveness, reversibility and reachability set inclusion. Conclusions and perspectives are summarized in Section 6.4. 6.1. Properties characterizations 67 Table 6.1: Complexity bounds: previous results Problems Upper bounds (lim-)reachability in EXPTIME [JRS03] in PTIME for lim-reachability when all transitions are fireable at least once and the net is consistent [RTS99] (lim-)boundedness in PTIME when all transitions are fireable at least once [RTS99] (lim-)deadlockfreeness in coNP [RHS10] (lim-)liveness in coNP [RHS10] (lim-)reachability no result set inclusion 6.1 Properties characterizations In this section, first some results about reachability of CPN are sumarized in Section 6.1.1. Based on that results, characterization of reachability and lim-reachability is presented. 6.1.1 Preliminary results about reachability and firing sequences Most of the results of this subsection are generalisations of results given in [RTS99; JRS03]. The following lemma is an almost immediate consequence of firing definition and has for corollary the convexity of the (lim-)reachability set. Lemma 6.1 Given a CPN system hN,m0iC, (finite or infinite) sequences σ, σ1, σ2markings m,m′,m1,m2,m′ 1,m′ 2and α, α1, α2∈R>0: (0) m1σ −→m′ 1and m1≤m2implies m2σ −→m′ 2with m′ 1≤m′ 2 (1) mσ −→(∞)miff α·mασ −→(∞)α·m′ (2) mσ −→∞iff α·mασ −→∞ (3) m1σ1 −→(∞)m′ 1and m2σ2 −→(∞)m′ 2implies m1+m2σ1+σ2 −→ (∞)m′ 1+m′ 2 (4) m1σ1 −→∞and m2σ2 −→∞implies m1+m2σ1+σ2 −→ ∞ (5) m1α1σ −→(∞)m′ 1and m2α2σ −→(∞)m′ 2implies m1+m2(α1+α2)σ −→ (∞)m′ 1+m′ 2 (6) m1α1σ −→∞and m2α2σ −→∞implies m1+m2(α1+α2)σ −→ ∞ The two next lemmas constitute a first step for the characterization of reachability since they provide sufficient conditions for reachability and lim-reachability in particular cases. 68 6. Complexity analysis of continuous Petri net properties Lemma 6.2 Let hN,m0iCbe a continuous system, mbe a marking and σ∈RT ≥0be a vector, that fulfill: •m=m0+C·σ; • ∀p∈•kσkm0[p]>0; • ∀p∈ kσk•m[p]>0. Then there exists a finite sequence σsuch that m0σ −→mand its firing count vector is σ. Proof. Define α1 def = min( m0[p] Pt∈kvkP re[p,t]σ[t]|p∈•kσk) and α2 def = min( m[p] Pt∈kvkP ost[p,t]σ[t]|p∈ kσk•)with the convention that α1 def = 1 (resp. α2 def = 1) if •kσk(resp. kσk•) is empty. Due to the second and the third hypotheses α1and α2are positive. Let ndef = max(⌈1 min(α1,α2)⌉,2). Denote kvkdef ={t1,...,tk}and define σ′def =σ[t1] nt1...σ[tk] ntkand σdef =σ′n. Here it is claimed that σis the required firing sequence. Let us denote mi def =m0+i nC·σ. Thus m=mn. By definition of α1and n, in Nm0σ′ −→m1and by definition of α2,mnσ′−1 −→mn−1in N−1. So in Nmn−1σ′ −→mn. Let 1< i < n −1. Using lemma 6.1, n−1−i n−1m0 n−1−i n−1σ′ −→ n−1−i n−1m1and i n−1mn−1 i n−1σ′ −→ i n−1mn. Using lemma 6.1 again and summing, one gets: m=miσ′ −→mi+1. Lemma 6.3 Let hN,m0iCbe a continuous system, mbe a marking and σ∈RT ≥0that fulfill: •m=m0+C·σ; • ∀p∈•kσk•m0[p]>0. Then there exists an infinite sequence σsuch that m0σ −→∞mand its firing count vector is equal to σ. Proof. Let mibe inductively defined by mi+1 =1 2mi+1 2m. and for i≥1, let σi=1 2iσ (thus kσik=kσk). Observe that mi=1 2im0+ (1 −1 2i)m. So: •mi+1 =mi+Cσi; • ∀p∈•kσik•mi[p]>0and mi+1[p]>0. Applying lemma 6.2, for all i≥1there exists σisuch that miσi −→mi+1. Since limi→∞ mi=m, the sequence σ=σ1σ2...is the required sequence. 6.1. Properties characterizations 69 ... p1p2pnpn+1 t1 t′ 1 t2 t′ 2 tn t′ n Figure 6.1: PN system with an exponentially sized firing set. The key concept in order to get characterization of properties, is the notion of firing set of a CPN system [JRS03]. Definition 6.4 Let hN,m0iCbe a CPN system. Then its firing set FSC(N,m0)⊆2Tis defined by: FSC(N,m0) = {kσk | m0σ −→} Due to the empty sequence, ∅ ∈ FSC(N,m0). The size of a firing set may be exponential w.r.t. the number of transitions of the net. For example, consider the CPN system of Fig. 6.1. Its firing set is: {T′| ∀1≤j < i ≤n{ti, t′ i} ∩ T′6=∅ ⇒ {tj, t′ j} 6=∅} Thus its size is at least 2|T| 2. The next two lemmas establish elementary properties of the firing set and leads to new notions. Lemma 6.5 Let Nbe a CPN and m,m′be two markings such that kmk=km′k. Then FSC(N,m0)(N,m) = FSC(N,m′). Proof. Since kmk=km′k, there exists α > 0such that α·m≤m′. Let mσ −→. Using lemma 6.1 α·mασ −→. Since α·m≤m′,m′ασ −→. Thus FSC(N,m)⊆FSC(N,m′). By symmetry, FSC(N,m) = FSC(N,m′). So given P′⊆P, without ambiguity it can be defined FSC(N, P ′)by: FSC(N, P′)def =FSC(N,m)for any msuch that P′=kmk Lemma 6.6 Let hN,m0iCbe a CPN system. Then FSC(N,m0)is closed by union. Proof. Let m0σ −→ and m0σ′ −→. Then using three times lemma 6.1, 0.5m00.5σ −→,0.5m00.5σ′ −→ and m00.5σ+0.5σ′ −→ . Since k0.5σ+ 0.5σ′k=kσk ∪ kσ′k, the conclusion follows. 70 6. Complexity analysis of continuous Petri net properties Notation. It is denoted as max FSC(N,m0)the maximal set of FSC(N,m0)that is the union of all members of FSC(N,m0). The next proposition is a structural characterization for a subset of transitions to belong to the firing set. In addition, it shows that in the positive case, a “useful” corresponding sequence always exists and furthermore one may build this sequence in polynomial time. Proposition 6.7 Let hN,m0iCbe a CPN system and T′be a subset of transitions. Then: T′∈FSC(N,m0)iff NT′has no empty siphon in m0. Furthermore if T′∈FSC(N,m0)then there exists σ=α1t1...αktkwith αi>0for all i, T′={t1,...,tk}and a marking msuch that: •m0σ −→m; •for all place p,m[p]>0iff m0[p]>0or p∈•T′•. Proof. (=⇒) Suppose NT′contains an empty siphon Σin m0. Then none of the transitions belonging Σ•can be fired in the future. Since NT′does not contain isolated places Σ•(= •Σ∪Σ•)6=∅and so T′6∈ FSC(N,m0). (⇐=) Suppose that NT′has no empty siphon in m0. We build by induction the sequence σ of the proposition. More precisely, we inductively prove for increasing values of ithat: •for every j < i there exists a non empty set of transitions Tj⊆T′that fulfill for all j6=j′,Tj∩Tj′=∅; •for every j≤ithere exists a marking mjwith mj[p]>0iff m0[p]>0or p∈•Tk•for some k < j; •for every j < i there exists a sequence σj=αj,1tj,1...αj,kjtj,kjwith Tj={tj,1...tj,kj}and mjσ −→mj+1. There is nothing to prove for the basis case i= 0. Suppose that the assertion holds until i. If T′=T1∪...∪Ti−1then we are done. Otherwise define T′′ =T′\(T1∪...∪Ti−1)and Ti={tenabled in mi|t∈T′′}. It is claimed here that Tiis not empty. Otherwise for all t∈T′′, there exists an empty place ptin mi. Due to the inductive hypothesis, m0(pt) = 0 and •pt∩(T1∪...∪Ti−1) = ∅. So the union of places ptis an empty siphon of hNT′,m0iwhich contradicts our hypothesis. Let us denote Ti={ti,1. . . ti,ki}. Define α= min(mi(p) 2ki|p∈•Ti)with the convention that α= 1 if •Ti=∅. The sequence σi=αti,1...αti,kiis fireable from miand leads to a marking mi+1 fulfilling the inductive hypothesis. Since T′′ is finite the procedure terminates. The complexity result was proved in [JRS03]. Moreover, we include the complexity result below because its proof relies in a straightforward manner on the sufficiency proof of the previous proposition. 6.1. Properties characterizations 71 Algorithm 1: Fireable(hN,m0iC, T ′): status Input: CPN system (hN,m0iC), subset of transitions (T′) Output: the membership status of T′w.r.t. FSC(N,m0) Output: in the negative case the maximal firing set included in T′ Data:new: boolean; P′: subset of places; T′′: subset of transitions 1T′′ =∅;P′=km0k 2while T′′ 6=T′do 3new =false 4for t∈T′\T′′ do 5if •t⊆P′then T′′ =T′′ ∪ {t};P′=P′∪t•;new =true; 6end 7if not new then return (false, T ′′) 8end 9return true Corollary 6.8 Let hN,m0iCbe a CPN system and T′be a subset of transitions. Then Algorithm 1 checks in polynomial time whether T′∈FSC(N,m0)and in the negative case returns the maximal firing set included in T′(when called with T=T′, it returns max FSC(N,m0)). 6.1.2 Characterisation of reachability and boundedness Let us consider the basic (lim-)reachability problem, i.e., given a system hN,m0iCand a real marking m∈R|P|, does it hold m∈(lim -)RSC(N,m0)? A preliminary issue to consider the decidability of this problem is the representation of the input, given that m∈R|P|. It is known that not every real number can be efficiently represented [Wei00]. However, because of the properties of PN, given a marking m∈R|P|, there exists another marking m′∈Q|P|which is as near as desired to m, as proved in Lemma 5.5. Hence, it can be assumed that m∈R|P|is a representable marking without loss of generality (as considered in this work). In [JRS03] a characterization of reachability was presented. The theorem below is an alternative characterization that only relies on the state equation and firing sets. Theorem 6.9 Let hN,m0iCbe a CPN system and mbe a marking. Then m∈RSC(N,m0)iff there exists σ∈R|T| ≥0such that: 1. m=m0+C·σ 2. kσk ∈ FSC(N,m0) 3. kσk ∈ FSC(N−1,m) 72 6. Complexity analysis of continuous Petri net properties Proof. (=⇒) Let m∈RSC(N,m0). So there exists a finite firing sequence σsuch that m0σ −→m. By definition, m=m0+C·σ. Since σis fireable from moin N,kσk ∈ FSC(N,m0). In N−1,mσ−1 −→m0. Since σ=σ−1, kσk ∈ FSC(N−1,m). (⇐=) Since kσk ∈ FSC(N,m0), using Proposition 6.7 and Lemma 6.1 there exists a sequence σ1such that kσk=kσ1k, for all 0< α1≤1,m0α1σ1 −→m1with m1[p]>0for p∈•kσk•. Since kσk ∈ FSC(N−1,m), using Proposition 6.7 and Lemma 6.1 there exists a sequence σ2such that kσk=kσ2k, for all 0< α2≤1,mα2σ2 −→m2in N−1with m2[p]>0for p∈•kσk•. Choose α1and α2enough small such that the vector σ′=σ−α1σ1−α2σ2is non negative and kσ′k=kσk. This is possible since kσk=kσ1k=kσ2k. Since m2=m1+C·σ′and m1,m2fulfill the hypotheses of Lemma 6.2, there exists a sequence σ3such that σ′=σ3and m1σ3 −→m2. Let σ= (α1σ1)σ3(α2σ2)−1then m0σ −→m. The following characterization has been stated in [JRS03]. Theorem 6.10 Let hN,m0iCbe a CPN system and mbe a marking. Then m∈lim-RSC(N,m0)iff there exists σ∈R|T| ≥0such that: 1. m=m0+C·σ 2. kσk ∈ FSC(N,m0) Proof. (=⇒) Let m∈lim-RSC(N,m0). So there exists a firing sequence σ=α1t1. . . αntn... such that m= limn→∞ mn, where mnαn+1tn+1 −→ mn+1. Thus there exists B∈Nsuch that for all p∈Pand all n∈N,mn[p]≤B. Let T′def ={t| ∃i∈Nt=ti}. There exists n0such that T′={t| ∃i≤n0t=ti}and so T′∈FSC(N,m0). Let α∈Q>0such that α≤min(Pi≤n0,ti=tαi|t∈T′). Let us define LPnan existential linear program where σ∈RTis the vector of variables by: 1. mn−m0=C·σ 2. ∀t∈T′,σ[t]≥α 3. ∀t∈T\T′,σ[t] = 0 6.1. Properties characterizations 73 Due to the existence of the firing sequence σ, for all n≥n0LPnadmits a solution. Using linear programming theory (see [PS98]), since mn[p]≤Bfor all n and all p, there exists B′ such that for all n≥n0,LPnadmits a solution σnwhose items are bounded by B′. So the sequence {σn}n≥n0admits a subsequence that converges to some σ. By continuity, σfulfills m−m0=C·σ,∀t∈T′σ[t]≥αand ∀t∈T\T′σ[t] = 0. So kσk=T′and σis the desired vector. (⇐=) Since kσk ∈ FSC(N,m0), using Proposition 6.7 and Lemma 6.1 there exists a sequence σ1such that kσk=kσ1k, for all 0< α1≤1,m0α1σ1 −→m1with m1(p)>0for p∈•kσk•. Choose α1enough small such that the vector σ′=σ−α1σ1is non negative and kσ′k=kσk. This is possible since kσk=kσ1k. Since m=m1+C·σ′and m1fulfills the hypotheses of lemma 6.3, there exists an infinite sequence σ2such that σ′=σ2and m1σ2 −→∞m. Let σ= (α1σ1)σ2then m0σ −→∞m. Using the previous theorem, a short proof is developed to show that iterating the limreachability is useless. Theorem 6.11 Let hN,m0iCbe a CPN system. Then for all m∈lim-RSC(N,m0), lim-RSC(N,m)⊆lim-RSC(N,m0). Proof. Let m′∈lim-RSC(N,m). Due to theorem 6.10, there exists σ,σ′∈R|T| ≥0such that: 1. m=m0+C·σand m′=m+C·σ′ 2. kσk ∈ FSC(N,m0)and kσ′k ∈ FSC(N,m) Thus m′=m0+C·(σ+σ′). Due to proposition 6.7, since kσk ∈ FSC(N,m0)there exists a sequence σand a marking m∗such that m0σ −→m∗and kσk=kσkand km∗k=km0k ∪ •kσk•. Since m=m0+C·σ,kmk ⊆ km∗kand so kσ′k ∈ FSC(N,m∗). Hence kσ+σ′k= kσk∪kσ′k ∈ FSC(N,m0). Using in the other direction the characterization of theorem 6.10 with σ+σ′, one gets m′∈lim-RSC(N,m0). A characterization of boundedness for CPN systems is presented below. Theorem 6.12 Given a CPN system hN ,m0iC. Then hN,m0iCis unbounded iff: There exists σ∈RT ≥0such that C·σ0and kσk ⊆ max FSC(N,m0). Proof. (⇐=) Assume there exists σ∈RT ≥0such that C·σ0and kσk ⊆ max FSC(N,m0). Denote T′def = max FSC(N,m0). Using proposition 6.7, there exists m1∈RSC(N,m0) such that for all p∈•T′•,m1(p)>0. Define m2 def =m1+C·σ, thus m2m1. Since 80 6. Complexity analysis of continuous Petri net properties of gate out is true, it has been proved that the CPN system is unbounded iff the gate out is true. Finally, let mbe defined by m[pout] = 1 and m[p] = 0 for all p6=pout. If the value of gate out is false then pout will never be marked and so mis nor (lim-)reachable. If the value of gate out is true then transition tout can be fired by some small amount say 0< ε ≤1. Then all the other places can be unmarked by transitions cleanpfollowed by a finite number of firings of grow in order to reach m. So mis (lim-)reachable iff the value of gate out is true. (a) (b) Figure 6.2: Reductions of the gates (a) AND and (b) OR to CPN. Figure 6.3: An additional subnet. In order to prove that the lower bounds are robust, the subclass of free-choice PN (see definition in Chapter 2) has been considered. Proposition 6.19 The (lim-)deadlock-freeness and (lim-)liveness problems in free-choice CPN systems are coNP-hard. Proof. We use almost the same reduction from the 3SAT problem as the one proposed for free-choice Petri nets in [DE95]. However the proof of correctness is specific to continuous nets. Let {x1, x2,...,xn}denote the set of propositions and {c1, c2,...,cm}denote the set of clauses. Every clause cjis defined by cj def =litj1∨litj2∨litj3where for all j, k, litjk ∈ {x1,...,xn,¬x1,...,¬xn}. The satisfiability problem consists in the existence of an interpretation ν:{x1, x2,...,xn} −→ {false,true}, such that for all clauses cj, ν(cj) = true. Every proposition xiyields a place biinitially marked with a token (all other places are unmarked) and input of two transitions ti,ficorresponding to the assignment associated with 6.3. Hardness results 81 b1 t1f1 b2 t2f2 b3 t3f3 l11 l12 l21 l22 l23 l31 l32 nc1nc2nc3 suc back Figure 6.4: CPN corresponding to formula (¬x1∨ ¬x3)∧(x1∨ ¬x2∨x3)∧(x2∨ ¬x3). an interpretation. Every of literal litjk yields a place ljk which is the output of transition ti if litjk =xior transition fiif litjk =¬xiEvery clause cjyields a transition ncjwith three input “literal” places corresponding to literals ¬litj1,¬litj2,¬litj3. An additional place suc is the output of every transition ncj. Finally, transition back has suc as a loop place and bi for all ias output places. The reduction is illustrated in Fig. 6.4. Assume that there exists νsuch that for all clause cj,ν(cj) = true. Then fire the following sequence σ= 1t∗ 1...1t∗ nwhere t∗ i=tiwhen ν(xi) = true and t∗ i=fiwhen ν(xi) = false. Consider mthe reached marking. Because ν(cj) = true, at least one input place of ncjis empty in m. Moreover m[suc] = m[bi] = 0 for all i. Hence mis a deadlock. Assume that there does not exist νsuch that for all clause cj,ν(cj) = true. Observe that given a marking msuch that m[suc]>0all transitions will be fireable in the future and suc will never decrease (thus m[suc]>0for a lim-reachable marking mas well). So only reachable markings msuch that m[suc] = 0 are considered, i.e. when no transitions ncjhave been fired. The goal here is to prove that from such marking there is a sequence that produces tokens in suc. Examining the remaining transitions, the following invariants hold. For all atomic proposition xi, and reachable marking m, one has ∀i m[bi] + X ljk∈{xi,¬xi} m[ljk]≥1 ∀j, k, j′, k′litjk =litj′k′⇒m[ljk] = m[lj′k′] 82 6. Complexity analysis of continuous Petri net properties If for some i,m[bi]>0,tiis fired in order to empty bi. Thus the invariants become: ∀iX ljk ∈{xi,¬xi} m[ljk]≥1 ∀j, k, j′, k′litjk =litj′k′⇒m[ljk] = m[lj′k′] Now define νby ν(xi) = true if for some litjk =xi,m[ljk]>0. Due to the hypothesis, there is a clause cjsuch that ν(cj) = false. Due to our choice of νand the invariants, all inputs of ncjare marked. So firing ncjmarks suc. Moreover, it is shown below that even the hypotheses that allow the lim-reachability to belong in NC (i.e.,consistency and absence of initially empty siphons) do not reduce the complexity of other problems. Proposition 6.20 The (lim-)deadlock-freeness, (lim-)liveness and reversibility problems in consistent CPN systems with no initially empty siphons are coNP-hard. Proof. Another reduction from the 3SAT problem is used here, as already described in the proof of proposition 6.19. Every proposition xiyields a place biinitially marked with a token (all other places are unmarked) and input of two transitions: (1) tiwith output place piand, (2) fiwith output place nicorresponding to the assignment associated with an interpretation. Every clause cj yields a transition ncj. Transition ncjhas three loop places corresponding to literals litjk: if litjk =xithen the input is ni, if litjk =¬xithen the input is pi. An additional place suc is the output of transition ncj. A transition nd has suc for input place and no output place. Finally,for every xi, there are transitions tbiand fbiwhich are respectively reverse transitions of tiand fiwith an additional loop over place suc. The reduction is illustrated in Fig. 6.5. The net is consistent with consistency vector: Pi(ti+tbi+fi+fbi) + Pj(ncj+nd). It does not contain an initially empty siphon since every siphon includes some place bi. This proves that every transition can be fired at least once from m0. Assume that there exists νsuch that for all clause cj,ν(cj) = true. Then fire the following sequence σ= 1t∗ 1...1t∗ nwhere t∗ i=tiwhen ν(xi) = true and t∗ i=fiwhen ν(xi) = false. Consider mthe reached marking. Since ν(cj) = true, at least one input place of ncj is empty in m. Moreover m[suc] = m[bi] = 0 for all i. So mis dead and the net is not reversible. Assume that there does not exist νsuch that for all clause cj,ν(cj) = true. Our goal is to prove that from any (lim-)reachable marking there is a sequence that comes back to m0. Since from m0all transitions are fireable at least once this proves that the net is (lim-)live and (lim-)deadlock free. For all atomic proposition xi, and reachable marking m, one has ∀i m[bi] + m[pi] + m[ni] = 1 6.4. Conclusions 83 Since a lim-reachable marking is a limit of reachable markings, this invariant also holds for lim-reachable markings. If for some i,m[bi]>0,tiis fired in order to empty bi. Thus the invariant becomes: ∀i m[pi] + m[ni] = 1 Now define νby ν(xi) = true if m[pi]>0. Due to the hypothesis, there is a clause cjsuch that ν(cj) = false. Due to our choice of νand the invariant, all inputs of ncjare marked. So firing ncjmarks suc. Now fire transitions tbiand fbiin order to empty places piand ni. So m[bi] = 1. Finally, nd is fired in order to empty place suc and it is done. b1 tb1t1f1fb1 p1n1 nc1 b2 tb2t2f2fb2 p2n2 nc2 suc nd Figure 6.5: CPN system corresponding to formula (¬x1∨ ¬x2)∧x2. 6.4 Conclusions In this chapter, decidability and complexity analysis of the properties considered in this thesis has been analysed for continuous Petri nets. The complexity class of most of these properties has been characterized by designing new decision procedures and/or providing reductions to complete problems. It has also been shown that the reachability set inclusion, undecidable for Petri nets, becomes decidable in the continuous framework. This result brings up the fact that the formalism of continuous PN makes decidable some properties which are undecidable in discrete PN. These results are summarised in Table 6.2. 84 6. Complexity analysis of continuous Petri net properties Table 6.2: Complexity bounds Problems Upper and lower bounds (lim-)reachability PTIME-complete in NC for lim-reachability (resp. reachability) when all transitions are fireable at least once (resp. and also in the reverse CPN) and the net is consistent (lim-)boundedness PTIME-complete (lim-)deadlockfreeness coNP-complete and (lim-)liveness coNP-hard even for free-choice CPN or for CPN when all transitions are fireable at least once and the net is consistent (lim-)reachability in EXPTIME set inclusion coNP-hard even for reversibility in CPN when all transitions are fireable at least once and the net is consistent Part III On the fluidization of timed Petri nets 85 7 Previous concepts on the fluidization of timed Petri nets “You may delay, but time will not”. Benjamin Franklin In this chapter, fluidization of PN with a time interpretation associated to the firing of transitions is considered. Among the different time interpretations which have been proposed in the literature, timed continuous PN under infinite server semantics, which is a frequently used semantics, is defined and studied. Then, the approximation of the behaviour of discrete PN with time such as stochastic PN is considered. Finally, we show that the previous transformation (addition of implicit places) of the original discrete system proposed in Chapter 3 provides a better approximation of the original discrete system when fluidified. 87 88 7. Previous concepts on the fluidization of timed Petri nets Introduction By introducing time to the untimed PN, timed PN are obtained. This chapter introduces the basic concepts about continuous PN with a time interpretation. Among the different firing semantics, the focus is on infinite server semantics (in Section 7.1, which has been proved to provide a better approximation to discrete systems under some usual conditions. Moreover, the fluidization of the Stochastic Petri Nets (SPN) defined in Chapter 2 is considered. Specifically, the approximation of the steady state throughput of discrete stochastic PN by timed continuous PN is studied. Section 7.2 illustrates that the preliminary transformations of the original discrete system proposed in Chapter 3 provide a better approximation to the original discrete system when fluidified. 7.1 Timed continuous Petri nets under infinite servers semantics When a timed interpretation is introduced to the autonomous model, the firing of transitions depends explicitly on time. And, consequently, the state equation of the system does also depend on time: m(τ) = m0+C·σ(τ)(7.1) This equation can be derived with respect to time: ˙ m(τ) = C·˙ σ(τ)(7.2) The derivative of the firing sequence is denoted as the (firing) flow, i.e. f(τ) = ˙ σ(τ)(7.3) And, hence, equation 7.2 is rewritten as follows, which is the equation describing the dynamics of the timed system: ˙ m(τ) = C·f(τ).(7.4) In TCPN, a firing rate λjis associated to each transition tj. And depending of the definition of the flow fwe deal with Timed Continuous Petri Nets (TCPN) under different firing semantics. In this work, TCPN under Infinite Server Semantics (ISS) is considered. Other firings semantics from the literature are finite servers semantics and product semantics.Finite servers semantics, considered in [AD98], distinguishes among strongly enabledness and weak enabledness. Moreover, product semantics [SR02] is obtained through decolouration of coloured nets, in which the minimum operator of ISS is replaced by a product. In infinite server semantics, the flow a transition is proportional to its firing rate and to its enabling degree. The flow of a transition tiat a marking mis defined as follows: f[ti] = λ[ti]·enab(ti,m) = λ[ti]·min pj∈•ti m[pj] Pre[pj, ti],(7.5) 7.1. Timed continuous Petri nets under infinite servers semantics 89 The resulting dynamical system is a piecewise linear system in which switches occur due to the minimum operators. The TCPN system is defined as a net structure N, an initial marking m0and a vector of firing rates λ: Definition 7.1 A TCPN system is a tuple hN,m0,λiCwhere Nis the structure, m0∈R|P| ≥0 is the initial marking and λ∈R| ≥0T|is the vector of firing rates. It has been proved in the literature that TCPN under ISS have the capability to simulate Turing machines [RHS10]. As a consequence, they have an big expressive power, and certain important properties become undecidable (for example, marking coverability, submarking reachability or the existence of a steady-state). If the TCPN converges to a steady state (it is not the case in all TCPN systems, see for example [Jim+04]), then the throughput of a transition tiis equal to its flow fi, and it is denoted as χT CP N (ti). From equations (7.4) and (7.5), ˙m=C·fss = 0 is obtained, where fss is the flow vector of the timed system at the steady state, i.e., fss = limτ→∞ f(τ). The definitions of deadlock-freeness and liveness of untimed CPN are directly extended to TCPN, defined over the flow of the system at its steady state: Definition 7.2 Let hN,λ,m0iCbe a timed continuous PN system and fss be the flow at its steady state. • hN,λ,m0iCis timed-deadlock-free if fss 6=0; • hN,λ,m0iCis timed-live if fss >0; • hN,λiis structurally timed-live if ∃m0such that hN,λ,m0iis timed-live. The firing rate vector imposes some constrains can be imposed over the evolution of the system. For example, a property which is not satisfied in the untimed system (for example, deadlock-freeness) can be satisfied by the time system for a specific combination of λ. For example, the PN system in Fig. 2.1(b) is deadlock-free if a firing vector λis chosen in which λ1=λ2, although it deadlocks as an untimed system. 7.1.1 The concept of configuration The dynamics of the TCPN under ISS is described as a piecewise linear system, due to the min operator which appears in (7.5). Three related concepts are derived from it, which are relevant in the understanding of the behaviour of TCPN: Definition 7.3 . •A configuration Ck. It is the set of places defining the enabling degree of the transitions. It is defined as a set of pairs (p, t)covering every transition. 8 The “bound reaching problem” “The only reason for time is so that everything doesn’t happen at once”. Albert Einstein This chapter deals with the basic operation of fluidization of timed Petri nets. More precisely, the “bound reaching problem” is identified, which is an interesting problem which may appear when “relatively small” populations are considered. This problem points out the differences between discrete and continuous behaviour that appear when the probability of a transition to be enabled is low in the discrete case. The “bound reaching problem” refers to the situation in which the enabling bound of a transition is equal to 1. Among the different concerns related to this problem, the approximation of the throughput of discrete Markovian PN by Timed Continuous PN under infinite server semanticsis considered. An approach denoted ρ-semantics based in infinite servers semantics is proposed to tackle this problem and it is compared with other methods. 97 98 8. The “bound reaching problem” Introduction This chapter identifies a certain situation in which the fluidization of timed systems might be not accurate. As it occurs for untimed PN, the behaviour of the timed continuous model can be completely different just because the integrality constraint has been dropped. Some works have been proposed to improve the accuracy of the original fluid approximation, such as [VS12], [LL12]. When the population of the system is large, the continuous PN system often approximates adequately the behaviour of the discrete one (see Section 7.2.2). Unfortunately, this is not the case in systems in which the population is “relatively small” in a part of the system. The technique presented here is specially interesting when the population is “relatively” small in some parts of the system (if a place has a large population, but also a big amount of tokens is required for its output transition, it can be said that it is “relatively small”). We are considering neither very small populations (in which fluidization is not needed) nor very large ones (in which fluidization usually provides a good approximation of the original PN). This chapter focuses on the approximation of timed discrete PN by means of continuous PN in the cases in which the maximum marking of a place is equal to the weight of one of its output arcs. It is what is called here as the Bound Reaching Problem (BRP). The BRP is a challenging problem that appears in many practical cases. It can arise in systems in which very low and very large populations are combined. In particular, it also appears when inhibitor arcs of a bounded system are removed and simulated with regular arcs and places, because the complementary place that is added presents exactly this problem: its marking bound is equal to the weight of at least one of its output arcs. Among the different concerns related to the BRP, we will concentrate on the approximation of the mean throughput of a stochastic PN system by its continuous counterpart. The rest of the chapter is organized as follows. Section 8.1 introduces the bound reaching problem. In Section 8.2, the BRP is considered for transitions which a unique input place (i.e., transitions which are not joins). Two preliminary approaches to address it are considered. Then, a continuous approach to tackle the bound reaching problem is proposed, which is a macro structure of immediate and ISS transitions, whose behaviour is compacted and denoted as ρ-semantics. It is applied to two examples. The ρ-semantics is generalized to join transitions in Section 8.3, and it is applied to other two examples. Conclusions are shown in Section 8.4. 8.1 The Bound Reaching Problem The bound reaching problem studies a particular situation in which the continuous approximation does not approximate correctly the behaviour of the discrete PN. As previously pointed (Section 7.2.2), TCPN approximate reasonably well the behaviour of SPN when the populations are relatively large. However, when “relatively small” populations are also considered it is not the case. 8.1. The Bound Reaching Problem 99 Table 8.1: χ(t1)in the PN in Fig. 8.1, with λ= (10,1,1); considered as SPN and as TCPN. Meth k = 1 k = 2 k = 3 k = 4 k = 5 k = 6 k = 7 k = 8 k = 9 k = 10 SPN 0.833 0.417 0.242 0.144 0.085 0.049 0.028 0.016 0.008 0.005 TCPN 0.833 0.833 0.833 0.833 0.833 0.833 0.833 0.833 0.833 0.833 This lack of accuracy is related to the fact that synchronizations are strongly relaxed when the net is fluidified. Consider a transition tand a place psuch that •t={p}, P re[p, t] = k (for example, t1and p1in Fig. 8.2(a)). Considered as a discrete system, tis only enabled when m[p]≥k, and the probability of that transition to be enabled can be low. However, as continuous, tis enabled for any positive amount of tokens m[p]>0, regardless of the arc weight k. An extreme case occurs when the maximum possible amount of tokens in pis equal to k. Then, this place pneeds to “reach its bound” in order to enable transition t. This lack of accuracy and the search of alternative fluid schemes to improve it is what we call the BRP. We identify that a transition tin a system hN,m0iDsuffers from the BRP when its structural enabling bound is equal to 1. We do not consider the case in which it is smaller than 1, because in that case tcan never be fired in the discrete model, so it can be removed) A transition tiin hN ,m0iDis said to suffer from the BRP if its structural enabling bound is equal to 1 (if it is smaller than 1, tinever can be fired in the discrete model, so it can be removed). Let us define the set of transitions which suffer from the bound reaching problem as Bound Reaching Transition Set (BRT S), based in the structural enabling bound defined in Chapter 2. BRT S ={t|SEB(t) = 1}(8.1) p1 p2 t1 t2 t3 k k k Figure 8.1: PN system in which transition t1suffers from the BRP. Consider the PN example in Fig. 8.1 as a discrete system. Apparently, it has four parameters (λ1,λ2,λ3and k). However, one of the firing rates can be fixed (here, λ2= 1), which seen just as a time scale: only three parameters can be considered, without lost of generality. In this example, the BRP appears in t1. Considered as discrete, transitions t1and 100 8. The “bound reaching problem” t3are enabled at m0= (k, 0). Suppose t1is fired first. Then, all the tokens are moved to p2, and only t2is enabled. After one or more firings of t2, transitions t2,t3are enabled an can fired. Transition t3is enabled when m[p1]≥1. However, t1can only fire when m[p1] = k. Consequently, transition t1is not fired very often and its throughput is low. Moreover, if kgrows, then the probability of having ktokens in p1decreases, and hence the steady state throughput χSP N (t1)of the SPN decreases. It can be seen in Table 8.1, in which the steady state throughput of t1for different values of kis shown in the first row for SPN. The steady state throughput also depends on the ratio among the firing rates λi. Assuming λ2a scale constant, χSP N (t1)increases monotonically with λ1, and χSP N (t1) decreases when λ3increases (see the obtained χSP N (t1)for different combinations of them in next paragraph). Consider the PN example in Fig. 8.1. Transition t1∈BRT S, in fact ∀m∈ RSD(N,m0),enab(t1,m)≤1. Moreover, the BRP described here can be more relevant depending on the firing rates of the transitions. Let us see with some examples the evolution of χSP N (t1). Let us fix λ2= 1. Tables 8.2, 8.3 and 8.4 show the calculated χSP N (t1)for different values of λ1, λ3and k, which complement the results in Table 8.1. Table 8.2: χSP N (t1)of the SPN in Fig. 8.1, with k= 4,λ2= 1, for different values of λ1 and λ3. λ10.1 1 10 λ3= 0.1 0.0591 0.2666 0.4111 λ3= 1 0.0060 0.0468 0.1442 λ3= 10 0.0000 0.0000 0.0005 Table 8.3: χSP N (t1)of the SPN in Fig. 8.1, with λ1= 1,λ2= 1, for different values of λ3 and k.k248 λ3= 0.1 0.3623 0.2666 0.1822 λ3= 1 0.1666 0.0468 0.0033 λ3= 10 0.0078 0.0000 0.0000 However, in the case of the TCPN, χT CP N (t1)is independent of k, as it can be seen in the second row in Table 8.1. The schema of this example is important in practice. It appears when an inhibitor arc is removed by the system with the addition of a complementary place which usually has this structure. 8.2. The ρ-semantics for transitions with one input place 101 Table 8.4: χSP N (t1)of the SPN in Fig. 8.1, with λ2= 1,λ3= 1, for different values of λ1 and k.k248 λ1= 0.1 0.0238 0.0060 0.0004 λ1= 1 0.1666 0.0468 0.0033 λ1= 10 0.4166 0.1442 0.0154 8.2 The ρ-semantics for transitions with one input place In order to tackle the BRP, we will start with the the simple but representative example in Fig. 8.2(a), in which p1has only one output transition, |p1•|= 1. In other words, transition t3 is dropped from Fig. 8.1. p1 p2 t1 t2 k k k (a) p1 p2 t1 t2 k q q (b) Figure 8.2: (a) SPN system in which t1suffers from the BRP, its firing rates are λ= (10,1). (b) Hybrid PN system in which t1is discrete (black transition) and t2is continuous, arc weights are modified to q. Consider the PN in Fig. 8.2(a) as a discrete PN. In the steady state, the total cycle time Θ from m0= (k, 0) is the addition of the average time to fire t1from m0(which happens with a mean value of 1 λ1), the mean time to fire t2when m[p2] = k(which is 1 k·λ2), the one when m[p2] = k−1(which is 1 (k−1)·λ2), etc. Thus, the average cycle time is Θ = 1 λ1+1 λ2·Pk i=1 1 i. The mean throughput of t1is equal to 1 Θ(see row “SPN” in Table 8.5): χSP N (t1) = λ1·λ2 λ1·Pk i=1 1 i+λ2 =λ2·1 Pk i=1 1 i+λ2 λ1 (8.2) Considered as TCPN, t1is enabled for any marking m[p1]>0. Moreover, the firing of t1, and hence the behaviour of the system, is not modified by k. The throughput of t1as TCPN is time homothetic (i.e., its steady state flow is proportional to λ), and it is equal to: χT CP N (t1) = λ2/(1 + λ2 λ1). 102 8. The “bound reaching problem” Table 8.5: χ(t1)in the PN in Fig. 8.2(a), with λ= (10,1), for different methods. Method k = 1 k = 2 k = 3 k = 4 k = 5 ... k=10 k=50 k=100 SPN 0.909 0.625 0.517 0.458 0.420 ... 0.330 0.217 0.189 TCPN 0.909 0.909 0.909 0.909 0.909 ... 0.909 0.909 0.909 Meth1 0.909 0.729 0.607 0.522 0.459 ... 0.296 0.090 0.051 Meth2, 2τ0.545 0.545 0.545 0.545 0.545 ... 0.545 0.545 0.545 Meth2, 2τ0.475 0.475 0.475 0.475 0.475 ... 0.475 0.475 0.475 Meth2, 3τ0.324 0.324 0.324 0.324 0.324 ... 0.324 0.324 0.324 Considering λ= (10,1),χT CP N (t1) = 0.909 for any value of k. The continuous throughput coincides with the discrete one for k= 1, but it provides a bad approximation for k > 1(see Table 8.5), which gets worse when kgrows. This difference among continuous and discrete PN is the root of the problem. 8.2.1 First approaches to the Bound Reaching Problem After identifying the BRP, our aim is to find methods or techniques to approach it, i.e., to fluidify the net system to obtain a good approximation to the original discrete one. These techniques can range from fully continuous to hybrid. Let us describe two very basic methods which can be used to approach the BRP. The first one is a continuous approximation with a firing semantics different from the usual ISS. The second one is a hybrid PN in which the transitions are continuous or discrete, but some arc weights must be modified. These methods are also described in [ZS10]. They will be compared with the ρ-semantics proposed in this Section. •(Meth1)Ad hoc continuous flow estimation. It is based on the heuristic idea that the k tokens are considered to be independent. The probability of m[p1] = 1 in the discrete system is “considered” to be m[p1] k, while the probability of m[p1] = kwould be (m[p1] k)k. Based on this heuristic reasoning, a marking-dependent flow approximation for transition t1can be defined as follows: f(t1) = λ1·m[p1] kk (8.3) With this semantics, the enabling degree of t1is not linear (see Fig. 8.5(b)). The flow given by this technique has the advantages of getting continuous fully differentiable models. However, with this semantics, some properties of ISS are lost, for example the flow evolution is not marking homothetic (given fthe flow in hN,m0,λi, the one in hN, k ·m0,λiis not k·f). A drawback of this approach is that although it provides a reasonable approximation of the SPN throughput for small (see kbetween 1 and 5 in Table 8.5), it is not so good 8.2. The ρ-semantics for transitions with one input place 103 for high values of k(see k=50 or k=100 in Table 8.5). •(Meth2) Hybrid (with scaled arc weights). Let us consider that every transition is continuous except the transition in BRT S, which is discrete. A hybrid PN (HPN) is obtained. Consider the PN system in Fig. 8.2(a), then t1is considered as discrete and t2as continuous). Transition t1can be fired from m0. However, filling again place p1up to capacity k“lasts forever”, so t1can never be enabled again after the first firing. A modification of the arc weights is needed to allow the firing of t1. The filling of p1is like a basic first order time invariant linear system (for example, it corresponds to the loading of a capacitor in a basic electrical RC-circuit). It is a classical result that the 63.2% of kis reached at time τ=RC (and 86.7%, 95% are reached at time 2τ,3τ, respectively). Using this idea, the weight of the input and output arcs of t1(Fig. 8.2(b)) are modified. And the resulting throughputs of t1, which is independent of k, are the following (also shown in Table 8.5): –For τ,q= 0.632 ·k, and χHP N (t1) = 0.545. –For 2τ,q= 0.867 ·k, and χHP N (t1) = 0.475. –For 3τ,q= 0.95 ·k, and χHP N (t1) = 0.324. A characteristic of this approach is the fact that the flow is discontinuous, being a hybrid net in the classical sense. Notice that the estimation of the steady state throughput is independent of k, but nevertheless very sensible to the choice among τ,2τand 3τ. 0k 1 enab(t1) m[p1] (a) 0k 1 enab(t1) m[p1] (b) 0k' k 1 enab(t1) m[p1] (c) Figure 8.3: Enabling degree of transition t1in Fig. 8.2 with different semantics: (a) TCPN under ISS; (b) Meth1; (c) Meth2. (a) and (b) are continuous and differentiable, (c) is discontinuous, a hybrid net in the classical sense. 104 8. The “bound reaching problem” These two approaches are interesting, but just a first approach to the BRP. Hence, different techniques should be investigated. In the following subsections, a new semantics for transitions is proposed to approach the BRP, denoted as ρ-semantics. The preliminary idea which inspires this semantics is to try to simulate the “wait until there are enough tokens to fire” of the discrete net. This behaviour can be obtained with timed and immediate transitions and some additional places (Section 8.2.2). An immediate transitions which has some tokens in its input places, fires “immediatelly” (in 0 time units). Then, the desired behaviour is obtained by the definition of the new firing semantics for the transition, as explained in Subsection 8.2.3. 8.2.2 Simulating discrete behaviour with immediate transitions Considering the PN in Fig. 8.2(a), a key difference between the behaviour of the SPN and the TCPN is that in the SPN, t1can fire only when the ktokens are in p1; while in the continuous case, it is not needed to “wait until the ktokens” are in p1to fire t1. p′ 1p2 papb t′ 1 t2 timm k k k-ρ k-ρ k-ρ ρ Figure 8.4: Transformation of the PN in Fig. 8.2(a). The white transitions are continuous under ISS, while the thin black transition is an immediate transition. This is the idea exploited in this approach: to simulate the “wait” of t1until it has ktokens. As explained, waiting until p1has ktokens would last infinite time in a TCPN. Hence, it has no sense to wait until k, but until some other smaller value, such as k−ρ(where ρcomes from “the rest”). This behaviour can be obtained by transforming p1,t1(see Fig. 8.2(a)) to a subnet composed of p′ 1,t′ 1,pa,pb,timm (see Fig. 8.4), such that t′ 1is not enabled for “the first” k-ρtokens, and it is enabled for higher amounts. Immediate transitions are difficult to handle in TCPN [RMS06]. A first approximation can be to consider immediate transitions as timed transitions which are several orders of magnitude faster than the other transitions (for example, λimm = 10000 in the TCPN in Fig. 8.4). However, this has some disadvantages: If λimm is relatively not very high, then the steady state might not be the desired one (because for large populations, timm could be part of the bottleneck); while for very high values of λimm,stiffness problems can appear. 8.2. The ρ-semantics for transitions with one input place 105 8.2.3 Defining the ρ-semantics In this concrete construction, we can abstract the structure given by p′ 1,t′ 1,pa,pb,timm by a unique transition with a new semantics, which compacts the desired behaviour. Let us detail the marking of the new structure (places p′ 1,pa,pb) and the enabling degree of t′ 1, with respect to the possible marking of p1in the original net, i.e., m[p1]: •m[p1]≤k−ρ. Then transition timm is enabled, the marking is moved immediately to pband there is no remaining token at p′ 1. Hence, m[p′ 1] = 0,m[pa] = k−ρ−m[p1], m[pb] = m[p1]and enab(t′ 1) = 0. •k−ρ < m[p1]≤k. Then pais empty, transition timm is disabled, and there is some remaining token at p′ 1. Hence, m[pa] = 0,m[pb] = k−ρ,m[p′ 1] = m[p1]−(k−ρ) and enab(t′ 1) = min{m[pb] k−ρ,m[p′ 1] ρ}=m[p′ 1] ρ=m[p1]−(k−ρ) ρ. The difference between the enabling of t1and t′ 1is depicted in Fig. 8.3(a) and Fig. 8.5: t1is enabled for m[p1]>0, but t′ 1is enabled for m[p1]> k −ρ. The new transition t′ 1has a specific firing semantics, different from ISS (f1=λ1· enab(t1)), obtained from λ1·enab(t′ 1). The flow of a transition t1under the ρ-semantics is given by the following formula: f1=(0if m[p1]≤Pre[p1, t1]−ρ λ1·m[p1]−(P re[p1,t1]−ρ) ρotherwise (8.4) The transient flow of t1is still a continuous function, but it is piecewise defined, introducing certain “hybridization” in the behaviour of the transition. The computation done by this approach is local t1and it is simple and fast to calculate. The evolution of the flow of transition t1in Fig. 8.2(a) with the ρ-semantics is illustrated in Fig. 8.6, where it is compared with the transient flow of ISS. 0k-ρ k 1 enab(t1) m[p1] Figure 8.5: Enabling degree of transition t1in Fig. 8.2(a) with the ρ-semantics. Certain “hybrid” behaviour is obtained in the firing of the transition, the flow is a piecewise function. 8.2.4 Selection of an appropriate ρ With the proposed ρ-semantics, the throughput of the system can be “tuned” from 0 (when ρ∼0) to the throughput of the TCPN (when ρis equal to P re[p1, t1]). 112 8. The “bound reaching problem” (a) (b) Figure 8.12: Without the grey places, PN system with two different initial markings: (a) m0= (2,0,0,0,0,0) and (b) m′ 0= (3,0,0,0,2,0). The representative place r1is added for transition t1in each discrete PN system. For transitions in Class 3 (see Section 2.2.1), rihas been obtained as C[ri, T ] = C[π, T ] + Pp∈{•ti\π}SB(π)·C[p, T ]then ρiis obtained as follows: ρi=ρ(P re[π, ti]) + SB(π)·X p∈{•ti\π} ρ(P re[p, ti]) = Pre[π, ti] PP re[π,ti] n=1 1 n +SB(π)·X p∈{•ti\π} Pre[p, ti] PP re[p,ti] n=1 1 n .(8.12) Once determined the value of ρi, the flow of the transition defined in equation (8.4), can be generalized to join transitions, in which a term analogous to the one in (8.4) is used for the representative place, and ISS is used for the rest of the places in •ti: fi=λi·(0if m[ri]≤P re[ri, ti]−ρi min{m[ri]−(P re[ri,ti]−ρi) ρi, min p∈•ti {m[p] P re[p,ti]}} otherwise (8.13) Table 8.9: χ(t1)of the PN in Fig. 8.12, with λ= (10,1,1,1,1). Method χ(t1), with χ(t1), with m0= (2,0,0,0,0) m′ 0= (3,0,0,2,0) SPN 0.193 0.396 TCPN 0.244 0.484 ρ-semantics 0.195 0.410 8.3. Generalization of the ρ-semantics to join transitions 113 Example 8.3 Consider transition t1in the PN in Fig.8.12(a). Transitions t2,t3,t4and t5 have a unique input place, hence In this case, •t1={p1, p2}, so |•t1|>1and the ρsemantics cannot be directly applied. The first step is add the representative place r1which represents the marking of the input places of t1(see Section 2.2.3). Then, the value of ρ1 can be obtained from equation (8.11). The ρ-semantics proposed in equation (8.13) can be applied to t1. In an analogous way, the ρ-semantics is applied to the PN in Fig.8.12(b), using equation (8.12) for the value of ρ1. Considering λ= (10,1,1,1,1) and m0(see first column in Table 8.9), the ρ-semantics (χρ(t1) = 0.195) gives a better approximation than the TCPN (χT CP N (t1) = 0.244) to the original SPN (χSP N (t1) = 0.193). In this case, if (8.10) instead of (8.11) would be used, a throughput value 0.121 would be obtained, which is not so accurate. Also for m′ 0 the approximation given by the ρ-semantics is better than the TCPN (see second column in Table 8.9). If equation (8.10) would be used, a throughput equal to 0.309 would be obtained, which is not accurate either. 8.3.2 Case study In this section, a case study is considered, in which the BRP appears in a join transition. A representative place is added to the system and ρ-semantics is applied. Example 8.4 A manufacturing system Consider now the PN in Fig. 8.13, the model of a manufacturing system in which tables are assembled. Consider λ= (10,10,10,1,1,1,10,1). The BRP appears in t7. A representative place r7is added. In this case, SB(p7) = Pre[p7, t7]. The implicit place r7is built as C[r7, T ] = SB(p8)·C[p7, T ] + C[p8, T ], as explained in Section 2.2.3. The throughput of the output transition for the different methods is presented in table 8.10. In Meth2, transition t8is the one considered as discrete. λ= (20,4,4,1,1,5,5,1,1) and λ′= (10,10,10,1,1,1,10,1). Table 8.10: Steady state throughput of t8of the PN in Fig. 8.13 (Example 8.4). Comparative of different methods. Method χ(t8),λχ(t8),λ′ SPN 0.388 0.356 TCPN 0.443 0.453 Meth1 0.349 0.349 Meth2, 2τ0.310 0.325 Meth2, 3τ0.264 0.244 ρ-semantics 0.383 0.370 114 8. The “bound reaching problem” 1 1 p1 p2 p3 p4 p5 p6 p7 p8 p9 t1 t2 t3 t4 t5 t6 t7t8 2 2 2 2 4 4 (a) 1 59 1 p1 p2 p3 p4 p5 p6 p7 p8 p9 t1 t2 t3 t4 t5 t6 t7t8 r7 2 2 2 2 2 4 4 (b) Figure 8.13: Example 8.4. (a) PN system which models a manufacturing system which assembles tables (derived from [RS01]). (b) Implicit place drawn in grey colour has been added. 8.4 Conclusions This chapter deals with a challenging problem which appears in the fludization of discrete PN with a localized part of not very large populations, which is denoted bound reaching problem: although the steady state throughput of a SPN system with large populations is well approximated by its TCPN counterpart, it is not the case for small populations. It is due to the relaxation of the integrality constraints of the original PN, which is specially relevant when the marking bound of a place coincides with the weight of one of its output arcs. Different approaches for the (partial) fluidization of this kind of systems have been described. In particular, a new semantics has been proposed, the ρ-semantics, in which the transition suffering the BRP is enabled only if it has a certain amount of tokens in its input 8.4. Conclusions 115 place. The ρ-semantics is discussed, and it is compared with the other methods. We are conscious of the fact that this is a first and partially heuristic consideration of a difficult problem that is essential to improve the quality of fluid approximation of discrete event systems. Moreover, the ρ-semantics has been generalized to more general schemas, adapting the semantics to transitions with several input places (rendez-vous or join). This generalization takes advantage of a technique developed for discrete system, the linear enabling functions, which are implemented by the addition of certain representative places. Part IV Hybrid adaptive Petri nets 117 9 Hybrid adaptive Petri nets: definition and deadlock-freeness preservation “It is not the strongest or the most intelligent who will survive but those who can best manage change”. Charles Darwin (paraphrased by Leon C. Megginson) This chapter studies the Hybrid Adaptive Petri Nets (HAPN), presented in the literature for timed systems, and considered here as an untimed formalism. These HAPN combine discrete and continuous behaviour from the discrete and continuous Petri nets. They attempt to partially fluidify discrete PN model in order to maintain its relevant properties. In HAPN, the partition between continuous and discrete transitions is not static but dynamic: each transition of a HAPN can behave as discrete or as continuous depending on its load, i.e., on its enabling degree. An adaptive transition has two different modes: continuous and discrete, continuous mode for high transition load (in this case, enabling degree higher than a given threshold) and discrete in other case. In most engineering problems, the higher the workload the better the continuous approximation. Consequently, it makes sense to commute to a discrete mode when the load becomes low. The HAPN formalism provides a common framework that includes three well known formalisms: discrete, continuous and hybrid PN. Thus, the modelling power of HAPN subsumes the modelling power of the other formalisms, and any analysis technique applicable to HAPN can also be applied to the others. It captures in a compact way the fact that the behaviour of a highly loaded system can be approximated by continuous dynamics while the behaviour of a system with low loads usually require explicit discrete dynamics. The HAPN formalism is intended to solve the existing trade-off between the high complexity and accuracy of discrete PN and the low-complexity but potential loss of accuracy associated to continuous PN. Moreover, it allows to preserve some properties of the discrete PN systems that are not directly preserved by continuous ones. 119 120 9. Hybrid adaptive Petri nets: definition and deadlock-freeness preservation Introduction This chapter introduces a Petri net based formalism in which the firing of transitions is partially relaxed, Hybrid Adaptive Petri nets (HAPN). They were proposed for timed PN in [YLL09], and they are reinterpreted here in a untimed context. The transitions of HAPN can behave in two different modes: continuous and discrete. The continuous mode will be chosen when transition workload is higher than a given threshold. It makes sense because the higher the workload the better the continuous approximation. Consequently, it also makes sense to commute to a discrete mode when the load becomes low. This way, a HAPN is able to adapt its behaviour to the net workload; it offers the possibility to represent more faithfully the discrete model and simplifies analysis techniques by behaving as continuous when the load is high. In contrast to [YLL09], HAPN will be defined and studied in the untimed framework. Notice that the introduction of time in a given system would produce a particular system trajectory that is also achievable in the untimed one. Thus, the results for some properties as deadlock-freeness in the untimed framework can be almost straightforwardly applied on timed systems. 3__2 Figure 9.1: A Petri net system that deadlocks as continuous but is deadlock-free as hybrid adaptive with appropriate thresholds. Example 9.1 Let us consider the PN system in Fig. 9.1 [RTS99] to introduce the behaviour of HAPN. Let the initial marking of the system be m0= (5,0). If considered as a discrete system, it is deadlock-free: from the initial marking m0only t2can fire, reaching m1= (3,1). From m1, both m0and m2= (1,2) can be reached by firing t1and t2respectively. This behaviour is represented in the reachability graph and reachability set in Fig. 9.2. None of the reachable markings deadlocks the system, hence it is deadlock-free. Consider now that the system is continuous [JRS03] , i.e., each transition can be fired in any non-negative real amount less than or equal to its enabling degree. Given that at m0 the enabling degree of t2is 2.5,t2can fire in any amount in the interval [0,2.5]. Figure 9.3 shows the reachability set of the continuous PN. The firing of t2in an amount lower than 2.5 produces positive markings in both places and both transitions are enabled. However, the 121 0 1 2 3 4 5 012345 (1,2) (3,1) (5,0) (5,0) (3,1) (1,2) Figure 9.2: Reachability space of the PN in Fig. 9.1 considered as discrete. firing of t2in 2.5from m0leads to (0,2.5) where no transition is enabled and the system deadlocks. Consequently, deadlock-freeness is not preserved by the continuous PN. 0 1 2 3 4 5 012345 (0,2.5) (5,0) (5,0) (0+2ɛ,2.5-ɛ) (0,2.5),ɛ>0 Figure 9.3: Reachability space of the PN in Fig. 9.1 considered as continuous. Let us finally assume that the net system is adaptive. For these systems, a transition ti can have two different firing modes: continuous and discrete. It behaves as continuous when its enabling degree is higher than a given threshold µi. Otherwise, tibehaves as discrete. When a discrete system is considered as adaptive, appropriate thresholds have to be defined. Let us define µ1= 1 for t1and µ2= 1.5for t2for the system of Fig. 9.1. At the initial marking m0= (5,0),t1is not enabled, and t2behaves as continuous, and it can fire in real amounts while it remains continuous. If t2is fired in an amount of 1,m1= (3,1) is reached. At m1, both t1and t2are enabled as discrete. The firing of t1(t2) from m1leads to m0(m2= (1,2)). At m2both transitions are discrete but only t1is enabled, whose firing leads to m1. Hence, although the adaptive system still keeps some continuous behaviour, it 128 9. Hybrid adaptive Petri nets: definition and deadlock-freeness preservation 9.2.1 Hybrid Petri nets with inhibitor arcs In the case of bounded PN, the behaviour of the HAPN can obtained with Hybrid Petri nets with inhibitor arcs, which are defined below. Definition 9.6 A HPN with inhibitor arcs (HPNin) is a tuple N=hP, T, Pre, Post, Iiwhere Pis the set of places, T=Tc∪Tdis the set of continuous and discrete transitions, P re and Post indicates the arcs of the net, and Iindicates the inhibitor arcs. The inhibitor arcs are not defined as classical inhibitor arcs of the discrete Petri nets, but as threshold tests [DA10]. Given a threshold test arc that goes from place pito transition ti, labeled with s, transition tican be enabled only when m[pi]< s. The adaptation to the workload of the transitions can be obtained with discrete and continuous transitions (HPN) which are enabled or disabled depending on the workload. To obtain it, each place pof the HAPN has to be “unfolded” into two places: p, with its original marking, and p′, with its complementary marking B−m[p], where Bis the bound of the place p. Each transition tof the HAPN is also “unfolded” into two transitions, a discrete one, tD, and a continuous one, tC. The needed arcs and inhibitor arcs needed to obtain the adaptive behaviour are shown in Fig. 9.9. pp′ tDtC 2 2 2 94 94 96 k100-k Figure 9.9: Representation of the HAPN in Fig. 9.7 with HPN with inhibitor arcs. 9.2.2 Hybrid Petri nets with discrete priority Finally, in the case of bounded PN, the behaviour of the HAPN can also be obtained with HPN with discrete priority. It is, the Hybrid Petri nets in which discrete transitions have more priority than continuous ones. Conflict resolution between continuous and discrete transitions can be managed with different rules, being this one a common assumption [DA10] (Page 223. Rule 6.1): If there is a conflict between a discrete and a continuous transition, the discrete transition takes priority over the continuous transition. 9.2. Alternative approaches to represent adaptation 129 In this case, the behaviour of the place and the transition of the HAPN in Fig. 9.7 can be obtained with the HPN in Fig. 9.10. Due to discrete transitions have more priority than continuous, transition tCin Fig. 9.10 will be enabled only in the case pCis marked, it is the enabling degree of the transition ( m[p] P re(p,t)) is bigger than the threshold. Complementary, transition tDis enabled only then ( m[p] P re(p,t)) is smaller or equal to the threshold (and pDis marked). pp′ pD pC tDtC 2 2 2 6 6 94 94 94 96 k100-k Figure 9.10: Representation of the HAPN in Fig. 9.7 with HPN discrete priority. Notice that the definition of HPN where the places are indistinguishable is considered here. If the definition of HPN where the places are divided in two sets (P=Pc∪Pd) were used, then places pDand pCwould be in Pcand p,p′would be in Pd. And it would have the same behaviour. 9.2.3 Petri nets with guards enabling transitions The concept of adaptation can be also obtained with transitions with guards. In this Petri nets, each transition has an associated guard that is a logic assertion such that if the assertion is not true, the transition is not enabled. When the assertion is true, the transition behaves normally. Using this concepts, HAPN can be expressed with Hybrid Petri nets and guards associated to transitions. Each adaptive transition will be unfolded into two guarded transitions: a discrete transition, with an associated guard that enables the transition when enab(t, m)≤µ; and a continuous transition, whose guard enables the transition when enab(t, m)> µ. p tDtC 2 2 k m[p] 2≤3m[p] 2>3 Figure 9.11: HAPN. Guards enabling transitions. 130 9. Hybrid adaptive Petri nets: definition and deadlock-freeness preservation Figure 9.11 represents the same hybrid adaptive PN of Fig. 9.7 but with discrete (tD) and continuous (tC) guarded transitions. The discrete transition tDwill be enabled when m[p] 2≤3, and otherwise continuous transition tCwill be enabled. 9.3 Reachability inclusion among different formalisms In this section, the reachability set (RS) of HAPN systems is studied and compared to the RS of discrete and continuous systems. In order to compare the reachability sets, the same initial marking m0∈N|P|is considered for all three types of Petri nets (discrete, continuous or hybrid adaptive). For the study of the RS we will focus on ordinary PN. Notice that although ordinary PN are a subclass of general PN, any non-ordinary Petri net can be converted to an equivalent ordinary PN [Sil85]. It will be proved that, under rather general conditions, the RS of a HAPN, RSA(N,m0), contains the discrete RS, RSD(N,m0). Moreover, the RS of a CPN, RSC(N,m0), contains the RS of any HAPN with the same PN structure. This is a straightforward consequence of the fact that, in contrast to continuous nets, HAPN are a partial, non-full, relaxation of discrete nets. Theorem 9.7 RSD(N,m0)⊆RSA(N,m0)for any ordinary N, with µ∈N|T|. Proof. Let m∈RSD(N,m0). Then, there exists σd=tγ1...tγksuch that m0 1tγ1 −→ m1 1tγ2 −→ m2··· 1tγk −→ mk=min hN,m0iD. We will prove that there exists a sequence σa=β1tγ1. . . βktγksuch that m0 β1tγ1 −→ m1 β2tγ2 −→ m2···βktγk −→ mk=min hN,m0iA. Let us start with tγ1, and let us check if β1= 1 can be chosen. Two cases must be considered. a) enab(tγ1,m0)≤µtγ1. From the definition of HAPN, tγ1behaves as discrete, i. e., mode(tγ1,m0) = D. Given that tγ1is enabled in hN,m0iD, it holds that enab(tγ1,m0)=minp∈•tγ1{m0[p]} ≥ 1. Hence, it is also enabled in hN,m0iA in the same amount. Therefore, β1= 1 can be chosen, and the same m1of the discrete system is reached. b) enab(tγ1,m0)> µtγ1. From the definition of HAPN, tγ1behaves as continuous, i.e., mode(tγ1,m0) = C. Because µtγ1∈Nand enab(tγ1,m0)> µtγ1, it holds that enab(tγ1,m0)−µtγ1≥1. Therefore, β1= 1 ≤enab(tγ1) - µtγ1can be chosen and m1is reached. The same reasoning can be applied to the rest of the transitions in the sequence tγ2...tγk. 9.3. Reachability inclusion among different formalisms 131 Figure 9.12: A PN system whose reachability set as discrete is not contained in the reachability set as adaptive with with µ= (1.5,1.5), see Fig. 9.13. 0 1 2 3 4 5 0123450 1 2 3 4 5 0123450 1 2 3 4 5 012345 (a) (b) (c) Figure 9.13: RS of the Petri Net of Fig. 9.12 behaving as: (a) DPN; (b) HAPN with µ= (2,2); and (c) HAPN with µ= (1.5,1.5). If non ordinary PN or non natural thresholds are considered, RSD(N,m0)is in general not contained in RSA(N,m0). Let us show both cases through examples. When non natural thresholds, µ6∈ N|T|, are considered, RSD(N,m0)is in general not contained in RSA(N,m0)for ordinary HAPN. Let us show it with the following example. Consider the net of Fig. 9.12 as discrete with the initial marking m0= (3,4). Both t1and t2can be fired until the place p1is empty (when enabling degree is 0). Its reachability set RSD(N,m0)is represented in Fig. 9.13 (a). Let us consider now the net as adaptive, with µ= (1.5,1.5) Thus, t1can fire as continuous while m[p1]>1.5. And t2can fire as continuous while m[p1]>1.5and m[p2]>1.5. When m[p1] = 1.5,t1changes from continuous to discrete, and it can fire a discrete amount. Analogously, t2changes to discrete and can fire as discrete when m[p1] = 1.5. Its reachability set is shown in Fig. 9.13 (c). Notice that RSD(N,m0)contains some markings that are not reachable in hN,m0iA. For example, the marking m2= (1, 4) ∈RSD(N,m0), but m26∈ RSA(N,m0). If non-ordinary PN are considered, RSD(N,m0)is in general no contained RSA(N,m0), with µ∈N|T|. This can be shown through an example. The reachability set of the HAPN in Fig. 9.1 with µ= (1,1) is shown in Fig. 9.14. Transition t2is enabled 132 9. Hybrid adaptive Petri nets: definition and deadlock-freeness preservation as continuous from marking (5,0) to (2,1.5), where it changes to discrete. If t2is fired as discrete (from (2,1.5)), (0,2.5) is reached. In (0,2.5) none of the transitions are enabled (and the net deadlocks). Transition t1is enabled as continuous from (2,1.5) to (3,1), where it is enabled as discrete. When t1is fired as discrete from (3,1),(5,0) is reached and t1 becomes not enabled. The marking m= (1,2) is reachable in the discrete Petri net, but not in the adaptive one with ∀µ, µ = 1. Therefore, RSD(N,m0)is not, in general, included in RSA(N,m0)with µ∈N|T|for non ordinary HAPN. On the other hand, it is straightforward to prove that, given that HAPN allow real-valued markings, RSA(N,m0)is not, in general, included in RSD(N,m0). Nonetheless, if µ= ∞, the HAPN always behaves as discrete and its RS is trivially identical to that of the discrete PN. Let us finally compare the RS of the HAPN to the RS of its associated continuous PN. Theorem 9.8 RSA(N,m0)⊆RSC(N,m0)with µ∈R|T| ≥0. Proof. Let m∈RSA(N,m0). Therefore, there exists σa=β1tγ1...βktγksuch that m0 β1tγ1 −→ m1 β2tγ2 −→ m2··· β3tγk −→ mk=mwhere βi∈R+if mode(tγi, mi−1) =C and βi∈N+if mode(tγi,mi−1) = D. For any of the βiof σa, if mode(tγi,mi−1) = C, then tγiwill be also enabled in hN,mi−1iCand the same βi∈R+can be chosen. If mode(tγi, mi−1) = D, then tγi will be also enabled in hN ,mi−1iCand also the same βi∈N+can be chosen because N+⊂R+. Consequently, the same firing sequence σaof the HAPN system can be chosen in the continuous system and the same marking mis obtained. The following corollary is straightforwardly obtained from Theorems 9.7 and 9.8. Corollary 9.9 RSD(N,m0)⊆RSA(N,m0)⊆RSC(N,m0)for ordinary nets with µ∈ N|T|. Furthermore, let us show through an example that the RS of the continuous system is, in general, not contained in the RS of the HAPN system, i.e., RSC(N,m0)*RSA(N,m0) with µ∈R|T|. In the PN system of Fig. 9.1 (with µ= (1.5, 1.5)), the marking m= (0.5, 2) is included in RSC(N,m0), but cannot be reached by the HAPN, i.e., it is not included in RSA(N,m0). Both spaces are trivially equal if all the transitions of the HAPN always behave as continuous, i.e., when µ=0. 9.4 Deadlock-freeness in hybrid adaptive Petri nets This section studies the deadlock-freeness property of HAPN, and relates it to deadlockfreeness of the equivalent discrete PN. Although for arbitrary µdeadlock-freeness of the discrete PN is, in general, not preserved by the HAPN, it is shown that the appropriate selection of µcan preserve the property for a large class of nets. 9.4. Deadlock-freeness in hybrid adaptive Petri nets 133 0 1 2 3 4 5 012345 (0,2.5) (2,1.5) (5,0) (5,0) (3,1) (2,1.5) (0,2.5) Figure 9.14: Reachability space and reachability schema of the PN in Fig. 9.1 behaving as HAPN with µ= (1,1). Definition 9.10 Deadlock-freeness. A HAPN system hN ,m0iAis deadlockfree if ∀m∈ RSA(N,m0),∃t∈Tsuch that tis enabled at m. Let us first show, by considering the net in Fig. 9.1, that: hN,m0iDis deadlock-free 6⇒ hN,m0iAis deadlock-free. The system in Fig. 9.1 with m0= (5,0) is deadlock-free if considered as discrete. However, if considered as HAPN with µ= (1,1) it deadlocks after firing t2as continuous in an amount of 1.5, and again t2as discrete, see Fig. 9.14. Furthermore, in general, deadlock-freeness of a HAPN system does not guarantee deadlock-freeness of the equivalent discrete system: hN,m0iAis deadlock-free 6⇒ hN,m0iDis deadlock-free. The system in the Fig. 9.1 with m0= (4,0) deadlocks as discrete. If considered as HAPN, it is deadlock-free with m0= (4,0) and µ= (1.5,1.5) because t2commutes from continuous to discrete when m[p1] = 3, and m[p1]never empties. Although the deadlock-freeness property of discrete systems is not preserved in general by HAPN with arbitrary µ, it will be proved that for choice free nets with µ∈N|T|deadlockfreeness of the HAPN system is necessary and sufficient for deadlock-freeness of the discrete system. Let us first prove that it is a sufficient condition. Theorem 9.11 Let hN,m0iAbe an ordinary deadlock-free HAPN system with µ∈N|T|. Then, the discrete system hN,m0iDis deadlock-free. Let us assume that the discrete hN,m0iDdeadlocks at a marking m. According to Theorem 9.7, marking mcan be reached by hN,m0iA. Given that the net is ordinary, for every transition t, there exists p∈•tsuch that m[p] = 0, i.e., mis a deadlock for hN,m0iA. For the necessary condition, two technical lemmas are introduced before stating the final result. The first one states that if a sequence σis fireable in the adaptive system, its ceil sequence ⌈σ⌉is also fireable in the discrete one. 134 9. Hybrid adaptive Petri nets: definition and deadlock-freeness preservation Definition 9.12 Let σ=α1tγ1α2tγ2...αktγkbe a firing sequence of a given HAPN hN,m0iA. The ceil sequence, ⌈σ⌉of σis defined as: ⌈σ⌉=α′ 1tγ1α′ 2tγ2. . . α′ ktγkwhere α′ i=   X 1≤j≤i|tγi=tγj αj    −X 1≤j<i|tγi=tγj α′ j For example, for the sequence σ1= 0.1t10.8t20.1t10.2t10.8t2in the HAPN of Fig. 9.6 (a), the ceil sequence ⌈σ1⌉is defined as ⌈σ1⌉= 1 t11t20t10t11t2. Lemma 9.13 Let hN,m0iAbe an ordinary choice-free HAPN system with µ∈N|T|. If σis a fireable sequence in hN ,m0iAthen ⌈σ⌉is fireable in hN ,m0iD. Let us assume without loss of generality that σ=α1tγ1...αktγkand 0< αj≤1for every j∈ {1,...,k}. Induction on the length of σ:|σ|=k. •Base case (|σ|= 1). Let σ=α1tγ1, then ∀p∈•tγ1, m0[p]≥α1and given that m0[p]∈N, it holds that m0[p]≥ ⌈α1⌉. Thus ⌈σ⌉=⌈α1⌉tγ1can be fired in hN,m0iD. •Inductive step. Assume that the Lemma holds for |σ|=k. Let us consider the k+ 1 firing, i.e., tγk+1 fires in αk+1. Two cases can occur: a) α′ k+1 = 0. In this case, the Lemma trivially holds. b) α′ k+1 = 1. Let miand σi(m′ iand σ′ i) be the marking and firing count vector obtained just after the firing of tγiin an amount αi(α′ i). If tγk+1 fires in the HAPN system, it means that mk[p]>0for every p∈•t. Notice that, by definition of ceil sequence, after the kth firing the following inequalities are satisfied: σ′ k[t]≥σk[t]and σ′ k[tq]≥σk[tq]for every tq∈•(•t). Given that the net is choice-free, for every place pit holds that |•p|= 0 or |•p| ≥ |p•|= 1. If for p∈•t, it holds that |•p| ≥ |p•|= 1, then the previous inequalities ensure m′ k[p]≥1. If phas no input transitions, then it must hold that σ′ k+1[t]≤m0[p]. Therefore tγk+1 can fire from m′ kan amount of 1. The second lemma states that if a certain sequence σdeadlocks an ordinary choice-free HAPN, then its firing count vector is in the naturals. Lemma 9.14 Let hN,m0iAbe an ordinary choice-free HAPN system with µ∈N|T|. If σis a fireable sequence m0 σ −→ m, such that hN,m0iAdeadlocks at m, then σ∈(N∪{0})|T|, where σis the firing count vector of σ. Let us first prove that if mis a deadlock marking then for every transition tthere exists p∈•tsuch that m[p] = 0. Notice that just after the last firing of tin the sequence σ, which is necessarily discrete firing given that µ∈N|P|, at least one place p∈•tbecomes empty. Assume that after such a firing, a transition t′∈•pfires. If the firing of t′is discrete then t would become enabled again; if it is continuous then t′is sufficiently enabled to fire also as 9.4. Deadlock-freeness in hybrid adaptive Petri nets 135 discrete what would enable t. Hence, after the last firing of t, no transition t′∈•pcan fire and premains empty. Assume that σ[t]>0is not a natural number and that m[p] = 0 for a given p∈•t. Then, there exists t′∈•psuch that σ[t′]is not a natural number and σ[t′]≤σ[t]−m0[p]. Notice that there also exists p′∈•t′such that m[p′] = 0, hence t′′ ∈•p′exists such that σ[t′′]is not a natural number and σ[t′′]≤σ[t′]−m0[p′]≤σ[t]−m0[p]−m0[p′]. This reasoning can be repeated until a transition t∗is found such that it deadlocked with σ[t∗]<1. Contradiction since natural thresholds do not allow σ[t∗]to be less than 1. p1 p2 p3 p4 p5 p6 p7 t1t2 t3 t4 t5 t6 Figure 9.15: Ordinary PN system that is deadlock-free as DPN, but it deadlocks as HAPN with µ=1. Therefore, because of Lemmas 9.13 and 9.14, if a deadlock marking mis reachable in hN,m0iAwhen σis fired, the same deadlock marking m′is reachable in hN,m0iD, when ⌈σ⌉is fired. Thus, if hN,m0iDis deadlock-free, then hN,m0iAis deadlock-free too. Theorem 9.15 Let hN,m0iDbe an ordinary choice-free and deadlock-free discrete system. Then, the HAPN system hN ,m0iAis deadlock-free for any µ∈N|T|. If non ordinary or non choice-free PN are considered, Theorem 9.15 does not hold. For example, consider the PN in Fig. 9.15. It is an ordinary PN which is not choice-free. It is deadlock-free as DPN. However, considered as HAPN with thresholds µ=1, it can reach the deadlock marking md= (0.5,0,0.5,0,1,0,0.5) by firing the firing sequence σ= 0.5t50.5t11t11t2from the initial marking m0= (2,2,0,1,0,0,0) shown in the figure. Hence, deadlock-freeness property is not preserved by the HAPN with µ∈N|T|. The following corollary is straightforwardly obtained from Theorems 9.11 and 9.15. Corollary 9.16 Let Nbe an ordinary choice-free net. hN,m0iDis deadlock-free iff hN,m0iAis deadlock-free with µ∈N|T|. Preservation of deadlock-freeness in a S3PR example Let us consider the Example 9.17, in which the PN in Fig. 9.16 (a) is considered, which is a System of Simple Sequential Processes (S3PR) [ECM95]. 136 9. Hybrid adaptive Petri nets: definition and deadlock-freeness preservation p0 p1 p2 p3 p4 q0 q1 q2 q3 q4 r1 r2 r3 s1 s2 s′ 3s3 s4 s5t1 t2 t3 t′ 3 t4 t5 Pr1 Pr2 Figure 9.16: A S3PR system [GV99] that is deadlock-free as discrete, but it deadlocks as continuous (md= (3,0,0,1,0,3,0,0,1,0,0,0,1)). It is deadlock-free as HAPN with µ= 1. Example 9.17 The PN in Fig. 9.16 models a system in which two processes Pr1and Pr2share resources r1,r2and r3. The PN system is live as discrete. However, when the PN system is fluidified, i.e., transitions can be fired in non negative real amounts, the system can reach a deadlock: from the initial marking m0, where m0[r1] = m0[r2] = m0[r3] = 1,m0[q0] = m0[p0] = 4 and the other places are empty, the firing sequence σ =1 2s11 2t11 2s21 2t21 2s31 2t31 2s11 2t11 2s21 2t21 2s31 2t3can be fired, reaching the deadlock marking md, where md[r1] = md[q3] = md[p3] = 1,md[q0] = md[p0] = 3 and the other places are empty. The continuous PN system does not preserve the deadlock-freeness of the discrete PN system. However, this property will be preserved by the HAPN system with appropriate thresholds (in this case, with µ=1). An important issue in HAPN is to choose adequate thresholds λin a given HAPN. An interesting criterion is to identify which transitions are involved in a bad behaviour that might happen in the CPN but not in the DPN. Then, the thresholds of the transitions related to such bad behaviour should be higher than 0, to preserve some discrete behaviour, while the rest of the transitions can be continuous (i.e., threshold equal to 0). Abad behaviour can be the existence of a spurious deadlock which becomes reachable by the emptying of a trap (see [Sil+11]), such as in the PN considered in the Example 9.17. In that case, the undesired deadlocks occur in the limit, when the firings of the transitions can be as small as desired. This can be avoided by setting any positive threshold for the transitions, as it is illustrated in the example. 9.5. Conclusions 137 Appropriate thresholds have been selected for the examples considered in this work. However, a general method to obtain the thresholds for any net system requires more investigation. 9.5 Conclusions The formalism of HAPN, introduced for timed PN in [YLL09], has been generalized to the untimed context in this chapter. In contrast with HPN, in which the partition among continuous and discrete is static, HAPN adapts its behaviour dinamically with the load of the syhstem. An adaptive transition has two different modes: continuous and discrete, continuous mode for high transition load (in this case, enabling degree higher than a given threshold) and discrete in other case. HAPN can be seen as a conceptual framework which includes discrete, continuous and hybrid PN. Moreover, by selecting the appropriate thresholds, HAPN offer the chance to preserve important properties of discrete event systems, as deadlock-freeness,that are not always retained by fully continuous approximations. Reachability and deadlock-freeness property of hybrid adaptive nets has been compared with those of DPN and CPN. For a rather general class of nets, an inclusion relationship was proved for the reachability sets of the discrete, hybrid adaptive and continuous nets. With respect to deadlock-freeness, although this property is not preserved in general for arbitrary real thresholds, it was shown that it is necessary and sufficient for deadlock-freeness of choicefree nets with arbitrary natural thresholds.