<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Transferable Programs and Reactions for Modeling IoT Network</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Šárka Vavrečková</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Silesian University in Opava</institution>
          ,
          <addr-line>Bezručovo nám. 13, Opava</addr-line>
          ,
          <country country="CZ">Czech Republic</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Membrane systems and their diferent variants (e.g. P Colonies with transferable programs) can be used to model various processes if we are satisfied with simple rules manipulating the elements of a set of objects. However, these systems were designed more for computational purposes, so we may encounter problems when solving non-numerical problems. Reaction systems, on the other hand, come with the concept of reactants and inhibitors, which we can also use in simulating (typically dynamic) processes. In this paper, we compare these two concepts and propose a new type of system: IR Colonies, which are inspired by both of these concepts. The IR Colonies are designed to be mainly applicable for modeling communication in the Internet of Things networks. In the paper, the reader will find both a proposed definition of IR Colonies and an example of a network model with several IoT devices.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;IR Colony</kwd>
        <kwd>P System</kwd>
        <kwd>P Colony</kwd>
        <kwd>Transferable program</kwd>
        <kwd>Reaction system</kwd>
        <kwd>Network</kwd>
        <kwd>IoT</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>A network of reaction systems is a graph with reaction
systems as its nodes. Each reaction system can be afected
Membrane computing (introduced by Gheorghe Paˇun in by the reactions of its neighbours.
1998) is a framework for modeling parallel distributed There are several papers that combine the concept
processing. Information about this paradigm is available of P Systems (or P Colonies) and R Systems. In [10]
in [1, 2, 3], or the bibliography at http://ppage.psystems. the authors compare the two mentioned mathematical
eu/ [2024-07-04]. Membrane systems are based on the models and construct a P Colony simulating processes
hierarchical structure of cell membranes and can be used taking place in a reaction system. In [11] we can find the
to model distributed computing. Mathematical models concept of PR Systems, where reactions from reaction
of membrane systems have been called P Systems. systems are applied in membranes of a P System.</p>
      <p>P Colony (introduced in [4] in 2004) is a simple com- In [11] P Systems are referred to as a quantitative
putational model based on membrane systems. On the model because they focus primarily on computation,
basic variant, the environment containing objects of a whereas R Systems are referred to as a qualitative model
given type is shared by agents that also contain objects because they focus more on evolution. This does not
inside their internal environment and are equipped with mean that P Systems are of poor quality, just that their
programs consisting of rules. The programs allow the focus is diferent (on calculations, the result is a number).
agents to influence both their own environment and also In [12] we introduce a membrane system working as
the shared environment. a communication interface between IoT devices, but we</p>
      <p>P Colonies with transferable programs were intro- encounter problems with implementing some properties
duced in [5] and additional examples and discussions of the resulting system based on P Systems. P Systems
can be found in [6]. In the given concept, programs can have been found to be useful for this purpose, however,
be transferred between an agent and the environment a structure of membranes with unit rules (i.e. rules with
and vice versa, not only objects. a single symbol or object on both sides) is not flexible</p>
      <p>Reaction systems were introduced in [7], and in [8, 9] enough and some operations are not easy to implement.
we can find information about networks of reaction sys- On the other hand, membrane systems naturally
repretems. Reaction systems (R Systems) are a formal frame- sent the tree structure of a network interconnecting IoT
work intended for modeling interactions between bio- devices.
chemical entities. The intention was to simulate the co- In [6] we discuss properties of systems derived from
existence of two reverse mechanisms – using reactants P Systems – P Colonies, adding the concept of
transferand inhibitors. able programs introduced in [5]. In [6] only the basic idea
is outlined, in [6] we develop the idea and give further
ITAT’24: Information technologies – Applications and Theory, Septem- examples. The capabilities of P Colonies with
transferber 20–24, 2024, Drienica, Čergovské vrchy able programs are compared with the properties of the
$ sarka.vavreckova@fpf.slu.cz (ˇ. Vavrečková)</p>
      <p>© 2024 Copyright for this paper by its authors. Use permitted under Creative Commons License concept of osmotic computing and the functionality of
CPWrEooUrckReshdoinpgs IhStpN:/c1e6u1r3-w-0s.o7r3g ACttEribUutRion W4.0oInrtekrnsahtioonpal (PCCroBYce4.0e).dings (CEUR-WS.org) computer viruses, showing that similarities can be found
between the three concepts. However, for the purposes
of this paper, we are primarily interested in P Colonies
with transferable programs.</p>
      <p>The question is to what extent it would be possible to
replace the P Systems in the concept proposed in [12] by
P Colonies with transferable programs. The concept of
transferable programs naturally lends itself to e.g. the
distribution of updates, but on the other hand, the
possibility of representing the tree structure of the network
between IoT devices by membranes gets lost here – agents
in P Colony cannot be nested. And the environment is
only a repository of objects and programs, it is not able
to execute its own rules. Here, networks of reaction
systems, specifically a suitable combination with P Colonies
with transferable programs, could be helpful.</p>
      <p>This section is followed by the preliminaries section, in
which we briefly introduce P Colonies, P Colonies with
transferable programs, reaction systems and networks of
reaction systems. We also briefly introduce the world of
IoT devices.</p>
      <p>The subsequent section 3 is a brief comparison and
