scieee AI-readable full text Open interactive document viewer

Analyses and Implementation of Homogenisation Algorithms for Spiking Neural P Systems in the WebSnapse Tool

Kristian Llanto, Tim; Amador, Joshua; Cabarle, Francis George C.; Tristan De La Cruz, Ren; Ko, Daryll

Abstract

An area of computer science called Membrane Computing (MC) was introduced by Gheorghe P˘aun in. It is a form of computing that takes inspiration from how living cells work. Its system, called the P system, mimics the structure of a cell and how it communicates with its neighbor cells. This is different from the traditional way of computing since cells can communicate in a distributed and parallel manner.

Full text

Analyses and Implementation of Homogenisation Algorithms for Spiking Neural P Systems in the WebSnapse Tool Tim Kristian Llanto1, Joshua Amador1, Francis George C. Cabarle1,2, Ren Tristan De La Cruz1, Daryll Ko1 1Dept. of Computer Science, University of the Philippines Diliman, Quezon city, Philippines, 1101 E-mail: {tbllanto,jbamador,fccabarle,radelacruz,dlko}@up.edu.ph 2Research Group on Natural Computing, Department of Computer Science and Artificial Intelligence, I3US, SCORE lab, Universidad de Sevilla, Avda. Reina Mercedes s/n, 41012, Sevilla, Spain E-mail: [email protected] 1 Introduction An area of computer science called Membrane Computing (MC) was introduced by Gheorghe P˘aun in [1]. It is a form of computing that takes inspiration from how living cells work. Its system, called the P system, mimics the structure of a cell and how it communicates with its neighbor cells. This is different from the traditional way of computing since cells can communicate in a distributed and parallel manner [2]. A class of P systems known as Spiking Neural P Systems (in short, SN P systems), use a single symbol representing a spike, commonly represented as the symbol a. Each cell is limited to having a single membrane. This type of cell can be called a neuron [3]. A neuron can be activated and send electrical impulses (called spikes) throughout its axons. Neighboring neurons connected by a synapse to the spiking neuron can receive and accumulate the spikes. Receiving and emitting spikes takes a single time step. This is important since the time interval is an essential variable for the computation of SN P systems. There are different ways we can interpret its spiking train results. One way is to use generative mode, which represents the result of a computation as a set of time intervals between two consecutive spikes in the output. Another way is through accepting mode. In this mode, a number is used as an input on the system. This is represented by the time interval of two input spikes. If the system halts, then the input number is accepted. 2 T.K. Llanto et al SN P systems are shown to be Turing Complete both in generating and accepting modes [4]. From this, multiple attempts to find universality by restricting the system have been made. This includes limiting the maximum number of rules, bounded and unbounded regular expressions, spikes consumed, delay, or synapse out-degree of the graph [5]. This method of restricting SN P systems and still having the same computational power is important in the discussion of normal forms. A popular example of this is the Chomsky normal form where using only two different forms of rules in context-free grammars is enough to generate all context-free sets. A Homogeneous Spiking Neural P System (HSN P System) is another way of representing SN P systems in a different form but having the same computation. In an HSN P system, each neuron contains the same set of rules [6]. It is also shown in the paper that the universality of HSN P system is retained for such forms. Having the same set of rules allows the important features of the system to be on the structure itself (e.g., the connection of neurons) rather than on an individual rule set. In order to transform a non-homogenized SN P system to its homogenized counterpart, an algorithm needs to be followed. In the paper [7] they proposed two algorithms on how to homogenize a given SN P system. Both algorithms follow almost the same procedure except for the scaling part. One algorithm uses the Type-2 Subsystem Scaling method while the other uses the Released Spike Scaling method. Algorithm proof is shown in the paper on the correctness of the algorithms. But, the time complexity and empirical running time of the algorithms are yet to be analyzed. In this research, we will attempt to find both the theoretical complexity and the empirical running time of both algorithms. We would also create code implementations of the homogenization procedures using the Python programming language. It is integrated with WebSnapse v2 from [8], to easily visualize both algorithms. In this paper, the sections are organized as follows: Section 2 discusses the preliminaries for our work. Section 3 discusses works related to the present paper, especially the homogenization algorithms. Our experiments, results, and their discussion are provided in Section 4, which also includes theoretical analyses of the algorithms. Lastly, Section 5 provides conclusions and recommendations for further works. 2 Theoretical Framework 2.1 Formal Language Definitions This paper assumes that the reader is familiar with automata theory and basic languages. Here, we define some formal language notations that would be helpful for later concepts. Homogenisation Algorithms for SN P Systems in WebSnapse 3 Let Vbe an alphabet. We denote the empty string as λ. The set of all finite strings of symbols from Vis denoted as V∗and the set of all nonempty finite strings is denoted as V+. 2.2 Spiking Neural P Systems In membrane computing, Spiking Neural P Systems (SN P system) takes inspirations from the behaviour and structures of a neural cell or neuron. An SN P system consists of a group of nodes called neurons that are connected by directed edges called synapses. A neuron can spike the same way a cell can send electrical pulses to its neighbor cells [3]. Each neuron contains a spike count and a set of rules that determines its behavior. A rule consists of a regular expression, the number of spikes consumed and released when activating the rule, and the delay before the spikes are released. In short, rules dictate the action a neuron is going to do given a specific number of spikes. More formally, the following definition is given in the paper [9] : Definition 1. A computing extended SN P system, of degree m≥1, is a construct of the form Π= (O, σ1, . . . , σm, syn, in, out)where: 1. O={a}is the singleton alphabet (ais called spike); 2. σ1, . . . , σmare neurons, of the form σi= (ni, Ri),1≤i≤m, where: a) ni≥0is the initial number of spikes contained in σi; b) Riis a finite set of rules of the following two forms: i. E/ac→ap;d, where Eis a regular expression over aand c≥p≥ 1, d ≥0; ii. as→λ, for s≥1, with the restriction that for each rule E/ac→ap;d of type (i) from Ri, we have as∈ L(E); 3. syn ⊆ {1,2, . . . , m}×{1,2, . . . , m}with i=jfor all (i, j)∈syn,1≤i, j ≤m (synapses between neurons); 4. in, out ∈ {1,2, . . . , m}indicate the input and the output neurons, respectively. Rules that are in the form of 2(b)i are called firing rules (or spiking rules). On the other hand, rules of the form 2(b)ii are called forgetting rules. Restricting the SN P system so that each firing rule produces only one spike is a class of SN P systems called standard SN P system. A rule in the form ac/ac→ap;dcan be written in the simplified form ac→ ap;d. For the firing rule E/ac→ap;dto work, the number of spikes kin the neuron must be in the regular expression, i.e., ak∈L(E). The number of spikes consumed cin the rule must also be at most k, i.e., k≥c. If these conditions are met, the rule would be applied. Upon firing, the number of spikes of the neuron would be k−c. After dtime steps, the neuron would send pspikes to its synapses. While 4 T.K. Llanto et al a rule is waiting to be fired because of the delay, the neuron would close and it cannot receive new incoming spikes during this period. If a spike is sent to this neuron, it is said that the spike is lost. After dsteps, the neuron would become open again and sends pspikes to its synapses. For the forgetting rule as→λto work, the number of spikes kin the neuron must be exactly s, i.e., k=s. Upon firing, all kspikes of the neuron would be removed. It is possible that at least two rules can be applied given the number of spikes k of the neuron. This could happen if ak∈L(E1) and ak∈L(E2), where E1and E2 are regular expressions of different rules. In this scenario, the computation would non-deterministically choose a rule to be applied from one of them. Definition 2. In each time step, the system can be represented by a configuration ⟨r1/t1, . . . , rm/tm⟩where neuron σicontains ri≥0spikes and will be opened after ti≥0steps, for i= 1,2, . . . , m. The initial configuration would be C0= ⟨n1/0, . . . , nm/0⟩where niis the initial number of spikes of neuron σi. Definition 3. A neuron and its rules can be classified into these three types according to [10]: 1. A bounded neuron has rules of the form ai/aj→ap;d, where 1≤j≤i, p ≥0, and d≥0. These rules are called bounded rules. 2. An unbounded neuron has rules of the form ai(ak)∗/aj→ap;d, where i≥ 0, k ≥0,i+k≥1,j≥1, p ≥0,and d≥0. These rules are called unbounded rules. Note that bounded rules also classify as unbounded rules. 3. A general neuron can contain both bounded and unbounded rules. Definition 4. With these, we can define three types of SN P systems: 1. A bounded SN P system has bounded neurons. 2. An unbounded SN P system has neurons that are either bounded or unbounded. 3. A general SN P system has general neurons (i.e., each neuron has rules that are either bounded or unbounded). An SN P system can be represented using a directed graph. Below is an example SN P system with parts shown: 3 Related works 3.1 Normal Forms of SN P Systems It is shown in [4] that SN P systems are Turing complete. Multiple normal forms of SN P system have been developed over the years to extensively test its universality given some restrictions. In [5], it is shown that having a delay of 0 in each firing rule of an SN P system, having a maximal outdegree of two for each of the synapses, or having firing rules on the simplest form ai, i ≥1, or a+also preserves universality. Homogenisation Algorithms for SN P Systems in WebSnapse 5 Fig. 1. A graphical representation of an SN P system and its parts Definition 5. The following notation is used to present restrictions on an SN P system [11]: SNP(rulek, expub b, consp, forgq, dleyr, outds) where:  kdenotes the maximum number of rules each individual neuron can have,  bdenotes the number of distinct bounded regular expressions used in all the rules in the entire system,  ub denotes the number of distinct unbounded regular expressions used in all the rules in the entire system,  pdenotes the maximum number of spikes consumed by each spiking rule in a single firing,  qdenotes the maximum number of spikes consumed by each forgetting rule in a single firing,  rdenotes the maximum delay duration, and,  sdenotes the maximum synapse out-degree of the graph. Below are some examples of normal forms of SN P systems from [11]:  N2SNP(rule2, exp1 0, cons3, forg0, dley0, outd3)  NaccSNP(rule1, exp1 0, cons3, forg0, dley0, outd3) 6 T.K. Llanto et al N2SNP here denotes an SN P system in generating mode (i.e., the result of the computation is the set of all time intervals between two consecutive spikes in the output) while NaccSNP denotes an SN P system in accepting mode (i.e., the result of the computation is the set of all input time intervals where the system halts). In the above normal form for generative mode, having at most two rules per neuron and one type of unbounded regular expression is sufficient for universality. For the accepting mode, the maximum number of rules a neuron can have is reduced to one. 3.2 Homogeneous SN P Systems In addition to the parameters presented in SNP(rulek, expub b, consp, forgq, dleyr, outds), another restriction would be the limitation of having the same set of rules in each neuron. We call systems with such limitations as Homogeneous Spiking Neural P Systems (HSN P Systems) [6]. It is proven in [6] that HSN P systems are also Turing complete (i.e., N2HSNP = NRE) both in weighted and usual synapses such that only one neuron behaves non-deterministically. Homogenized neurons can work with many different types of SN P systems and still achieve universality. Some examples include:  HSN P systems that work in sequential mode as both generating and accepting devices [12].  Homogeneous SN P systems with anti-spikes (HASN P systems) [13].  HSN P systems with inhibitory synapses [14].  Homogeneous SN P systems with structural plasticity (HSNPSP system) [15]. Since the rules in an HSN P system are the same for each neuron, its graphical representation could use a single neuron that contains the homogenized rule set and omit the visual rule set in each neuron. An example of an HSN P system is shown in Figure 2. Homogenizing an SN P system allows us to focus on the level of the connection of neurons instead of dealing with individual neurons themselves [15]. Spiking Neural P Systems with astrocytes (SNPA systems) uses astrocytes that can inhibit or excite spikes along synapses [16]. The paper [17] uses Homogeneous SNPA (HSNPA) systems to create the Boolean logic gates NOT, OR, AND, NOR, XOR, and NAND. This means that the each neuron contains the same rule set. The rule set that is used contains a single spiking rule a∗/a →a. Below is an example HSNPA system for the NOR gate: To simulate a logic gate, an interpretation on what represents 0 and 1 needs to be defined. In this case, an input of a single spike represents the digit 0 and an input of two spikes represents the digit 1. For the output, if the number of total spikes after the system halts is one, then the result would be the digit 0. But if the Homogenisation Algorithms for SN P Systems in WebSnapse 7 Fig. 2. A graphical representation of an HSN P system Fig. 3. HSNPA system simulating the NOR boolean logic gate number of total spikes after the system halts is two, then the result would be the digit 1. For Figure 3, the system outputs two spikes only if both the input neurons receive one spike (i.e., the result would be 1 only if both inputs are 0). The paper [17] uses the benefits of homogeneous SN P systems to create logic gates. The presented SN P systems are already homogenized and no conversion from a non-homogenized to a homogenized SN P system was shown. In contrast, the present paper implements and analyses the two algorithms presented in [7] that converts a non-homogenized SN P system to a HSN P system. 8 T.K. Llanto et al 3.3 Homogenization Algorithms The paper [7] focused on the creation of two homogenization procedures for SN P systems. We will call the first algorithm as Algorithm 1:H(Type 2 Subsystem Scaling) and the other as Algorithm 2:H′(Released Spike Scaling). Each has its own advantages and limitations. Using any of the two algorithms, a nonhomogeneous SN P system Πcan be transformed to a corresponding homogeneous SN P system Π′where they compute the same set/languages. Before discussing the algorithms, some definitions from [7] are first provided. For the homogenization procedure, scaling and translation operations are going to be used for neurons and their rule set. These operations change the number of spikes and/or rules of a neuron. Below are the following operations: Definition 6. Neuron translation takes a neuron σ= (n, R)and a natural number δas input. It produces σ′= (n+δ, R′)where R′={aδE/ac→β|E/ac→β∈R}. Definition 7. Neuron subsystem scaling takes a subsystem sub and a natural number δas input. A subsystem sub of a neuron σis the set of all neurons connected to it. It produces a new subsystem sub′where:  sub′contains neuron σ′= (δn, R′)where R′={δE/aδc →β|E/ac→β∈R},  sub is scaled using either one of Type 1 or Type 2 subsystem scaling. – (Type 1 subsystem scaling) In sub, if neuron xis connected to neuron σ, then in sub′there will be δcopies of neuron x. Each copy of neuron xwill have the same incoming synapses. They would also have the same outgoing synapses to neuron σ. Only the original copy will retain the outgoing synapses to other neurons. – (Type 2 subsystem scaling) In sub, if neuron xis connected to neuron σ, then in sub′there will be δcopies of multiplier neurons. Neuron xis connected to all the multiplier neurons while all the multiplier neurons are connected to neuron σ′. A multiplier neuron would have the rule set of the form aj→ajwhere j= 0 is the number of spikes a rule in neuron x can produce. Algorithm 1 will use Type 2 subsystem scaling. For this to work, the input SN P system must be 1-step delay-tolerant. Definition 8. An SN P system is said to be 1-step delay-tolerant if for all (σi, σj) pairs of neurons of system Πwhere (i, j)∈syn you can add a delaying neuron σk between σiand σjwithout changing the set that Πcomputes. The delaying neuron σkwill have rules of the form ap→apwhere prepresents the number of spikes a rule in σican release. Below are the homogenization algorithms presented in the paper [7]: Homogenisation Algorithms for SN P Systems in WebSnapse 9 Algorithm 1 (Type 2 Subsystem Scaling) H Input: SN P system Πwith set of unique neuron rule sets {R1, ..., Rp}. Output: Homogenized SN P system Π′=H(Π) R←(pR1+ 0) ∪(pR2+ 1) ∪ · · · ∪ (pRp+ (p−1)) Perform type-2 subsystem scaling to all neurons using the factor p Neurons with rule set Ri∈ {R1, ..., Rp}will be translated by i−1 Let R0be the union of the rule sets of all multiplier neurons added during type-2 scaling t←max{j|aj→aj∈R0}+ 1 R←R0∪(R+t) Neuron translate all non-multiplier neurons by t Use Ras the common rule set Algorithm 1: Type-2 Subsystem Scaling Below is an example of how Algorithm 1 can be used to homogenize the given SN P system in Figure 4: Fig. 4. sample input SN P system Π The unique neuron rule sets of the input SN P system are R1={a3/a2→a; 0} and R2={a/a →a; 0, a2/a →a; 0}. Since we have two unique rule sets, p= 2. We need to find Rwhere R←(2R1+ 0) ∪(2R2+ 1). Scaling R1by 2 and translating it by 0, we get 2R1+ 0 = {a6/a4→a; 0}while scaling R2by 2 and translating it by 1, we get 2R2+ 1 = {a3/a2→a; 0, a5/a2→a; 0}. Thus R={a6/a4→a; 0}∪{a3/a2→a; 0, a5/a2→a; 0}={a6/a4→a; 0, a5/a2→ a; 0, a3/a2→a; 0}. Neuron σ1will also contain a modified version of the rule set R2and its initial spike count would be scaled by 2 and translated by 1, i.e., σ1would contain 2(2) + 1 = 5 initial spike count. Similarly, neuron σ2will also contain a modified version of the rule set R1and its initial spike count would be scaled by 2 and translated by 0, i.e., σ2would contain 2(3) + 0 = 6 initial spike count. Since both neurons are scaled by 2, the spikes received from their incoming edges should also be scaled by 2. Note that in this case, only the edge σ1→ 16 T.K. Llanto et al homogenized rule sets are the same, the implementation could be modified so that it stores only a single copy and each neuron would only reference the same copy. In this kind of implementation, space complexity reduces to O(n3+nk). Algorithm 2: Released Spike Scaling The time complexity of the homogenization algorithm that uses released spike scaling is O(nk). In this kind of scaling, no new multiplier neuron is introduced. So, the algorithm only iterates over nneurons and for each neuron it iterates over kspikes. Thus, its time complexity would be O(nk). For its space complexity, it takes up O(n2k) space. Suppose that each rule is unique from all the other rules. The common rule set would be the combination of the scaled and translated unique rules. So, there would be a total of nk combined and homogenized rules. Note that each of the nneurons would now contain the rule set with nk rules. Thus, the total space required would be the product of the number of neurons and the number of rules in the common rule set, i.e. n(nk) = n2k. Note that this space complexity assumes that the memory stores the common rule set in each neuron, meaning it has a copy for each neuron. If the implementation assumes that only one copy of the common rule set would be saved, the space complexity reduces to O(nk +n) = O(nk). Comparison of the Two Algorithms Figure 9 visualizes the theoretical time complexity of both algorithms when the number of neurons increases while kremains constant. Notice how much slower Algorithm 1 takes to run than Algorithm 2 as the number of neurons increases. The time difference of the two algorithms is in the factor of n3k/nk =n2. 4.5 Empirical Running Time Analysis In order to test the accuracy of the theoretical time complexity of the two algorithms, an analysis of the empirical running time was made. Each example from Figure 9 was used as an input for both Algorithm 1 and Algorithm 2 in the Python code implementation and their durations were recorded. Within the Python code, the function timeit from the timeit library was used to accurately measure the duration of the algorithms. Figure 10 shows the summary of the results. It accurately resembles on that of the theoretical graph from Figure 9. 4.6 Simulation Speed Comparison (Homogenized vs Heterogeneous) To get the speed comparison of the simulation of the heterogeneous SN P system vs its equivalent homogeneous SN P systems in HWebSnapse, five samples (ex1-ex5) from Table 1 were used. Within the HWebSnapse JavaScript code, the simulation Homogenisation Algorithms for SN P Systems in WebSnapse 17 Fig. 9. Comparison of Theoretical Time Complexity of Algorithms 1 and 2 Fig. 10. Comparison of Empirical Running Time of Algorithms 1 and 2 18 T.K. Llanto et al delay speed was removed and the function performance.now() was used to calculate the simulation time. For each of the original heterogeneous SN P systems, their simulation time was recorded. Then each would be homogenized using both Algorithm 1 and Algorithm 2. The simulation speeds of these homogenized SN P systems were also recorded. Each simulation of an SN P system was repeated five times and their average was taken. For all the examples, it is evident that the simulation made by Algorithm 2 is much faster than the simulation made by Algorithm 1. Although simulations of HSN P systems produced by both Algorithm 1 and Algorithm 2 were slower than their original heterogeneous counterpart. On average from the five samples, HSN P systems produced by Algorithm 1 were 148% slower than their original heterogeneous counterpart. While HSN P systems produced by Algorithm 2 were only 3% slower. Fig. 11. Simulation Speed of Heterogeneous vs Homogenized SN P Systems 4.7 Type-2 Subsystem Scaling vs Released Spike Scaling Both algorithms have their own advantages and limitations. Below is a detailed list of their comparison. A summary is shown in Table 2. 1. In terms of the number of neurons, HSN P systems derived using Algorithm 2 have fewer neurons. This is because, in Algorithm 1, multiplier neurons are Homogenisation Algorithms for SN P Systems in WebSnapse 19 added when the scaling operation is used while there are no new neurons added when scaling neurons in Algorithm 2. 2. In terms of algorithmic speed, Algorithm 2 is faster than Algorithm 1 by a factor of n2where nis the number of neurons. 3. In terms of memory, Algorithm 2 takes less space than Algorithm 1 by a factor of n2where nis the number of neurons. 4. In terms of the simulation speed, simulations of HSN P systems produced by Algorithm 2 are much faster than those produced by Algorithm 1. 5. In terms of the limitation of the type of SN P system input allowed, Algorithm 2 can take any SN P system while Algorithm 1 requires the input to be 1-step delay-tolerant. 6. In terms of flexibility of graph structure, Algorithm 1 can have multiple neuron structures based on the technique of scaling operation used. On the other hand, Algorithm 2 would output the same graph structure. 7. In terms of the input train of spikes, Algorithm 2 requires the spikes to also be scaled by p. For example, the train spikes 0101 where p= 3 should be scaled to 0303. On the other hand, Algorithm 1 does not need the input train of spikes to be scaled. 8. In terms of the output train of spikes, Algorithm 2 scales the expected output by p. For example, the output train spikes 0101 where p= 3 would be scaled to 0303. On the other hand, Algorithm 1 does not scale the output train spikes. Advantage Type-2 Subsystem Scaling Released Spike Scaling Smaller number of neurons ✓ Faster algorithm ✓ Less memory ✓ Faster simulation speed ✓ Not limited to 1-Step Delay-Tolerant ✓ Flexibility ✓ Does not need to scale input ✓ Does not scale output ✓ Table 2. Advatanages of Algorithm 1 vs Algorithm 2 4.8 Support for JSON format Other papers have attempted to improve the overall functionality of WebSnapse v2. One of these is WebSnapse v3 which improves WebSnapse v2’s performance and stability issues [20]. WebSnapse Reloaded is another improvement of Web- Snapse v2 which enhances its storage, scalability, and maintainability [21]. Both these SN P simulators use the JSON format instead of the XML format that is used in WebSnapse v2. To support these simulators, the backend API of 20 T.K. Llanto et al the homogenization algorithm also allows JSON input and output SN P systems, in addition to XML format. 5 Final Remarks In the paper [7], two homogenization algorithms were proposed. This study aimed to analyze their time and space complexity, and simulation speeds. An actual code implementation of the algorithms was also made using Python v3.11 and it is integrated as a backend Flask server in HWebSnapse, a spin-off version of the WebSnapse v2 with the homogenization feature. The source codes and test cases are publicly available at [18] and anyone can use them to homogenize a given SN P system following the present paper and based on [7]. As for the topic of homogenization of an SN P system, its uses and advantages are discussed in [6]. If a system is homogenized, this means that each neuron contains the same set of rules. This simplifies the system where its behavior is only determined by the overall structure, i.e., how the neurons are connected, instead of also focusing on rules on each individual neuron. Additionally, the same rule set could also be stored in memory once instead of making a copy for each neuron. As suggested in the paper [7], future research can focus on possible optimizations of the homogenization algorithms. This could be made easier with the actual Python code implementation. For example, the time complexity of Algorithm 1 that is used on a fully connected graph can be reduced from O(n3k) to O(n2k) by considering a different graph design. Consider neuron σawith outgoing edges connected to all other neurons σb1, σb2, .... Instead of having a set of multiplier neurons for each outgoing edge of σa, we would only have a single set of multiplier neurons and connect them to each of the other neurons. This is possible since the set of multiplier neurons from σato σbi are the same. Note that it can be further reduced to O(n2+k) if the homogenized rule set is only stored once. As for the space complexity of Algorithm 1, using the same set of multiplier neurons reduces the space complexity from O(n3+nk) to O(n2+nk). An improvement for the HWebSnapse is instead of a backend server, the homogenization algorithm could be integrated directly into the frontend code, e.g. JavaScript in WebSnapse. This could reduce delay time since computations could be made locally. It is discussed that Algorithm 1 requires its input to be 1-step delay-tolerant. But, in the paper [7], it is argued that the set of 1-step delay-tolerant SN P systems is also universal. If an algorithm can be made that transforms a non-delay-tolerant SN P system into a delay-tolerant one, the resulting SN P system can be used as an input to Algorithm 1. This would remove the limitation on the input of the algorithm. Support of the algorithms for newer (and contemporaneous to the present paper) versions such as WebSnapse v3 [20] and WebSnapse Reloaded [21] should be Homogenisation Algorithms for SN P Systems in WebSnapse 21 explored in future studies. These newer versions use JSON format for the representation of their SN P system, instead of the XML format used in WebSnapse v2. The tool in the present paper already supports JSON format, so support for newer versions of WebSnapse, as well as well-known software for P systems such as P-Lingua and MeCoSim [22] has started. Finally, an analysis of how much memory is reduced when saving HSN P systems is recommended for future research. Acknowledgements Support for F.G.C. Cabarle: the Dean Ruben A. Garcia PCA, and Project No. 222211 ORG from the Office of the Vice Chancellor for Research and Development, both from UP Diliman; the QUAL21 008 USE project (PAIDI 2020 and FEDER 2014-2020 funds). The authors are thankful to the IMCS Bulletin for allowing us to share our work. References 1. Gh. P˘aun, “Computing with membranes,” Journal of Computer and System Sciences, vol. 61, no. 1, pp. 108–143, 2000. 2. G. P˘aun, “A quick introduction to membrane computing,” The Journal of Logic and Algebraic Programming, vol. 79, no. 6, pp. 291–294, 2010. 3. M. Ionescu, G. P˘aun, and T. Yokomori, “Spiking neural p systems,” Fundamenta informaticae, vol. 71, no. 2-3, pp. 279–308, 2006. 4. A. Leporati, G. Mauri, and C. Zandron, “Spiking neural p systems: main ideas and results,” Natural Computing, pp. 1–21, 2022. 5. O. H. Ibarra, A. P˘aun, G. P˘aun, A. Rodr´ıguez-Pat´on, P. Sos´ık, and S. Woodworth, “Normal forms for spiking neural p systems,” Theoretical Computer Science, vol. 372, no. 2-3, pp. 196–217, 2007. 6. X. Zeng, X. Zhang, and L. Pan, “Homogeneous spiking neural p systems,” Fundamenta Informaticae, vol. 97, no. 1-2, pp. 275–294, 2009. 7. R. T. A. de la Cruz, F. G. C. Cabarle, and H. N. Adorna, “Steps toward a homogenization procedure for spiking neural p systems,” Theoretical Computer Science, vol. 981, p. 114250, 2024. 8. N. Cruel, C. Quirim, and F. G. C. Cabarle, “Websnapse v2.0: Enhancing and extending the visual and web-based simulator of spiking neural p systems,” in Pre-proceedings of the 11th Asian Conference on Membrane Computing, Quezon City, Philippines, pp. 146–166, September 2022. 9. G. P˘aun, “Spiking neural p systems. a tutorial.,” Bulletin of The European Association for Theoretical Computer Science, vol. 91, pp. 145–159, 2007. 10. O. H. Ibarra and S. Woodworth, “Spiking neural p systems: some characterizations,” in Fundamentals of Computation Theory: 16th International Symposium, FCT 2007, Budapest, Hungary, August 27-30, 2007. Proceedings 16, pp. 23–37, Springer, 2007. 11. I. C. H. Macababayao, F. G. C. Cabarle, R. T. A. de la Cruz, and X. Zeng, “Normal forms for spiking neural p systems and some of its variants,” Information Sciences, vol. 595, pp. 344–363, 2022. 22 T.K. Llanto et al 12. K. Jiang, T. Song, W. Chen, and L. Pan, “Homogeneous spiking neural p systems working in sequential mode induced by maximum spike number,” International Journal of Computer Mathematics, vol. 90, no. 4, pp. 831–844, 2013. 13. T. Song, X. Wang, Z. Zhang, and Z. Chen, “Homogenous spiking neural p systems with anti-spikes,” Neural Computing and Applications, vol. 24, pp. 1833–1841, 2014. 14. T. Song and X. Wang, “Homogenous spiking neural p systems with inhibitory synapses,” Neural Processing Letters, vol. 42, 04 2014. 15. R. T. A. de la Cruz, F. G. C. Cabarle, I. C. H. Macababayao, H. N. Adorna, and X. Zeng, “Homogeneous spiking neural p systems with structural plasticity,” Journal of Membrane Computing, vol. 3, pp. 10–21, 2021. 16. G. P˘aun, “Spiking neural p systems with astrocyte-like control.,” J. Univers. Comput. Sci., vol. 13, no. 11, pp. 1707–1721, 2007. 17. T. Song, P. Zheng, M. D. Wong, and X. Wang, “Design of logic gates using spiking neural p systems with homogeneous neurons and astrocytes-like control,” Information Sciences, vol. 372, pp. 380–391, 2016. 18. “Websnapse page,” 2023. https://aclab.dcs.upd.edu.ph/productions/software/ websnapse. 19. A. Leporati, G. Mauri, C. Zandron, G. P˘aun, and M. P´erez-Jim´enez, “Uniform solutions to sat and subset sum by spiking neural p systems,” Natural Computing, vol. 8, pp. 681–702, 12 2009. 20. L. Gallos, J. L. Sotto, F. G. C. Cabarle, and H. N. Adorna, “Websnapse v3: Optimization of the web-based simulator of spiking neural p system using matrix representation, webassembly and other tools,” in Pre-proc. 12th Workshop on Computation: Theory and Practice (WCTP2023), 4 to 6 December 2023, Chitose-city, Hokkaido, Japan (S. Hagihara, S. ya Nishizaki, M. Numao, J. Caro, and M. T. Suarez, eds.), pp. 492–510, 2023. 21. M. Gulapa, J. S. Luzada, F. G. C. Cabarle, H. Adorna, K. Bu˜no, and D. Ko, “Websnapse reloaded: The next-generation spiking neural p system visual simulator using client-server architecture,” in Pre-proc. 12th Workshop on Computation: Theory and Practice (WCTP2023), 4 to 6 December 2023, Chitose-city, Hokkaido, Japan (S. Hagihara, S. ya Nishizaki, M. Numao, J. Caro, and M. T. Suarez, eds.), pp. 511–536, 2023. 22. L. Valencia-Cabrera, M. ´ A. Mart´ınez-del Amor, and I. P´erez-Hurtado, “A simulation workflow for membrane computing: From mecosim to pmcgpu through p-lingua,” Enjoying Natural Computing: Essays Dedicated to Mario de Jes´us P´erez-Jim´enez on the Occasion of His 70th Birthday, pp. 291–303, 2018. 6 Appendix 6.1 Appendix A: Test Results of Homogenization Algorithms using WebSnapse v2. This appendix contains a comparison of the result of the output of seven SN P systems on the result of their homogenized counterparts. The links to the application, the source files, documentation can be found at the WebSnapse page at [18]. The data is in a Spreadsheet file and can be accessed at https://github.com/pyTimK/ Homogeneous-Algorithm-for-SN-P-System/tree/main/analysis/testing. Analysis of the output spikes are also included within the spreadsheet. Homogenisation Algorithms for SN P Systems in WebSnapse 23 6.2 Appendix B: Comparison of Theoretical Time Complexity of Algorithms 1 and 2 This appendix contains the data on the comparison of the theoretical time complexity of Algorithms 1 and 2. The data is in a Spreadsheet file and can be accessed at https://github.com/pyTimK/Homogeneous-Algorithm-for-SN-P-System/tree/ main/analysis/time_complexity_and_empirical_running_time. A summary of the spreadsheet can be seen on Figure 9. 6.3 Appendix C: Comparison of Empirical Running Time of Algorithms 1 and 2 This appendix contains the data on the comparison of the empirical running time of Algorithms 1 and 2. The data is in a Spreadsheet file and can be accessed at https: //github.com/pyTimK/Homogeneous-Algorithm-for-SN-P-System/tree/main/ analysis/time_complexity_and_empirical_running_time. A summary of the spreadsheet can be seen on Figure 10. 6.4 Appendix D: Comparison of Simulation Speed of Heterogeneous and Homogenized SN P Systems This appendix contains data on the comparison of the simulation speed of a heterogenized SN P system and its homogeneous forms. The data is in a Spreadsheet file and can be accessed at https://github.com/pyTimK/Homogeneous-Algorithm-for-SN-P-System/ tree/main/analysis/simulation_speed. A summary of the spreadsheet can be seen on Figure 11. 6.5 Appendix E: Running The Implemented Python Script The implementation of the homogenization algorithms is in GitHub and is accessible at the following link: https://github.com/pyTimK/Homogeneous-Algorithm-for-SN-P-System. The program can be run as follows: 1. Clone repo using git clone https://github.com/pyTimK/Homogeneous- Algorithm-for-SN-P-System.git homogeneous_algorithm 2. Go to the cloned directory 3. Open the command prompt and run python -m venv venv 4. Open the virtual environment via venv\Scripts\activate.bat 5. Install packages using pip install -r requirements.txt 6. Run python main.py 7. To use a custom SN P system xmp input, put the file inside /input directory and change input_name global variable in the main.py to the name of the input file. 24 T.K. Llanto et al 6.6 Appendix F: Using the Homogenize feature in HWebSnapse This appendix discusses the step-by-step procedure on how to use the homogenize feature in HWebSnapse. 1. Go to https://websnapse-homogenize.netlify.app 2. Create an SN P system from scratch or load an XML file 3. Press the Homogenize Button 4. Select between Type 2 Subsystem Scaling or Released Spike Scaling 6.7 Appendix G: Test Empirical Running Time of Homogenization Algorithms in Python Implementation This appendix discusses the step-by-step procedure on how to compute the empirical running time of Algorithm 1 and Algorithm 2 in a given SN P system. This uses the timeit library. 1. Open main.py in the Python project directory 2. Set the global variable get_actual_running_time to true 3. Set the global variable test_runs to the desired number of test runs. The default is 500 4. Select from any SN P system from the \input folder or create one on your own 5. Set the global variable input_name to the input name of the SN P system file 6. Run the script using python main.py 7. The console would print the average running time for both algorithms Sample output: ex1.xmp (ScalingType.TYPE_2_SUBSYSTEM_SCALING): 0.022716799983754754 ms ex1.xmp (ScalingType.RELEASED_SPIKE_SCALING): 0.005746799986809492 ms 6.8 Appendix H: Getting the Simulation Time of an SN P system in HWebSnapse This appendix discusses the step-by-step procedure on how to get the simulation time of an SN P system. A feature in HWebSnapse is included that removes the simulation delay time and prints the execution time on the terminal. 1. Go to https://websnapse-homogenize.netlify.app/ 2. Create a new SN P system or load an XML file 3. Open the sidebar and tick the checkmark option Test simulation running time 4. Close the sidebar and press play 5. The console would print the simulation time in milliseconds. Sample output: The function took 593.5 milliseconds to run with pause times 0. Note that the pause times when the pause button is pressed is not included in the execution time.