08.01.2013 Views

LNCS 2950 - Aspects of Molecular Computing (Frontmatter Pages)

LNCS 2950 - Aspects of Molecular Computing (Frontmatter Pages)

LNCS 2950 - Aspects of Molecular Computing (Frontmatter Pages)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

where<br />

Solving Graph Problems by P Systems 15<br />

O = {ai,di,ti,t ′ i ,fi | 1 ≤ i ≤ n}∪{hi,h ′ i | 0 ≤ i ≤ k}∪{ei | 0 ≤ i ≤ m}<br />

∪{gi | 1 ≤ i ≤ m +1}∪{g ′ i | 1 ≤ i ≤ m}∪{a, b, p, q, u, yes},<br />

H = {1, 2},<br />

µ =[ 1 [ 2 ] 0 0<br />

2 ] 1 ,<br />

w1 = λ,<br />

w2 = a1a2 ···and1,<br />

and the set R contains the following rules<br />

1. [ 2ai] 0<br />

2 → [ 0<br />

2ti] 2 [ 0<br />

2fi] 2 , 1 ≤ i ≤ n.<br />

The objects ai correspond to vertices vi, 1 ≤ i ≤ n. By using a rule as<br />

above, for i non-deterministically chosen, we produce the two objects ti and<br />

fi associated to vertex vi, placed in two separate copies <strong>of</strong> membrane 2,<br />

where ti means that vertex vi appears in some subset <strong>of</strong> vertices, and fi<br />

means that vertex vi does not appear in some subset <strong>of</strong> vertices. Note that<br />

the charge remains the same for both membranes, namely neutral, hence<br />

the process can continue. In this way, in n steps we get all 2n subsets <strong>of</strong><br />

V , placed in 2n separate copies <strong>of</strong> membrane 2. In turn, these 2n copies<br />

<strong>of</strong> membrane 2 are within membrane 1 – the system always has only two<br />

levels <strong>of</strong> membranes. Note that in spite <strong>of</strong> the fact that in each step the<br />

object ai is non-deterministically chosen, after n steps we get the same result,<br />

irrespective <strong>of</strong> which objects were used in each step.<br />

2. [ 2di → di+1] 0<br />

2 , 1 ≤ i ≤ n − 1.<br />

3. [ 2dn → qqh0] 0<br />

2 .<br />

The objects di are counters. Initially, d1 is placed in membrane 2. By division<br />

(when using rules <strong>of</strong> type 1), we introduce copies <strong>of</strong> the counter in each new<br />

membrane. In each step, in each membrane with label 2, we pass from di to<br />

di+1, thus “counting to n”. In step n we introduce both q and h0; the objects<br />

q will exit the membrane (at steps n +1,n + 2), changing its polarization,<br />

the object h0 is a new counter which will be used at the subsequent steps as<br />

shown below. Note that at step n we have also completed the generation <strong>of</strong><br />

all subsets.<br />

Now we pass to the next phase <strong>of</strong> computation – counting the number <strong>of</strong><br />

objects ti (1 ≤ i ≤ n) in each membrane with label 2, which corresponds to<br />

the cardinality <strong>of</strong> each subset; we will select out the subsets with cardinality<br />

exactly k.<br />

4. [ 2q] 0<br />

2 → [ −<br />

2 ] 2 u.<br />

5. [ 2q] −<br />

2 → [ 0<br />

2 ] 2u. 6. [ ti → abt 2 ′ −<br />

i ] , 1 ≤ i ≤ n.<br />

2<br />

7. [ 2hi → h ′ 0<br />

i ] 2 , 0 ≤ i ≤ k.<br />

8. [ 2h ′ +<br />

i → hi+1]<br />

2 , 0 ≤ i ≤ k − 1.<br />

9. [ 2a] 0<br />

2 → [ +<br />

2 ] 2 u.

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

Saved successfully!

Ooh no, something went wrong!