evaluation of the properties of P Colonies (with
transferable programs) and (networks of) reaction systems. In
particular, we observe states, rules, processes,
possibilities of cooperation of involved entities and sharing, also
possibilities for conditioning of events taking place in
the system.</p>
      <p>Section 4 proposes a definition of a new type of system:
the IR colony. The section describes and explains various
aspects of this system. IR Colony is used in Section 5
to create an outline of a model of communication in a
network with several devices.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Preliminaries</title>
      <p>We assume the reader to be familiar with the basics of the
formal language theory[13] and membrane computing
[3].</p>
      <p>We denote the length of a word  by ||, and also the
number of elements in a (multi)set  by ||. The empty
word is represented by the symbol , so || = 0.</p>
      <p>For details and definitions of the graph theory, we
can refer e.g. to https://www.britannica.com/topic/
graph-theory [2024-07-08]. We denote the set of all nodes
from which an edge leads to a node  by in().
the P Colony can be viewed as a two-level membrane
structure.</p>
      <p>Definition 1 ([5]). A P Colony of capacity ,  ≥ 1, is
a construct Π = ( , , ,  , 1, . . . , ) where
•  is an alphabet, its elements are called objects,
•  ∈  is the environmental object,
•  ∈  is the final object,
•  is a finite multiset over −{ } called the initial</p>
      <p>state of the environment,
• , 1 ≤  ≤ , are agents where each agent
 = (, ) is defined as follows:
–  is the initial state of the agent, a multiset</p>
      <p>over  consisting of  objects,
–  = {,1, . . . , , } is a finite set of
programs where each program consists of 
rules, the rules can be in one of the following
forms:
∗  → , ,  ∈  called an evolution</p>
      <p>rule,
∗  ↔ , ,  ∈  called a
communi</p>
      <p>cation rule,
∗ 1/2 called a checking rule, 1, 2
are both evolution or communication
rules.</p>
      <p>The evolution rules are of the form  → . This type
of rule allows the agent to influence its internal
environment: an object  inside the agent’s environment is
rewritten to the specified object .</p>
      <p>The communication rules ( ↔ ) are intended for
communication between the given agent and the
environment. An object  inside the agent is swapped with
the given object  in the environment.</p>
      <p>The checking rules (1/2) are composed of two rules
1 and 2 of any of the previous two types. The first rule
has a higher priority to apply, and if the first rule cannot
be executed, the second rule in order may be executed.</p>
      <p>The configuration of a P Colony Π with capacity  is
an ( + 1)-tuple of multisets  for 1 ≤  ≤  for the
agents , and  for the environment</p>
      <p>(1, . . . , ,  )
where  ∈ * , || = ,  ∈ * ,  ∈ (−{ })* .</p>
      <p>Several derivation modes have been defined, in [ 5] and
2.1. P Colonies [6] the maximally parallel derivation mode is primarily
P Colonies enrich the concept of P Systems by agents taken into account where all agents can work parallelly
evolving activities according to defined programs. On the in each derivation step (each agent non-deterministically
contrary, the complex structure of membranes was aban- chooses one of its programs with applicable rules). The
doned. An agent is actually analogous to a membrane calculation halts if no agent finds an applicable program.
within an environment of the main membrane so that
2.2. P Colonies with Transferable</p>
      <p>Programs
As mentioned above, the concept of transferable
programs for P Colonies has been introduced in [5]. A
transferable program is an ordered pair</p>
      <p>(⟨simple_program⟩ ; {conditions})
located inside an agent or the environment. The program
can be transferred from the agent to the environment and
vice versa (from the source to the destination, depending
on the direction), and the stated condition determines
under what circumstances this transfer can occur. Two
types of conditions are admissible: an object condition
and a program condition.</p>
      <p>The “object” condition specifies which objects must
(or must not, with the negation symbol) be present in
the destination for the program to be transferable. This
condition is formed by multisets of objects, the size of
the multisets is equal to the capacity of the P Colony.</p>
      <p>The “program” condition specifies programs that must
(or must not) be present in the destination for the given
program to be transferable.</p>
      <p>Example 1. Let Π be a P Colony of capacity 2. The
capacity is reflected in both the number of objects in
agents’ environments and the number of rules in each
program.</p>
      <p>An example program with an object condition inside
an agent can be as follows:</p>
      <p>(⟨ → ;  ↔ ⟩ ; {, ¬})
This means that the given program is transferable only if
at least one occurrence of  and one occurrence of  is
present and there is no  pair, both in the environment
(the shared environment is the destination).</p>
      <p>An example program with a program condition inside
the environment can be as follows:</p>
      <p>(⟨ → ;  ↔ ⟩ ; {⟨ ↔ ;  → ⟩})
The given program can be transferred into an agent only
if the agent contains the program ⟨ ↔ ;  → ⟩.</p>
      <p>A combination of both types of conditions in a single
transferable program is allowed.</p>
      <p>According to [5], a program can be classified as
permament. When a permanent program is being transferred,
the program remains in the original location and the copy
is included in the destination location, but the program
loses this property at the new location. When a
nonpermanent program is being transferred, it is removed
from its original location.</p>
      <p>In each computation step, an agent can either apply
