Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Created August 16, 2012 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenwebb/3370679 to your computer and use it in GitHub Desktop.
Save kenwebb/3370679 to your computer and use it in GitHub Desktop.
Petri nets and Membrane Computing
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/wb/ (C) Ken Webb Fri Aug 17 2012 12:41:59 GMT-0400 (EDT)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Petri nets and Membrane Computing
Description:
Url: http://www.primordion.com/Xholon/wb/
InternalName:
YoutubeId:
Keywords:
My Notes
--------
This Petri net model is a reimplementation of the model on page 2 (figure 1) of::
H.C.M Kleijn, et al. (2005) Towards a Petri net semantics for membrane systems.
The figure shows a membrane system, and the corresponding Petri net.
My reimplementation does not include "maximal concurrency",
which ref 9 in the Kleijn paper suggests is not necessary.
In this app, I use MembranePN as the universal container for Petri nets.
Membrane m1 is contained within membrane m2.
How to run the Java app that's included on this Xholon Workbook page::
(1) Click the "Save locally" button at the top of this page.
This will assemble the contents of the workbook into a separate web browser page.
Position the cursor in the new page and do "Select All" (Ctrl-A).
(2) Click the second "Launch" button further down on this page (http://www.primordion.com/Xholon/jnlp/Chameleon_0.jnlp).
This will start the Chameleon Java application. It's called Chameleon because if can be changed into anything else.
Select "File --> Open".
(3) Drag the contents of the workbook into the Chameleon app.
Just click on the selected text in the new browser window, and drag it anywhere within the Chameleon window.
An SVG image should appear in its own window. This is redrawn from the figure in the Kleijn paper.
(4) Click the "Refresh" button in the Chameleon window.
Explore the model to confirm that it has the same structure that's specified on this page.
Click the "Start" button to start the simulation.
Use the "Pause" and "Step" buttons to pause, unpause, and single-step the simulation.
(5) Each time step you can use the AnalysisCRN node to see the current number of tokens in each of the four PlacePN nodes.
Right-click and select "Special --> Show concentrations (as int)". Results for three time steps are:
concentrations [2, 2, 2, 1]
concentrations [1, 2, 1, 3]
concentrations [2, 5]
You can also click on individual PlacePN nodes to see their current token value.
]]></Notes>
<script implName="lang:python:inline:"><![CDATA[
]]></script>
<script implName="lang:javascript:inline:"><![CDATA[
]]></script>
<_-.XholonClass xmlns:xi="http://www.w3.org/2001/XInclude">
</_-.XholonClass>
<xholonClassDetails>
</xholonClassDetails>
<PetriNetSystem xmlns:xi="http://www.w3.org/2001/XInclude">
<!-- kineticsType
1 = Basic place/transition net kinetics (default)
2 = Mass action kinetics
3 = Grid
-->
<PetriNet roleName="memcomp" kineticsType="1" p="1.0" multiplicity="1">
<QueueTransitions shouldAct="true" connector="../MembranePN"/>
<AnalysisCRN/>
<AnalysisMemComp/>
<!-- membrane m2 -->
<MembranePN roleName="m2">
<!-- membrane m1 -->
<MembranePN roleName="m1">
<PlacePN roleName="a" token="2"/>
<PlacePN roleName="b" token="2"/>
<TransitionPN roleName="r">
<InputArcs>
<InputArc weight="1" connector="ancestor::MembranePN/PlacePN[@roleName='a']"/>
<InputArc weight="1" connector="ancestor::MembranePN/PlacePN[@roleName='b']"/>
</InputArcs>
<OutputArcs>
<OutputArc weight="1" connector="ancestor::MembranePN/PlacePN[@roleName='b']"/>
<OutputArc weight="1" connector="ancestor::MembranePN/../PlacePN[@roleName='c']"/>
</OutputArcs>
</TransitionPN>
</MembranePN>
<PlacePN roleName="b" token="2"/>
<PlacePN roleName="c" token="1"/>
<TransitionPN roleName="rprime">
<InputArcs>
<InputArc weight="1" connector="ancestor::MembranePN/PlacePN[@roleName='c']"/>
<InputArc weight="1" connector="ancestor::MembranePN/PlacePN[@roleName='b']"/>
</InputArcs>
<OutputArcs>
<OutputArc weight="2" connector="ancestor::MembranePN/PlacePN[@roleName='c']"/>
</OutputArcs>
</TransitionPN>
<Plot mode="new"/>
</MembranePN>
</PetriNet>
</PetriNetSystem>
<Blockbehavior implName="lang:python:inline:"><![CDATA[
]]></Blockbehavior>
<Blockbehavior implName="lang:javascript:inline:"><![CDATA[
]]></Blockbehavior>
<Blockbehavior implName="lang:webEditionjs:inline:"><![CDATA[
]]></Blockbehavior>
<Blockbehavior implName="lang:bsh:inline:"><![CDATA[
]]></Blockbehavior>
<Blockbehavior implName="lang:jruby:inline:"><![CDATA[
]]></Blockbehavior>
<Blockbehavior implName="lang:groovy:inline:"><![CDATA[
]]></Blockbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="231" height="211" xmlns="http://www.w3.org/2000/svg">
<!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
<title>Kleijn et al, membrane systems</title>
<g>
<title>Membrane Computing</title>
<rect ry="20" rx="20" id="svg_1" height="209" width="229" y="1" x="1" stroke-width="2" stroke="#000000" fill="#aad4ff"/>
<rect stroke="#000000" id="svg_2" ry="20" rx="20" height="96" width="189" y="26" x="21" stroke-width="2" fill="#aaffaa"/>
<text xml:space="preserve" text-anchor="left" font-family="serif" font-size="16" id="svg_3" y="20" x="13" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="0" stroke="#000000" fill="#000000">m2</text>
<text id="svg_4" xml:space="preserve" text-anchor="left" font-family="serif" font-size="16" y="42" x="33" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="0" stroke="#000000" fill="#000000">m1</text>
<text id="svg_5" xml:space="preserve" text-anchor="left" font-family="serif" font-size="14" y="62" x="47" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="0" stroke="#000000" fill="#000000">a a b b</text>
<text id="svg_6" xml:space="preserve" text-anchor="left" font-family="serif" font-size="12" y="82" x="48" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="0" stroke="#000000" fill="#000000">r1: {a,b} --> {b,cout}</text>
<text id="svg_7" xml:space="preserve" text-anchor="left" font-family="serif" font-size="14" y="150" x="49" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="0" stroke="#000000" fill="#000000">b b c</text>
<text id="svg_8" xml:space="preserve" text-anchor="left" font-family="serif" font-size="12" y="170" x="50" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="0" stroke="#000000" fill="#000000">r2: {c,b} --> {c,c}</text>
</g>
</svg>
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
</XholonWorkbook>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment