09.09.2014 Views

13th International Conference on Membrane Computing - MTA Sztaki

13th International Conference on Membrane Computing - MTA Sztaki

13th International Conference on Membrane Computing - MTA Sztaki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

P. Sosík<br />

(a) subsequently and recursively calculate c<strong>on</strong>tents of these cells in previous<br />

step;<br />

(b) calculate the number of applicati<strong>on</strong>s of the rule in the maximally parallel<br />

way;<br />

(c) if <strong>on</strong>e of the affected cells is h, record the multiset of rules applied to it;<br />

3. Re-calculate c<strong>on</strong>tent of cell h in previous step of computati<strong>on</strong> and apply the<br />

recorded rules to obtain new c<strong>on</strong>tent of the cell.<br />

When applying a rule to a particular cell in phase 2, <strong>on</strong>e must start with<br />

the multiset of objects remaining in that cell after rules already applied in the<br />

same step n. Fortunately enough, it is not necessary to store c<strong>on</strong>tents of all cells<br />

or all multisets of rules applied to each cell in step n. Recall that the order<br />

of applicati<strong>on</strong> of rules in R is fixed and so is the order of cells to which these<br />

rules are applied in a maximally parallel way. Then the multiset of rules already<br />

applied to a particular cell in step n can be always re-calculated when the cell is<br />

affected by another rule in the same step. The <strong>on</strong>ly value which must be stored<br />

is the total multiset of rules already applied in step n. Assume for simplicity that<br />

an input multiset of objects w is already included in the initial multiset M iin .<br />

functi<strong>on</strong> c<strong>on</strong>tent<br />

Parameters: l ∈ {1, . . . , q} – label of a cell<br />

i 1 i 2 . . . i n – a compound index<br />

n – a number of step<br />

Returns: the c<strong>on</strong>tent of cell labeled l with compound index i 1 i 2 . . . i n<br />

after n steps of computati<strong>on</strong>, or null if such a cell does not exist.<br />

Auxiliary variables:<br />

rulesAppliedTol, rulesAppliedTotal, rulesForCell1, rulesForCell2;<br />

(Multisets of applicable or applied rules with underlying set R)<br />

c<strong>on</strong>tentCell1, c<strong>on</strong>tentCell2, c<strong>on</strong>tentFinal;<br />

(Multisets storing c<strong>on</strong>tents of cells)<br />

if n = 0 then return M l ; (return the initial multiset of cell l)<br />

set multiplicity of all elements in rulesAppliedTotal to 0;<br />

set multiplicity of all elements in rulesAppliedTol to 0;<br />

for each communicati<strong>on</strong> rule (j, u/v, k) in R do begin<br />

(Now we scan all existing copies of cells labeled j and k affected by the rule.)<br />

rulesForCell1 := rulesAppliedTotal;<br />

for each possible compound index j 1 j 2 . . . j n−1 do begin<br />

c<strong>on</strong>tentCell1 = c<strong>on</strong>tent(j, j 1 j 2 . . . j n−1 , n − 1);<br />

426

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!