one of its applicable programs or transfer one of the
programs in or out[5]. This implies that the transfer of
programs is actually an analogy of programs.
A reaction takes place over a set of symbols, reactants.</p>
      <p>A reactant enters a (chemical or other) reaction and
changes into a product of the given reaction. The
reaction may not take place under certain circumstances
if an inhibitor is present in the environment (set), i.e.
a substance that slows down or prevents the reaction.</p>
      <p>Definition 2 (according to [9]). A reaction over a
finite nonempty set  is a triple  = (, ,  ) where
•  ⊆  is a set of reactants,  ̸= ∅,
•  ⊆  is a set of inhibitors,  ∩  = ∅,
•  ⊆  is a set of products,  ̸= ∅.</p>
      <p>The set  is called the background set.</p>
      <p>Denote by res( ) the result of applying the reaction 
to the set  , we call the function res() the result function.</p>
      <p>A reaction  = (, ,  ) with  = res( ) is enabled
in a configuration  ⊆  if
•  ⊆  , and
•  ∩  = ∅.</p>
      <p>If res( ) = ∅, the reaction  is not enabled in the
configuration with the set  .</p>
      <p>We write , , , if we can stress the relationship to
the reaction .</p>
      <p>If  is the set of all reactions  over the background set
, we denote res set of results of all reactions belonging
to , so res = ∪∈.</p>
      <p>A reaction system is an ordered pair  = (, ) where
the finite nonempty set of reactions  is built over the
background set .</p>
      <p>In [9] we can also find the condition  ̸= ∅ for the set
of inhibitors, and the author states that by omitting this
condition we get an equivalent system, so here we stick
to the shorter definition without this condition.</p>
      <p>As we can see, the core of each reaction  is its function
res. The input of this function is a set  ⊆ , all
members of  are in  , no member of a set  should
be a part of  , and the output of the function is the set .</p>
      <p>The function should be computable, we can represent it
by rules, program code, etc. according to the particular
use of the system.</p>
      <p>Definition 3 (according to [9]). An interactive
process  in a reaction system  is a pair (,  ) such that
•  = 0, 1, . . . ,  (the context sequence),</p>
      <p>= 0, 1, . . . ,  (the result sequence),
•  ⊆ ,  ⊆ , 0 ≤  ≤ ,
•  = res(− 1 ∪ − 1) for each 1 &lt;  ≤ .</p>
      <p>The state sequence of the interactive process  is
0, . . . ,  where 0 = 0 is the initial state of 
and  =  ∪  for all 1 ≤  ≤ .</p>
      <p>The definitions show that the output of the system
depends on the initial state 0 (resp. the first context
0). For two diferent initial states, we get two diferent
outputs.</p>
      <p>For the purposes of this paper, it is very practical that
symbols (potential reactants) can be continuously added
to the system (by the members of the context sequence),
corresponding to processes occurring in dynamic
systems.</p>
      <p>Definition 4 (according to [9]). A network of reaction
systems is a tuple  = (, ℱ ,  ) where
•  = (, ) is a finite graph where  is a finite</p>
      <p>set of nodes (vertices) and  is a finite set of edges,
• ℱ is a nonempty finite set of reaction systems,
•  :  → ℱ is a location function, assigning
reac</p>
      <p>tion systems to nodes.</p>
      <p>Moreover, if  is undirected, then it is connected. If  is
directed, then it is weakly connected.</p>
      <p>Each reaction system can have a diferent background
set. Denote  the background set of the reaction system
 , 1 ≤  ≤ .</p>
      <p>The superscript (“ ”) in the following paragraphs
does not denote multiplicity, it denotes membership to
a ℎ R System in the network.</p>
      <p>Definition 5 (according to [9]). Let  = (, ℱ ,  )
be a network of reaction systems with | | = ,  ≥ 1.</p>
      <p>For  ∈ N+, an interactive (n-step) network process is
a tuple Π = (  1, . . . ,  ) where for all vertices  , 1 ≤
 ≤ :
•   = (  ,   ),   = 0 , 1 , . . . ,  (the context
sequence of the ℎ vertex),   = 0 , 1 , . . . , 
(the result sequence of the ℎ vertex),
•  ⊆  ,  ⊆  , 0 ≤  ≤ ,
•  =  ∩ (︁ ⋃︀1≤ ≤  − 1 ⃒⃒  ∈ in( ))︁ ,
•  = res ︀( − 1 ∪ − 1︀) for each 1 ≤  ≤ .
IoT (Internet of Things) devices are small, simple devices
that emphasize the ability to connect to other devices,
interact with each other, and automate their operation.</p>
      <p>Their programs are not usually complex (except perhaps
for security devices), and their operation consists mostly
of transmitting simple data ( either one-time or at regular
intervals) or, conversely, receiving simple data and then
reacting. For example, a thermometer sends the current
temperature to network at regular intervals, to which
a window controller can respond by opening or closing
a window, or a heating or air conditioning controller can
start or stop a related device. In [14] several definitions
of IoT network can be found, a more compact definition
is provided in [12].</p>
      <p>In IoT device networks, we encounter one of two
types of communication: Request-Response or
PublisherSubscriber. The Request-Response model comes from the
decentralized world of WWW networks. The
PublisherSubscriber model is better adapted to requests of IoT
networks or other automated systems, however, usually
a central control device is being used. More details about
IoT network communication models, including protocols,
can be found in [15].
3. Comparison of Base Systems
In this section, we compare the capabilities of P Colonies
with transferable programs and R Systems and/or
networks of R Systems.</p>
      <p>As mentioned above, various mathematical models
are either quantitative (as P Systems) or qualitative (as
R Systems). P Colonies can be considered as something
between quantitative and qualitative concepts, but close
to the first one. We need a system somewhere between
as well, but close to the second one, to be more suitable
for modeling and simulations.</p>
      <p>We can find some parallels between the concepts of
P Colonies with transferable programs and reaction
systems.</p>
      <p>Moreover, if in( ) = ∅, then  = ∅, 1 ≤  ≤ . States. In P Colonies, each agent has its own state, and
the shared environment has the state as well (all states</p>
      <p>The key for us is the ability of the individual compo- are the parts of the configuration). The agents can evolve
nents of the network (here reaction systems) to commu- their own state using evolution rules, and influence the
nicate with each other. It may look a bit complicated in state of the shared environment using communication
the definition, but the point is that at each step of the rules. Agents cannot directly afect the state of other
process, each system can send the result of its own re- agents, only indirectly through the environment.
action (product) to another system using the edge that Each R System has its own state too. Networked R
Sysconnects them. tems can both evolve their own state and influence the
states of neighbouring nodes through reactions, and they
can influence the states of other R Systems in the network
only indirectly through their neighbours.</p>
      <p>Rules, Processes, Functions. With using transferable The potential central component can be represented by
programs, the sets of programs inside agents and shared one of the network nodes, with an adjustment of the
environment are changeable. But programs can only network structure (e.g. a tree structure).
be transferred, not new ones created. When defining
a new P Colony, the format of the rules and programs is
predetermined. Even the number of objects in the agents’ 4. IR Colonies with Transferable
environments and the number of rules in programs is Programs and Reactions
given by the capacity of the P Colony.</p>
      <p>Every R System has its own set of reactions, and it is In [11], the authors have designed PR Systems in such
not possible to change or upgrade it subsequently. There a way that the rules of the P System have been replaced
is no strict form for the function res describing the reac- by reactions, i.e. each membrane has an associated set
tion  inside a reaction system, this function should only of reactions. This concept is interesting, but not very
be computable. However, the purpose of this function is suitable for our purposes (optimization for IoT network
to process a set of reactants and transform them into a simulation).
set of products, so this function can also be represented From the definition of the network of R Systems, we
by a set of rules (not necessarily simple or regular). take:</p>
      <p>When defining a new R System, we have a relatively
free hand and can better customize the system to what we
need to model (which is very practical for a qualitatively
oriented system intended for simulations of real systems);
some specific simulated systems cannot be represented
by regular or context-free rules.
• definition of infrastructure using a graph,
• system of reactions with reactants and inhibitors,
the rules will follow the computational function
with variable input arguments (not only static
objects),
• partly the principle of processes, context
se</p>
      <p>quence and result sequence,
• flexibility in the number of symbols/objects inside
agents’ states and rules in programs.</p>
      <p>Conditionality of Transfer or Reaction. The
original programs with rules in P Colony agents are static,
but transferable programs add dynamism. The object
conditions for transferable programs are analogous to
reactants (positive conditions) and inhibitors (conditions
with negation) used in R Systems.</p>
      <p>We can also consider as conditionality in R Systems
the fact that the reaction is only enabled in certain
conifgurations.</p>
      <p>P Colonies go a bit further, allowing the transfer
to be conditioned not only by objects but also by the
(non)presence of rules in the agent’s environment or in
the shared environment (depending on the transfer
direction).</p>
      <p>From the definition of the P Colonies with transferable
programs, we take:
• the system of agents and shared environment as</p>
      <p>storage for objects and programs,
• a set of objects as agent state, supplemented by
the ability to store objects in the shared
environment,
• some rule types in programs, transferable
pro</p>
      <p>grams.</p>
      <p>Since we want to design a quality-oriented system,
Cooperation and Sharing. In P Colonies with trans- we will abandon the capacity parameter. Each agent has
ferable programs, agents cooperate through a shared a specific role for which it needs a specific number of
environment. It is a two-level hierarchy, the shared en- objects in the environment and a diferently complex
provironment serves as a repository for objects and rules. gram. While abandoning capacity means that the ability
Individual agents do not communicate directly with each to compare with other systems and to represent various
other. This communication model corresponds to an characteristics of the system numerically is degraded, but
infrastructure with a central control component repre- these characteristics are not important for our purposes.
sented by the shared environment. Because, unlike other similar systems, we add variable</p>
      <p>R Systems themselves do not have a defined neigh- properties to objects, it makes no sense to work with
