Taking Advantages of Temporal Redundancy i~ High Level Petri N ets Implementations J. A. Bañares, P. R. Muro-Medrano and J. L. Villarroel Departamento de Ingeniería Eléctrica e Informática UNIVERSIDAD DE ZARAGOZA Mana de Luna 3, Zaragoza 50015, Spain** Abstract. The aim of this paper is to present a software implementa- tion technique for High Level Petri Nets. The proposed technique, imple- mented for a specialized version of HLPN called KRON, is interp"I'eted and centralized. The approach makes use of the similarities between the inferenceengineof a rule based system and the interpretation mechanlam ' of a HLPN. It performs an adaptation of the RETE matching algorithm to deal wlth HLPN Implementations. As In RETE, the main objectlve la to exploit the data temporal rediíndancy, with this purpose, a RETE-like data structure Is Implemented. Addltionally, our approaeh benefits from the partition 'of working memory facllitated by the HLPN. These pecu- liarities allow the generation of simpler data structures than the ones In more general production systems such as OPS5. Keywords: Hlgher-Ievel net models, Rule based systems, Petri net Im- plementation, Matchlng algorithms. 1 Introd uction A Petri Net software implementation is a computer program cre{\ted to simulate the firing of transitions following the theoretical behaviorál rules imposed by the Petri net semantics. Petri nets implementation techniques can be classified in ICSV86]: centralized and decentralized implementations. In a centralized imple- mentation, the full net ia executed by just one aequential task, commonly called token player. Pieces of code associated to transitions (code can be associated to transitions to provide operational capabilities) can be executed as parallel tasks to guarantee the concurrence expressed by the neto In a decentralized implemen- tation, the overall net is decomposed into subnets (normally, sequential subnets) and a task is created to execute each subnet. The other main classitication for software implementations of Petri nets distinguishes interpreted and compiled implementations. An implementation is interpreted if the net structure and the ma.:rking are coditied as data structures. These data structures are used by one or more tasks called interpreters to make the net evolve. :fhe interpreters do **This work has been supported In part by project ROB91-0949from the Comisión lntermlnisterial de G'ienclay Tecnología of Spaln and project IT-I0/91 from the Diputación General de Aragón. J. A. Bañares Is FPU fellowfrom the Ministerio de F.ducaclónv Clencll\of 8pl\ln. \ \ .-1' " ,~ 33 not depend on the implementednetoA compiledimplementation is based on the generation of one or more tasks whose control ftows reproduce the net structure. No data structures are needed in compiled implementations. The ,software implementation of High Level Petri Nets (HLPN) has not re- ceived much attention so far. Its most representative approaches are briefty stated in the following. ¡BM86] presents a decentralized and compiled implemen- tation of a subclass of HLPN (PROT nets). A PROT net is partiaIly unfolded and decomposed into sequential processes that are implemented as a set of communi- cating Ada tasks. Other representative approach has been stablished in ICSV86], where a centralized and interpreted implementation of Colored Petri Nets is pro- posed. One of the main ideas of this work is the extension of representing place concept to HLPN. Another centralized and interpreted implementation of HLPN is proposed in ¡Har87], in this case, several interpreters compete to make the net evolve. The net i8 codified in just one data structure. A highly decentralized implementation is proposed in IBBM89], each place and transition are imple- mented as an OCCAM process and the implementation runs on a transputer based architecture. ¡va90], the closest related work, wiIl be explained later. The aim of this paper is to present a software implementation approach for HLPN developed for the K}10N knowledge representation language ((MM90] and lVil90J). The proposed technique is interpreted and, in principIe, centralized. However, the basis of this technique can also be used in decentralized implemen- tations. This technique is based on the similarities between the inference engine of a rule based system and the interpretation mechanism of a HLPN. In both, efficiency is an important consideration since rule basad systems and HLPN based systems, may be expected to exhibit high performance in interactive or real-time domalns. The proposed HLPN implementation techniqúe makes use of an adaptation of the RETE matching algorithm ¡For82] which is used in the OPS5 ¡BFKM85] rule based language. As in RETE, the main idea is to exploit temporal data redundancies (comming from the marking that is not changed during transition firing). The a.dequacy of the RETE match a.lgorithm for software implementations of HLPN is getting greater interest within the research groups working on PN / Al. Thus, ¡BE86] and [DB88] adopt OPS5 as the implementation language whereas ¡YU90]and IVB90]provide a more in-depth knowledge about the use ofthe OPS5 matching strategy (RETE) to deal with HLPN software implementations. The paper of Valette and col. provides a pretty nice conceptual and pedagogical view for the specific use of RETE for the matching process. The approach presented here. goes further in these ideas, which have been refined with the feedback of our implementation experience. We propose a strategy to specialize the RETE match algorithm to be more suitaQle for HLPN spftware implementations. A specific implcmentation is proposed and some aspects, as the reduction of test tree,'8.J:e .treated with more d.eep. Some details, which are interesting from the softwa!:,epoint of view (mainly related with data structures), are also considered. The rest of the paper is structured as foIlows:In section 2 rule based systems and its interpretation mechanism are explained. Additionally, the matching pro-