scieee AI-readable full text Open interactive document viewer

Simulating FRSN P Systems with Real Numbers in P-Lingua on sequential and CUDA platforms

Macías Ramos, Luis Felipe; Martínez del Amor, Miguel Ángel; Pérez Jiménez, Mario de Jesús

Abstract

Fuzzy Reasoning Spiking Neural P systems (FRSN P systems, for short) is a variant of Spiking Neural P systems incorporating fuzzy logic elements that make it suitable to model fuzzy diagnosis knowledge and reasoning required for fault diagnosis applications. In this sense, several FRSN P system variants have been proposed, dealing with real numbers, trapezoidal numbers, weights, etc. The model incorporating real numbers was the first introduced [13], presenting promising applications in the field of fault diagnosis of electrical systems. For this variant, a matrix-based algorithm was provided which, when executed on parallel computing platforms, fully exploits the model maximally parallel capacities. In this paper we introduce a P-Lingua framework extension to parse and simulate FRSN P systems with real numbers. Two simulators, implementing a variant of the original matrix-based simulation algorithm, are provided: a sequential one (written in Java), intended to run on traditional CPUs, and a parallel one, intended to run on CUDAenabled devices.

Full text

Simulating FRSN P Systems with Real Numbers in P-Lingua on sequential and CUDA platforms Luis F. Mac´ıas-Ramos, Miguel A. Mart´ınez-del-Amor, and Mario J. P´erez-Jim´enez Research Group on Natural Computing, Department of Computer Science and Artificial Intelligence, University of Sevilla, Avda. Reina Mercedes s/n., 41012 Sevilla, Spain {lfmaciasr,mdelamor,marper}@us.es Abstract. Fuzzy Reasoning Spiking Neural P systems (FRSN P systems, for short) is a variant of Spiking Neural P systems incorporating fuzzy logic elements that make it suitable to model fuzzy diagnosis knowledge and reasoning required for fault diagnosis applications. In this sense, several FRSN P system variants have been proposed, dealing with real numbers, trapezoidal numbers, weights, etc. The model incorporating real numbers was the first introduced [13], presenting promising applications in the field of fault diagnosis of electrical systems. For this variant, a matrix-based algorithm was provided which, when executed on parallel computing platforms, fully exploits the model maximally parallel capacities. In this paper we introduce a P-Lingua framework extension to parse and simulate FRSN P systems with real numbers. Two simulators, implementing a variant of the original matrix-based simulation algorithm, are provided: a sequential one (written in Java), intended to run on traditional CPUs, and a parallel one, intended to run on CUDA- enabled devices. Keywords: Membrane Computing ·Psystems·Spiking Neural P systems ·Fuzzy Reasoning Spiking Neural P systems ·Fault diagnosis · Fuzzy knowledge ·Fuzzy reasoning ·P-Lingua ·Java ·CUDA 1 Introduction Membrane computing is a branch of natural computing, which takes inspiration from the structure and functioning of living cells to provide parallel and distributed computational models, called membrane systems or P systems. P systems were first introduced in [15], and many variants were subsequently developed, which can be divided into three categories: cell-like systems, inspired by the hierarchical membrane structure of eukaryotic cells [15]; tissue-like systems, inspired by the way in which cells organize and communicate within a net-like structure in tissues [8]; and neural-like systems, inspired by the way in which the neurons in the brain exchange information by means of the propagation of spikes [5]. Models belonging to this last variant are collectively called Spiking Neural P systems (SN P systems, for short). An SN P system consists of a set of neurons placed as nodes of a directed graph (called the synapse graph). Each neuron contains a number of copies of a single object type, the spike. Rules are assigned to neurons to control the way information flows between connected neurons. Two kinds of rules are considered: firing/spiking rules and forgetting rules. By applying a firing/spiking rule, some spikes are consumed and new spikes are produced. Produced spikes are sent to all neurons linked to the neuron executing the rule. By applying a forgetting rule, spikes are removed from neurons. SN P systems usually work in synchronous mode, where a global clock is assumed. In each time unit, for each neuron, only one of the applicable rules is non-deterministically selected to be executed. Execution of rules takes place in parallel amongst all neurons of the system. SN P systems have become really popular within the Membrane Computing community and extensive work has been conducted to study their properties and produce new variants. For instance, it has been proved that these systems are computational complete (equivalent in power to Turing machines) when considered as number computing devices [5], used as language generators [2,3], or to compute functions [14]. Different kinds of asynchronous “working modes” have been also addressed [12,16,17]. In what concerns to produce new variants of the model, this has involved incorporating new elements such as weights [19], antispikes [9], extended rules [16], budding and division rules [10] and astrocytes [1,7,11], among other examples. In [13] a new SN P systems variant, called FRSN P systems, was introduced, incorporating fuzzy logic elements. The motivation of this variant was to bring together desirable features (understandable, dynamical, synchronized, non-linear, non-deterministic, able to handle incomplete and uncertain information) to model diagnosis knowledge and reasoning in the field of fault diagnosis. To accomplish this, new ingredients were added to extend original SN P systems: three types of neurons (proposition neurons, AND-type and OR-type rule neurons), fuzzy truth values (modelled by means of real numbers) and a new firing mechanism. Also, a matrix-based algorithm was provided, suitable to be executed on parallel computing platforms, and thus able to fully exploit the model maximally parallel capacities. Applications of this new model have been related to fault diagnosis on electrical systems so far [13,21]. Variants have also appeared since the model introduction, for instance dealing with trapezoidal numbers [22,23] and weights [20], with applications to power systems fault diagnosis. Due to the promising applications of FRSN P systems, it becomes interesting to provide the corresponding simulators, thus favouring research on this model within Membrane Computing community as well as in applied fields. In this paper we introduce support for FRSN P systems with real numbers into P-Lingua [4,28] framework. P-Lingua consist of a general programming language for P systems called P-Lingua itself and a Java [26] based open source library called pLinguaCore. In particular, P-Lingua language provides a common syntax for specifying P systems variants, with pLinguaCore provides both parsers and simulators for such variants. The notable variety of supported models (see [28] for a list of related publications) contributed to make P-Lingua widely used among members of the Membrane Computing community, turning its specification language into a sort of standard. Developing FRSN P systems support has involved designing a specific parser (since with respect to P-Lingua, FRSN P systems are considered a “separated” variant of SN P systems), a simulation algorithm (which is a variation of the one introduced in [13]) and the corresponding simulators. The provided simulation algorithm is a matrix-based one. As such is susceptible to being executed on parallel platforms, specially intended to work in simultaneously with hundreds to millions of data stored in matrices. In this way, it can take advantage of the corresponding execution speedup. Indeed, GPUs have been successfully used to accelerate well-known linear algebra libraries, such as MKL BLAS and LAPACK. Specifically, NVIDIA GPUs are able to execute scientific applications through CUDA [6], harnessing the highly parallel architecture within them (featuring up to 3000 computing cores). In this sense, CUDA offers special linear algebra libraries such as cuBLAS and CULA tools, delivering up to 17×of speedups for some applications [24]. Therefore, along with a Java sequential simulator, a parallel one has been developed intended to be able to run on the majority of CUDA-compatible [24] devices. This last simulator works by means of a JAVA-CUDA binding provided bytheopensourceJCUDA [27] library, available for Windows, Linux, MacOS and other operating systems. This paper is structured as follows. Section 2is devoted to recall the basic ingredients of FRSN P systems with real numbers. In Sect. 3,aP-Lingua syntax for such variant is introduced. Section 4is devoted to simulation aspects: the new matrix-based simulation algorithm is introduced, and invoking the sequential and parallel simulators is discussed. Also, compatibility and performance of the parallel simulator is addressed. Section 5covers conclusions and future work. 2 Fuzzy Reasoning Spiking Neural P Systems with Real Numbers In what follows, we recall FRSN P systems with real numbers, which constitute an extension of SN P systems. As new ingredients, three types of neurons (proposition neurons, AND-type and OR-type rule neurons), and elements from the fuzzy logic such as fuzzy truth values are incorporated, as well as a new firing mechanism defined after such fuzzy logic elements. FRSN P systems with real numbers can model and visualize fuzzy production rules in a diagnosis knowledge base due to their graphical nature. Combination of neuron’s new firing mechanism and fuzzy logic ensures to automatically accomplish dynamic fuzzy reasoning. FRSN P systems with real numbers can be defined as follows (an extensive description of this model can be found at [13]): Definition 1. A FRSN P system Πwith real numbers of degree (l,q, n, k),with l,k ≥1,q≥0and n≥l+q+1, is a tuple of the form (A, σ1,...,σ n+k,syn,I,O), where (1) A={a}is the singleton alphabet (the object ais called spike); (2) σ1,...,σ n+kare neurons, of the form σi=(αi,τ i,r i),1≤i≤n+k,where ()αi∈[0,1] and it is called the (potential)value of spike contained in neuron σi(also called pulse value); ()τi∈[0,1] is the truth value associated with neuron σi; ()riis a firing/spiking rule contained in neuron σi, of the form E/aα→aβ, where α, β ∈[0,1]. (3) syn ⊆{1,...,n+k}×{1,...,n+k}with i=jfor all (i, j)∈syn,1≤ i, j ≤n+k(synapses between neurons); (4) I={σ1,...,σ l}is the set of the input neurons that verifies the following: for each σ∈I,indegree(σ)=0. (5) O={σl+q+1,...,σ n}is the set of the output neurons that verifies the following: for each σ∈O,outdegree(σ)=0. (6) Neurons σl+1,...,σ l+qare called internal neurons. FRSN P systems with real numbers constitute an extension of SN P systems in the following way (we refer to [13] for more details): – There are two types of neurons: proposition neurons (associated with propositions in a fuzzy knowledge base) and rule neurons (associated with fuzzy production rules with AND/OR-type antecedent part). Specifically, system Πhas nproposition neurons σ1,...,σ nand krule neurons σn+1,...,σ n+k. Rule neurons are classified into two classes: AND-type rule neuron and OR- type rule neuron. proposition neurons σ1,...,σ l   input neurons ,σ l+1,...,σ l+q   internal neurons ,σ l+q+1,...,σ n   output neurons , rule neurons σn+1,...,σ n+k – Content of neuron σiis denoted by a fuzzy truth value αi∈[0,1] which can be interpreted as the (potential) value of spike from the view point of biological neurons. For a neuron σi,ifαi>0, we say the neuron contains a spike with (potential) value αi; otherwise, the neuron contains no spike. – Given that each neuron is associated with either a fuzzy proposition or a fuzzy production rule, the value τi∈[0,1] will be used to express the truth value of the fuzzy proposition or confidence factor of the fuzzy production rule. – Each neuron σicontains only one firing/spiking rule ri, which has the form E/aα→aβ, where E=anand n∈IN is the number of input synapses from other neurons to the neuron. The condition E=anindicates that if σi receives nspikes the firing/spiking rule can be applied; otherwise the rule is not enabled. When the number of spikes received by a neuron is less than n, value of the spikes received will be updated according to logical AND or OR operations. – The firing mechanism of neurons can be described as follows. For neuron σi, if its firing rule E/aα→aβcan be applied, this means that its pulse value α>0 is consumed, the neuron fires, and then it produces a spike with value β: all neurons σjwith (i, j)∈syn will immediately receive the spike. Each kind of neurons use different ways to handle both αand β. It is worth pointing out that fuzzy production rules of a fuzzy diagnosis knowledge base can be mapped into a FRSN P system model (again, we refer the reader to [13] for more details). 3 P–Lingua Syntax for FRSN P Systems with Real Numbers In what follows we discuss an extension of the P-Lingua syntax to specify FRSN P systems with real numbers. Let us stress the fact that, with respect to P-Lingua, this variant is considered as separate model from SN P systems. Definition of P system model In order to define a FRSN P systems with real numbers, the first line of the P-Lingua file should be as follows: @model<fuzzy psystems> . Main module specification In P-Lingua, instructions are organized into modules, except for global variables definitions, that are placed outside any module. At least a module is required, which is called main,atistheentrypointtotheP-Lingua model specification. The syntax to define this module is the following: def main {/* instructions are placed here */ }, Specification of the fuzzy variant In order to specify the kind of FRSNPS, the following sentence must be written (it has to be the first sentence in the model specification): @fvariant = v; , where vis a positive integer specifying the variant. In the case of FRSN P systems with real numbers, vmust set to 1, hence @fvariant = 1;. Specification of the sequential/parallel execution (experimental) If the model is to be simulated on a CUDA parallel platform, the following sentence must be written below the @fvariant sentence: @parallel; . If this sentence is not included, a sequential simulation is performed. This way of specifying the sequential/parallel execution is experimental, and may change in future versions of P-Lingua. Specification of proposition neurons In order to specify the proposition neurons present in the system, the following sentence must be written: @mu = p1,...,pi,...,pn; , where pi is the label of the ith proposition neuron. Specification of input proposition neurons In order to specify the input proposition neurons present in the system, the following sentence must be written: @min = pi1,...,piq,...,pis; , where piq is the label of the qth input proposition neuron, and must correspond to a proposition neuron defined in the @mu instruction. Specification of output proposition neurons In order to specify the output proposition neurons present in the system, the following sentence must be written: @mout = po1,...,pow,...,pod; , where pow is the label of the wth output proposition neuron, and must correspond to a proposition neuron defined in the @mu instruction. Specification of rule neurons In order to specify the rule neurons present in the system, the following sentence must be written: @frule(...); .This sentence format depends on the kind of fuzzy production rule being modelled. The following cases are possible: – Simple rules of the form Ri:IFpjTHEN pk(CF = τi) are written as @frule(Ri,taui,pj,pk); . – Type-1 composite rules (AND rules) of the form Ri:IFp1AND p2AND ... AND pk−1THEN pk(CF = τi) are written as @frule(Ri,taui,@fand(p1,p2,...,pk-1),pk); . – Type-2 composite rules of the form Ri:IFp1THEN p2AND p3AND ... AND pk(CF = τi) are written as @frule(Ri,taui,p1,(p2,p3,...,pk)); . – Type-3 composite rules (OR rules) of the form Ri:IFp1OR p2OR ... OR pk−1THEN pk(CF = τi) are written as @frule(Ri,taui,@for(p1,p2,...,pk-1),pk); . Next we illustrate the syntax presented above with the specification the FRSN P systems with real numbers exemplified in [13]. @model<fuzzy_psystems> def main() { @fvariant = 1; @parallel; @mu = p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14; @fpin = (p1,0.8),(p2,0.2),(p3,0.8),(p4,0.8),(p5,0.9), (p6,0.8),(p7,0.2),(p8,0.9),(p9,0.1),(p10,0.2); @fpout = p11,p12,p13,p14; @frule(r1,0.8,@fand(p1,p2),p11); @frule(r2,0.8,@fand(p3,p4,p5,p6),p12); @frule(r3,0.8,@fand(p5,p7,p8,p9),p13); @frule(r4,0.8,@fand(p4,p5,p10),p14); } In this example, a parallel simulation is performed. 4 Simulating FRSN P Systems with Real Numbers In this Section we present a matrix-based simulation algorithm for simulating FRSN P systems with real numbers (a modified version from the one shown in [13]) and we discuss on simulation of such systems into P-Lingua framework. Two simulators are provided, a sequential one (written in Java), intended to run on traditional CPUs, and a parallel one, able to be executed on CUDA-enabled GPUs. This last simulator works by means of a JAVA-CUDA binding provided by theopensourceJCUDA library, available for Windows, Linux, MacOS and other operating systems. 4.1 Simulation Algorithm In what follows, we introduce a simulation algorithm for FRSN P systems with real numbers. In general, simulation algorithms capture semantics of the simulated models, reproducing one or many of the associated computations. In the case of FRSN P systems with real numbers, since these systems are deterministic (and thus confluent), providing an algorithm reproducing a single computation is enough. The algorithm that we are presenting is a revised version of the one introduced in [13], which re-defines the matrix-based functions and operations as well as provides an alternative way to compute fuzzy truth values for rule neurons. As it is a matrix-based algorithm, it is specially suitable to run on parallel platforms such a CUDA systems. Before presenting the simulation algorithm, let us introduce some required notations, operations and functions, which closely follows from [13]. Let Π=(A, σ1,...,σ n+k,syn,I,O) be a FRSN P system with real numbers modelling all fuzzy production rules in a fuzzy knowledge base. Then, we can consider the following: 1. The set of neurons σ=(σ1,...,σ n+k), composed of nproposition neurons and krule neurons; 2. The set of nproposition neurons σp=(σp1,...,σ pn); 3. The set of krule neurons σr=(σr1,...,σ rk), with each of them being either an AND-type or OR-type rule neuron; 4. The set I={σpi1,...,σ pis }, of input proposition neurons, corresponding to fuzzy proposition neurons which fuzzy truth values are known; 5. The set O={σro1,...,σ rod }, of output proposition neurons, corresponding to fuzzy proposition neurons which fuzzy truth values are unknown and to be determined; Let us consider the following vector and matrix notations: 1. U=(ui,j)n×kis a binary matrix, where ui,j ∈{0,1}, defined as follows: ui,j =1 if there is a directed arc from σpi to σrj; 0 otherwise; 2. V=(vi,j)n×kis a binary matrix, where vi,j ∈{0,1}, defined as follows: vi,j =1 if there is a directed arc from σrj to σpi; 0 otherwise; 3. Λ=diag(τr1,...,τ rk) is a diagonal real matrix, where τrj represents the confidence factor of the jth production rule, which is associated with rule neuron σrj; 4. H1=diag(h1,...,h k) is a diagonal binary matrix, defined as follows: hj=1ifthejth rule neuron σrj is an AND-type neuron; 0 otherwise; 5. H2=diag(h1,...,h k) is a diagonal binary matrix, defined as follows: hj=1ifthejth rule neuron σrj is an OR-type neuron; 0 otherwise; 6. αp=(αp1,...,α pn)Tis a truth value vector, where αpi ∈[0,1] represents the truth value of ith proposition neuron σpi; 7. αr=(αr1,...,α rk)Tis a truth value vector, where αrj ∈[0,1] represents the truth value of jth rule neuron σrj; 8. ap=(ap1,...,a pn)Tis an integer vector, where api represents the number of spikes received by the ith proposition neuron σpi; 9. ar=(ar1,...,a rk)Tis an integer vector, where arj represents the number of spikes received by the jth rule neuron σrj; 10. λp=(λp1,...,λ pn)Tis an integer vector, where λpi represents the number of spikes required to fire the ith proposition neuron σpi; 11. λr=(λr1,...,λ rk)Tis an integer vector, where λrj represents the number of spikes required to fire the jth rule neuron σrj; 12. βp=(βp1,...,β pn)Tis a truth value vector, where βpi ∈[0,1] represents the truth value exported by the ith proposition neuron σpi after firing; 13. βr=(βr1,...,β rk)Tis a truth value vector, where βrj ∈[0,1] represents the truth value exported by the jth rule neuron σrj after firing; 14. bp=(bp1,...,b pn)Tis an integer vector, where bpi ∈{0,1}represents the number of spikes exported by the ith proposition neuron σpi after firing; 15. br=(br1,...,b rk)Tis an integer vector, where brj ∈{0,1}represents the number of spikes exported by the jth rule neuron σrj after firing; 16. op=(op1,...,o pn)Tis a binary vector, where opi ∈{0,1}, defined as follows: opi =1ifoutdegree(σpi)>0; 0 otherwise; 17. or=(or1,...,o rk)Tis a binary vector, where orj ∈{0,1}, defined as follows: orj =1ifoutdegree(σrj)>0; 0 otherwise; Let us consider the following matrix functions: 1. diag: D=diag(b), where D=(di,j)isaf×fdiagonal real matrix and b=(b1,...,b f) a real vector, such that di,j =biif i=j 0ifi=j,1≤i, j ≤f; 2. fire: β=fire(α, a, λ, o), where β=(β1,...,β f)T,α =(α1,...,α f)T,a = (a1,...,a f)T,λ=(λ1,...,λ f)T,o=(o1,...,o f)T, such that βi=⎧ ⎨ ⎩ 0ifai<λ i αiif ai=λi∧oi=0 0ifai=λi∧oi=1 ,1≤i≤f; 3. update: β=update(α, a, λ, o), where β=(β1,...,β f)T,α =(α1,...,α f)T, a=(a1,...,a f)T,λ=(λ1,...,λ f)T,o=(o1,...,o f)T, such that βi=⎧ ⎪ ⎪ ⎨ ⎪ ⎪ ⎩ 0ifai=0 αiif 0 <a i<λ i 0ifai=λi∧oi=0 αiif ai=λi∧oi=1 ,1≤i≤f;