bourhood. However, the network of R Systems precisely multisets. In the definition, we can only find sets, which
defines the connections of R Systems as nodes of a graph. will ensure the determinism of each operation and make
Each R System is adjacent to at least one diferent R Sys- programming easier.
tem, all nodes communicate right with their neighbours,
with respect to edge directions. There is no shared
environment. This communication model allows using
various structures: centralized, decentralized, and distributed.</p>
      <p>Object Properties. Our system has a shared alphabet
of objects, but each object can have variable properties,
numbers from Z. For example, an agent representing
a device has an object in its state for the version of the
• multicast rule:  →−out , ,  ∈ Σ to send the
object  to all outgoing edges,  remains inside
the sending agent; if  = , it is not necessary to
specify the properties of the objects, the current
property of  is used,
• backup rule:  →,  ∈ Σ , to put the object
down into the environment (including its current
property), the object  remains in the agent’s
state,
• restoration rule: ← ,  ∈ Σ , to pick an object up
from the environment (including its current
property), the object  remains in the environment; if
 has been present in the state of the given agent,
the parameter will be rewritten (updated),
• programming rule:  ◁
The backup and restoration rule types apply the
unification operation, including the processing of parameters.</p>
      <p>The programming rule will be explained later.</p>
      <p>Denote  the set of all possible rules for Π . A
program in Π  is a construct lab = (lab, , , ) where
• each program has the own unique label lab,
•  ⊆  is a finite nonempty set of rules,
•  ⊆ Σ ∪  is a finite set of reactants, reactants
can be:
– an object with or without a property (a
relational expression can be added to the
object for its property),
– a relation between properties of diferent</p>
      <p>objects,
– a program,
•  ⊆ Σ ∪  is a finite set of inhibitors,  ∩  = ∅,
the syntax of elements of this set is the same as
for .</p>
      <p>IR Colony and Agents. An IR Colony (IoT Reaction
Colony) is a construct Π  = (Σ , , , ,  0, 0)
where
• Σ is a finite nonempty alphabet, a set of base</p>
      <p>objects, the objects can have default properties,
•  = {1, . . . , } is a finite nonempty set of</p>
      <p>agents,
•  = (, ) is a graph,  is a finite set of nodes,</p>
      <p>| | = ,  is a finite set of edges,
•  :  →  is a location function, locating agents</p>
      <p>into the graph nodes,
• 0 ⊆ Σ , 0 ̸= ∅ is the initial state of the shared</p>
      <p>environment,
• 0 is the initial set of programs located in the</p>
      <p>shared environment.</p>
      <p>If the graph  is undirected, then it is connected. If  is
directed, then it is weakly connected.</p>
      <p>An agent  , 1 ≤  ≤ , is a pair  = ( ,  )
where
•  ⊂ Σ ,  ̸= ∅ is the initial state of the agent, The set  must be deterministic in the sense that the
•  is the initial set of programs of the given agent, same object must not appear on the left-hand side of any
 is finite, and can be empty. two rules.</p>
      <p>A rule  ∈  with an object  ∈ Σ on the left side</p>
      <p>In the following paragraphs, we specify the individual is applicable to a state  of a given agent if the object
parts of this basic definition, we take into account an IR  is present in  including potential parameters. The
Colony Π  = (Σ , , , ,  0, 0) and  = (, ). restoration rule ←  is applicable if the object on the</p>
      <p>It should be noted that only agents can run programs,
it is not possible to run any program directly in the
environment.</p>
      <p>Process and States. The agents in , || = , work
synchronously in the weakly parallel mode, in
subsequent steps. In each step, every agent  , 1 ≤  ≤
non-deterministically chooses one of its applicable
pro</p>
      <p>,
grams and executes this program on its state.</p>
      <p>An n-step process in Π  is a tuple ( 0,  1, . . . ,  )
where for all agents  , 1 ≤  ≤ , is   = (  ,   ):
•   = ,0, ,1, . . . , (the context sequence),
•   = ,0, ,1, . . . , (the result sequence).
applying the multicast rules) for the ℎ step,  ≥
a program  ∈  is used by  in the given step:</p>
      <p>{︁
, =
() ⃒
⃒
⃒ (︁ () →−out ()
︁)</p>
      <p>}︁
∈  .</p>
      <p>If the property of object  is not specified in the rule,
the property  assigned when applying the rule (the
current property of object ) is used.</p>
      <p>, is a context set of an agent  = ( ,  ) for
⃒</p>
      <p>︁)
1≤ ≤  ,− 1 ⃒⃒  ∈ in( ) ,  () = 
the ℎ step:
, =
for all 1 ≤
︁( ⋃︀
 ≤</p>
      <p>.
right side is present in the environment. The
programming rule is always applicable.</p>
      <p>A program lab in an agent  = ( ,  ) is
applicable if
• all rules in  are applicable to  ,
• ( ∩ Σ) ⊆  , ( ∩  ) ⊆  ,
•  ∩  = ∅,  ∩  = ∅.</p>
      <p>Denote map (, ) the mapping function of an agent
 (towards its state) for a program  and a set of
objects  : the function captures the use of all rules
afecting the agent’s state contained in the program , just
except the multicast-type ones on the set  which do
not afect the state of the agent  .</p>
      <p>Denote map0(,  ) the mapping function of an
environment for some subset of agents’ programs  afecting
the environment (the backup and restoration rules).</p>
      <p>The sequence of states of the shared environment
appropriate to the given process is 0,0, 0,1, . . . , 0,:
• 0,0 = 0 ∪ 0,0,
• 0, = map0 (− 1,  ),  is a set of all
programs being used by agents in the given step
afecting the environment.</p>
      <p>The sequence of states of an agent  appropriate to the
given process is ,0, ,1, . . . , ,:</p>
      <p>• ,0 =  ∪ ,0,
, is a result of an agent  (towards its neighbourhood, inal program is overwritten (updated) by a new program
0, and
with the same label located in the repository.</p>
      <p>• , = map (,− 1 ∪ ,, ) , 1 ≤  ≤ ,</p>
      <p>is a program applied in the ℎ step.</p>
      <p>The given process can be shortly represented by the
sequence (0,0, . . . , ,0) ⇒</p>
      <p>* (0,, . . . , ,).</p>
      <sec id="sec-2-1">
        <title>Transferring</title>
      </sec>
      <sec id="sec-2-2">
        <title>Programs.</title>
        <p>Unlike
the
original
P Colonies with transferable programs, here we set
the automatic transfer of programs when the given
conditions are met.</p>
        <p>As stated above, a program is defined by a label, a set
of rules, a set of reactants, and a set of inhibitors. All
agents have their own initial set of programs, and the
environment carries the base repository of programs with
the initial state 0.</p>
        <p>A programming rule is a construct (label, , , ) ◁
with the parts of this sequence of the same meaning as
in the definition of a program. This rule creates a new
program with the given parameters and stores it in the
rule repository in the environment.</p>
        <p>Before starting each step in an IR colony, agents check
the program repository for a new program with a label
belonging to one of their programs. If so, the agent’s
origstep,
of agents.</p>
      </sec>
      <sec id="sec-2-3">
        <title>The flow of a process step.</title>
        <p>During a single step of
a process, the following happens (for a ℎ agent):
1. the agent checks the program repository and
updates its own programs,
applicable programs,
2. the agent nondeterministically chooses one of its
3. all rules in the program are processed with
inlfuencing the own state and computation of the
result and context sets for the given agent and
4. the result sets are used to calculate the new state
5. Sample Model of IoT Network
The system proposed in the previous section is used here
to outline a model of communication in a network of IoT
devices. The sample network consists of 7 devices:
1: control panel with buttons and other controls for
manual handling of several following devices,
2: display (an LCD panel) to show some sensor
values (thermometer, CO2 sensor),
3: updater that provides updates for all devices on
the network, keeps an inventory of software
versions on diferent devices, and forwards updates
of programs to the environment,
4: smart light bulb,
Updater</p>
        <p>Display
J</p>
        <p>J^J
6</p>
        <p>3
Thermometer
]JJ
7</p>
        <p>J</p>
        <p>?
CO2
sensor
Control
panel
1
?
Smart light</p>
        <p>bulb
4</p>
        <p>2
J</p>
        <p>J^J
Window
control
5</p>
        <p>6</p>
        <p>Each agent can have a diferent number of objects in
its state, and this number can also be changed.</p>
        <p>
          The agent 6 is a thermometer. It is a very simple
device: it needs only two objects inside the state. The
object  means the version, the object  is intended to
store the current temperature. There is only one program
in the set of programs, with one (multicast) rule.
6 = ({(
          <xref ref-type="bibr" rid="ref1">1</xref>
          ), (24)}, {tout}) with the program:
(tout, { →−out }, ∅, ∅)
        </p>
        <p>The agent exports the object  with its current
property to all edges directed from the agent (so the object
appears in the states of the agents 5 and 3 for the next
step, their contexts).</p>
        <p>
          The agent 7 is similar: it has only two objects inside
the state and one program with the multicast rule:
7 = ({(
          <xref ref-type="bibr" rid="ref1">1</xref>
          ), (1000)}, {sout}) with the program:
(sout, { →−out }, ∅, ∅)
        </p>
        <p>The agent 5 is a bit more complicated. Its role is
a window control, and it is necessary to synchronize
inputs from three diferent sources: the thermometer, the
CO2 sensor, and the manual operation on the control
panel. The agent has three programs: opening a
window in response to high room temperature or high CO2
levels, and closing the window. These programs are not
triggered when the manual mode (operation from the
control panel) is enabled.</p>
        <p>
          Besides the object for the version, we have an object
for the state (0=closed, 1=open) and an object for the
manual mode indication.
5 = ({(
          <xref ref-type="bibr" rid="ref1">1</xref>
          ), (0), (0)},
        </p>
        <p>
          {wopent, wopens, wclose})
5: window control device that can open or close
a window based on data from other IoT devices
(here thermometer and CO2 sensor),
6: thermometer, its values can afect the window
control,
7: CO2 sensor, its values can also afect the window
control.
(wopent, {(0) → (
          <xref ref-type="bibr" rid="ref1">1</xref>
          )},
        </p>
        <p>
          {(&gt; 22)}, {(
          <xref ref-type="bibr" rid="ref1">1</xref>
          )})
(wopens, {(0) → (
          <xref ref-type="bibr" rid="ref1">1</xref>
          )}, {(&gt; 1200)},
{(
          <xref ref-type="bibr" rid="ref1">1</xref>
          )})
(wclose, {(
          <xref ref-type="bibr" rid="ref1">1</xref>
          ) → (0)}, {(≤ 22), (≤ 1200)},
{(
          <xref ref-type="bibr" rid="ref1">1</xref>
          )})
        </p>
        <p>We can notice that there is a conjunction relation
between the elements in the set of reactants, so the opening
operation is divided into two programs.</p>
        <p>
          The agent 3 only displays information obtained from
its own state. The initial state consists of one object
(
          <xref ref-type="bibr" rid="ref1">1</xref>
          ), it is the version. The remaining objects will be
delivered during the system operation. No programs
are needed, the change of the display view state is done
automatically if there is a change in the objects and their
parameters from other agents.
3 = ({(
          <xref ref-type="bibr" rid="ref1">1</xref>
          )}, ∅)
        </p>
        <p>
          The agent 4 is a light bulb. There are three objects
in its state: the version, the device state (0 for lights of,
1 for lights on), and the light intensity (
          <xref ref-type="bibr" rid="ref1 ref2 ref3">0–12</xref>
          ).
4 = ({(
          <xref ref-type="bibr" rid="ref1">1</xref>
          ), (0), (
          <xref ref-type="bibr" rid="ref2">2</xref>
          )}, ∅)
        </p>
        <p>
          The agent 1 plays the role of the control panel for the
manual handling of devices. It needs the objects with the
current state of the controlled devices (the light bulb, the
window), and one additional object indicating manual
handling for the window.
1 = ({(
          <xref ref-type="bibr" rid="ref1">1</xref>
          ), (0), (0), (0)},
{clight, cwindowman, cwindowstate})
        </p>
        <p>
          { →−out ∅,
(cwindowman, { →−out }, ∅,
(clight, }, ∅)
∅)
(cwindowstate, { →−out }, {(
          <xref ref-type="bibr" rid="ref1">1</xref>
          )}, ∅)
        </p>
        <p>
          The last agent, 2, is the updater. It holds the database
of all programs and their versions (as object properties).
Because of lack of space, we will show here only the
creation of an update program (more precisely: two
programs) for the agent 5, when it is necessary to change
the temperature at which the window will automatically
open. We use one special helper object  indicating
a new value intended for the object .
2 = ({(
          <xref ref-type="bibr" rid="ref1">1</xref>
          ), (
          <xref ref-type="bibr" rid="ref1">1</xref>
          ), (
          <xref ref-type="bibr" rid="ref1">1</xref>
          ), . . . , (
          <xref ref-type="bibr" rid="ref2">2</xref>
          )},
        </p>
        <p>{uw2, uw2d, . . . })</p>
        <p>
          The program uw2 creates and exports the new version
of the program wopent, multicasts the object  with
the property 2, and evolves its own copy of the object
 by changing the property. The set of rules must be
deterministic, therefore the multicast rule has a diferent
symbol on each side.
(uw2, { (wopent, {(0) → (
          <xref ref-type="bibr" rid="ref1">1</xref>
          )},
{(&gt; 24)}, {(
          <xref ref-type="bibr" rid="ref1">1</xref>
          )}) ◁,
(
          <xref ref-type="bibr" rid="ref2">2</xref>
          ) →−out (
          <xref ref-type="bibr" rid="ref2">2</xref>
          ),
(
          <xref ref-type="bibr" rid="ref1">1</xref>
          ) → (
          <xref ref-type="bibr" rid="ref2">2</xref>
          )},
{(
          <xref ref-type="bibr" rid="ref2">2</xref>
          )}, ∅)
        </p>
        <p>
          The set of reactants has the member (
          <xref ref-type="bibr" rid="ref2">2</xref>
          ), so the
given rule is applied immediately after the new helper
The proposed system is optimized for a very specific
application – IoT network modeling.
        </p>
        <p>Unlike other systems, here we count on the existence
of object properties directly in the definition because the
purpose of most IoT devices is just to send or receive
(mostly numeric) data, or to react to them in a short,
simple code (these devices are not computationally
demanding, they are often powered by a battery, which
limits their performance considerably).</p>
        <p>Compared to P Colonies, we also abandoned the static
number of objects in the agent environment (state) and
the number of rules in programs. While this feature
makes it easier to detect and compare the computational
power of systems, it complicates the modeling of a group
of heterogeneous entities. In our system, it is even
possible to continuously add objects to (or remove from) the
agent’s state that were not originally there.</p>
        <p>The agent 5 does not have any  and  objects in
its state at the beginning of the system operation, it gets
them only after the agents running the thermometer (6)
and CO2 sensor (7) become functional and use their
multicast rules.</p>
        <p>The format of rules and programs is a hybrid between
P Colonies with transferable programs and networks of R
Systems. All programs are in principle transferable, this
property (unlike P Colonies) is not determined directly
by a condition, but by a match in the label.</p>
        <p>Conditionality refers more to the execution of rules
(similar to R Systems) and is even represented in two
places in the system design:
• sets of reactants and inhibitors in programs,
• properties of objects on the left-hand sides of
rules.</p>
        <p>Cooperation is very simple between directly connected
agents, agents can send objects with properties to each
other at each step. A multicast rule is used for this
purpose, which corresponds to one-to-many communication
in computer networks. We also considered a rule for
one-to-one communication, but this would mean adding
a destination agent label to the rule definition, which
• explicit (provided by rules in programs),
• implicit (provided by other means).</p>
        <p>Implicit operations are included because the system is
intended to model real systems dealing with heterogeneous
data, including dynamic systems with variable structure
and purpose.</p>
        <p>Some aspects of the system could, of course, be
designed diferently. For example, it is not possible to create
and distribute completely new rules with a new label. In
some circumstances this functionality would be useful,
if needed it is not a problem to add it to the system.</p>
        <p>Further research can be focused in several directions:
• improving the definition of IR Colonies to better
match expected uses,
• detailed comparison of the properties,
capabilities, and relationships with P Colonies (with
transferable programs), R Systems, and possibly other
similar systems,
• evaluation of possibilities and limits of the use of</p>
        <p>IR Colonies,
• creation of supporting tools that will allow the
system to be used for modeling in digital form.
[4] J. Kelemen, A. Kelemenová, G. Păun, P Colonies:
A Biochemically Inspired Computing Model, in:
Workshop and Tutorial Proceedings. Ninth
International Conference on the Simulation and Synthesis
of Living Systems (Alife IX), Boston, Massachusetts,
2004, pp. 82–86.
[5] L. Ciencialová, L. Cienciala, Transferable
Knowledge in P Colonies, in: Information Technologies –
Applications and Theory 2022 (ITAT 2022), volume
3226, Zuberec, Slovakia, 2022, pp. 167–174.
[6] Š. Vavrečková, Notes on Relationship of P Colonies
to Osmotic Computing and Computer Viruses, in:
CEUR Proceedings of the 23rd Conference
Information Technologies – Applications and Theory (ITAT
2023), 2023, pp. 147–153.
[7] A. Ehrenfeucht, G. Rozenberg, Reaction
Systems, Fundam. Informaticae 75 (2007)
263–280. URL: http://content.iospress.com/articles/
fundamenta-informaticae/fi75-1-4-15.
[8] P. Bottoni, A. Labella, G. Rozenberg, Networks
of Reaction Systems, International Journal of
Foundations of Computer Science 31 (2020) 53–71.
doi:10.1142/S0129054120400043.
[9] B. Aman, From Networks of Reaction Systems
to Communicating Reaction Systems and Back, in:
J. Durand-Lose, G. Vaszil (Eds.), Machines,
Computations, and Universality, Springer International
Publishing, Cham, 2022, pp. 42–57. doi:https://
doi.org/10.1007/978-3-031-13502-6_3.
[10] L. Ciencialová, L. Cienciala, E. Csuhaj-Varjú,
P Colonies and Reaction Systems, volume 2,
Springer International Publishing, 2020, pp. 269–
280. doi:10.1007/s41965-020-00051-1.
[11] P. Sethy, Notes on P Systems versus R Systems, in:
Developments in Computer Science(DCS), 2021, pp.
263–266.
[12] Š. Vavrečková, Membrane System as a
Communication Interface between IoT devices, in: CEUR
Proceedings of the 22nd Conference Information
Technologies – Applications and Theory (ITAT 2022),
2022, pp. 184–190.
[13] J. E. Hopcroft, J. D. Ullman, Introduction to
Automata Theory, Languages and Computation,
Addison-Wesley Series in Computer Science and
Information Processing, Addison-Wesley, 1979.
[14] W. Kassab, K. A. Darabkh, A–Z Survey of Internet
of Things: Architectures, Protocols, Applications,
Recent Advances, Future Directions and
Recommendations, Journal of Network and Computer
Applications 163 (2020). URL: https://doi.org/10.1016/j.
jnca.2020.102663.
[15] J. Dizdarević, F. Carpio, A. Jukan, X. Masip-Bruin,
A Survey of Communication Protocols for Internet
of Things and Related Challenges of Fog and Cloud
Computing Integration, Association for Computing</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>G.</given-names>
            <surname>Păun</surname>
          </string-name>
          ,
          <source>Membrane Computing: An Introduction</source>
          , Springer, Heidelberg,
          <year>2002</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>G.</given-names>
            <surname>Păun</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Rozenberg</surname>
          </string-name>
          , A Guide to Membrane Computing,
          <source>Theoretical Computer Science</source>
          <volume>287</volume>
          (
          <year>2002</year>
          )
          <fpage>73</fpage>
          -
          <lpage>100</lpage>
          . doi:https://doi.org/10.1016/ S0304-
          <volume>3975</volume>
          (
          <issue>02</issue>
          )
          <fpage>00136</fpage>
          -
          <lpage>6</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>G.</given-names>
            <surname>Păun</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Rozenberg</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Salomaa</surname>
          </string-name>
          ,
          <source>The Oxford Handbook of Membrane Computing</source>
          , Oxford University Press, New York,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <source>Machinery</source>
          <volume>51</volume>
          (
          <year>2019</year>
          ). URL: https://doi.org/10.1145/ 3292674. doi:
          <volume>10</volume>
          .1145/3292674.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>