A Ja a Simula o
o Basic T ansi ion P Sys ems
Isabel A. NEPOMUCENO-CHAMORRO
Resea ch G oup on Na u al Compu ing
Depa men o Compu e Science and A i icial In elligence
Uni e si y o Se illa
A da. Reina Me cedes s/n, 41012 Se illa, Spain
E-mail: [email p o ec ed]
Abs ac . In his pape , a so wa e ool (called SimCM, om Spanish Sim-
ulado de Compu aci´on con Memb anas) o handling P sys ems is p esen ed.
The p og am can simula e basic ansi ion P Sys ems whe e dissolu ion o
memb anes and p io i y ules a e allowed. This is a i s s ep o c oss he
bo de be ween simula ions and dis ibu ed implemen a ions ha cap u e he
pa allelism exis ing in his model.
1 In oduc ion
Memb ane compu ing is a ecen a ea o Na u al Compu ing, a opic whe e much wo k
has been done bu s ill much emains o be done. The e a e some applica ions which ha e
been de eloped in impe a i e languages, like C++, o in decla a i es languages, as P olog,
wo king in he ame o P sys ems. The p esen pape desc ibes a so wa e applica ion,
SimCm, ca ied ou in an impe a i e and objec -o ien ed language – Ja a. We choose
Ja a because i is a scalable and dis ibu ed language. Wo king wi h Ja a is he i s
s ep o c oss he bo de be ween simula ions and a dis ibu ed implemen a ion able o
cap u e he pa allelism exis ing in he memb ane compu ing a ea. This ool is a iendly
applica ion which allows us o ollow he e olu ion o a P sys em easily and in a isual
way. This p og am can be used o mo e close he P sys em heo y o he biologis and all
he people who wan s o lea n and unde s and how his model wo ks.
2 A Look Inside he Applica ion
This applica ion is a a ia ion o he Model-View-Con olle (MVC), an a chi ec u e model
o so wa e de elopmen used in in e ac i e sys ems whe e he use in e aces a e change-
able. I is also composed o se e al di e en componen s: in he i s one, Model, unc ional
quali ies and ype abs ac da a a e ound; he second componen , View, is esponsible
o showing he esul s o he use h ough a g aphical in e ace; he hi d componen ,
Con olle , is in cha ge o he eques s made by he use . In he c ea ion o he SimCM
309
Figu e 1: Subsys ems o he so wa e.
Figu e 2: Subsys em I.
p og am, he View and Con olle componen s a e joined in o a single componen . The ol-
lowing pic u e ep esen s he hie a chical s uc u e and he ela ions be ween he di e en
Ja a classes designed and used o he applica ion.
These classes a e dis ibu ed in wo subsys ems:
•Subsys em I: i includes he simula o engine, ha is, all he unc ional quali ies o
he basic ansi ion P sys ems, and ype abs ac da a. This subsys em is o med
by he ollowing Ja a packages: NA yT ee (implemen ing he ee ypes o ep esen
he memb ane s uc u e and he compu a ion ee), Lis ,Memb ane,Mul ise ,Rules,
and Simula o .
•Subsys em II: i includes all he classes ela ed o he Guide Use In e ace (GUI)
ha in e ac s wi h he use and is o med by he Ja a packages: In e ace,Da aUSe ,
Pa seRule,Se ializa ion, and HelpH ml.
The wo subsys ems in e ac wi h each o he and p oduce a compu a ion ha has
been implemen ed wi h ins ance objec s o he Obse e and Obse able Ja a classes.
The ins ance objec s o he Obse e Ja a class should be no i ied when he s a e o an
310
Figu e 3: Subsys em II.
obse able objec is modi ied. The Obse able objec s a e any objec s whose s a e can
be o in e es o any o he objec (obse e ). Howe e , he communica ion be ween he
execu ion h eads o he p og am can be mo e di icul han ha be ween he obse e
and obse able. Th eads used o common objec s, so ha a h ead can gi e an objec o
ano he , can be designed in such a way ha he objec s can be manipula ed independen ly
by bo h sides a he same ime. This is he classic example o he h ead communica ion
in he p oduce /consume p oblem: one h ead, called p oduce , p oduces a esul ha
ano he h ead, he consume , uses o consumes he esul , no ma e wha he esul is.
Fo example, in he p og am he use can selec he Guided mode o execu ion. In his
mode, he use selec s wi h he mouse by clicking on he con igu a ion node in he GUI;
his node is a p oduc he GUI o e s o he simula o in o de ha he simula o con inues
unning om his node; he simula o engine consumes his objec . In o de o con ol
his communica ion, he Ja a class Pipeline has been c ea ed, including push() and pull()
unc ions (synch onized access me hods), in o de o main ain he in eg i y o he sha ed
objec s.
In he ollowing subsec ions we desc ibe some p og amming de ails o his wo subsys-
ems.
2.1 Engine o Simula o
The engine is buil upon wo undamen al pilla s: he i s one is he simula o ha
includes he algo i hms o simula e he p ocesses and compu a ions p oduced inside a
memb ane sys em; i also con ains he unc ional quali ies o he sys em, wi h he ask o
s a ing he ini ial con igu a ion o he P sys em and cons uc ing he ini ial con igu a ion
o he associa ed compu a ion ee; he second one includes all he ype abs ac da a in
o de o suppo he memb ane s uc u e and i s con en (mul ise s o objec s and ules),
and con ains he ype da a necessa y o he c ea ion and s o age o he applicabili y
mul ise s.
The wo ele an classes o he engine a e Simula o .ja a and C ea eBagAplicabil-
311
i y.ja a.
The class C ea eBagAplicabili y.ja a has he ask o c ea e he applicabili y mul ise o
ules, MAp(Ci), ha mus be compu ed o each con igu a ion. B ie ly, he algo i hm o
ob ain MAp(Ci) wo ks as ollows: o each memb ane, he ules a e i e a ed in such a way
ha in each i e a ion a dis inc ule is pi o al and o each ule i s maximum applicabili y
numbe is calcula ed acco ding o he mul ise associa ed wi h he memb ane and he
o he ules a e analyzed acco ding o hose ha can be maximally applied o no (in his
way he pa allelism o he applica ion ules is simula ed, and he dis inc possibili ies o
applying ules o each memb ane is ob ained); inally, his p ocess con inues o e each o
hese possibili ies and one ob ains he applicable mul ise o ules.
The main class is Simula o .ja a which ex ends he Th ead Ja a class. In his way
an ins ance o his class can c ea e a con ex o he sys em ask and execu e i h ough
a call o s a me hod, s op he execu ion o he associa ed h ead o he ask wi hou
des oying i , and execu e he un me hod ha s a s he simula ion algo i hm. This
class cons uc s he compu a ion ee associa ed wi h he loaded P sys em: i s a s wi h
he ini ial con igu a ion, compu es i s applicable mul ise s o ules and ob ains i s nex
con igu a ions; his p ocess is epea ed o each con igu a ion un il i eaches he inal
s a e o a dep h le el p e iously es ablished by he use . I mus be unde s ood ha he
e iciency o Simula o class is based on a sound implemen a ion o he da a s uc u es, and
on he i e a ion algo i hm o hese s uc u es. In he cons uc ion o he compu a ion ee,
he memb ane s uc u e associa ed wi h each con igu a ion is s o ed on he ha d disk in
o de o unbu den he RAM and no o o e load he compu e . Finally, Simula o .ja a is
con olled by he use in such a way ha he/she can e-do he p ocess o he compu a ion
ee cons uc ion in one s ep o s ep by s ep. This s ep by s ep possibili y implies a mo e
exhaus i e communica ion wi h he guide use in e ace han simply gene a ing he e en s.
2.2 Guide Use In e ace
The GUI is he pa o he p og am allowing he use o in e ac wi h he applica ion. The
GUI is included in he Subsys em II wi h he managemen - ecep ion o e en s gene a ed
be ween he use and he Simula o engine. The Swing Ja a package is used in he
cons uc ion o his GUI (a independen pla o m lib a y o classes used o de elop GUI’s).
This package includes he AWT1package (Abs ac Windows Toolki ) and ex ends i s
capabili ies. The AWT package was he i s lib a y class o e ed in Ja a.
Among he classes ha o m he GUI, he mos impo an a e G a icaA bolCon ig.ja a
and G a icaA bolMu.ja a, wi h he ask o allow a isual ep esen a ion o he compu a ion
ee and he memb ane s uc u e ( hey bo h ex end he JPanel Ja a class).
3 Sigh seeing o he Applica ion
Essen ially, his so wa e ool allows us o handle ansi ion P sys ems by means o h ee
basic ope a ions:
•C ea e an ini ial memb ane sys em; he simula o includes a debug mode in o de o
a oid some use e o s.
•Load and Sa e p e iously de ined memb ane sys ems.
1The AWT is pa o he Ja a Founda ion Classes (JFC), he s anda d API o p o iding g aphical use
in e aces (GUIs) o Ja a p og ams.
312
Figu e 4: The main sc een o he p og am.
•Ca y ou a simula ion o he P sys em e olu ion. This simula ion can be made in
h ee di e en ways: un il a gi en maximal le el, le el by le el, and guided.
The guide use in e ace (GUI) o he applica ion (Figu e 4) uses classes o he Ja a
Swing2package and he In eg a ed De elopmen En i onmen (IDE) used is Fo e3.
The main sc een is di ided in o ou basic panels:
•Compu a ion ee: his panel shows he ee o con igu a ions a e he simula ion
is inished o du ing i s de elopmen .
•Cu en cell: ini ially, his panel con ains a ske ch in ee o m o he memb ane
sys em o be s udied ( he p og am ep esen s he memb ane sys ems as ee s uc-
u es). Once he simula ion is inished o when i is in de elopmen , his panel will
ep esen he s a e o he memb ane sys em acco ding o he con igu a ion chosen
by he use in he compu a ion ee panel. In o de o selec he con igu a ion, a
simple click on he chosen node in he ee o he compu a ion panel is needed.
•Rules: in his panel he ules associa ed wi h each memb ane a e shown.
•Applicable ules: his panel shows he applicabili y mul ise associa ed wi h he
con igu a ion selec ed by he use in he compu a ion ee.
In he menu ba se e al ac ions a e ound; among hem, we men ion:
1. Load and sa e P sys ems.
2. C ea e P sys ems. To do his, an ini ial memb ane sys em mus be c ea ed by
selec ing he inse ion o new s uc u es. In his case one mus click C ea e and nex
New in he menu and he skin appea in he cu en cell panel. New elemen s such
2Swing is o m o he Ja a Founda ion Classes (JFC). This is a se o Ja a class lib a ies p o ided as
pa o Ja a 2 Pla o m, S anda d Edi ion (J2SE), o suppo building g aphics use in e ace (GUI).
3Fo e o Ja a .3.0 Copy igh Sun Mic osys ems
313
Figu e 5: Inse ion o m.
as o he memb anes, ules and objec s can be added. The e is a o m ha has been
c ea ed o help he use in he inse ion (Figu e 5). The p og am pa ses he inpu
o a oid mis akes ( o example, when he use in oduces new memb anes, he/she
mus indica e he a he ag and i his ag does no exis , he p og am will ad ise
he use ha he ac ion is no allowed). Also, when in oducing he mul ise o
objec s, he p og am pa ses he lexical alphabe and mul iplici y. Finally, when he
use in oduces new ules, i he ules a e associa ed wi h non-exis en memb ane
ags o i he e a e lexical e o s in he mul ise s o non-exis en g ea e p io i y ule
ags, he p og am wa ns he use abou he mis ake.
3. S a he e olu ion o he P Sys em. The e a e h ee modes o simula ion: he i s
one is Un il Max Dep h Le el, in which he simula ion engine uns and does no show
he inal esul un il i ei he eaches he s op con igu a ion o i hi s he max le el
gi en by he use . The second mode is Le el by Le el, in which he simula ion engine
uns and shows he esul s as hey a e compu ed s ep by s ep in he compu a ion
ee. The hi d mode is Guided, in which wi h each new le el he use has o selec
he co esponding node acco ding o he con igu a ion he use wan s o con inue
compu ing, and hen click Nex s ep in he menu o oolba .
4. E ase compu a ion ee – in o de o clean panels and memo y, o wo k wi h a new
P sys em.
In he oolba se e al ac ions a e ound. The mos impo an is he ac ha he use
can use he ex box o se he bounda y ma k, in o de o se he desi ed dep h o he
ee o con igu a ions. By de aul , he ma k is se a ou le els. In his way, in he case
ha he s op con igu a ion does no exis , he p og am will inalize he simula ion o he
P sys em when he ee o con igu a ions eaches he ma k indica ed in he ex box.
314
4 Fu u e Wo k
The e a e h ee di e en ways o con inue ou wo k: o de elop he ools in o de o handle
ano he kind o P sys ems (wi h ac i e memb anes, sympo /an ipo sys ems, ...) and
o add he possibili y o changing he ep esen a ion o memb ane s uc u e (Venn-like
diag ams); hen, a Ja a apple unning in a b owse o use he applica ion in a emo e
machine can be designed; and inally, o implemen a dis ibu ed P sys em in Ja a RMI o
using he s anda d CORBA4. In his way we could use he ools o dis ibu ed compu ing
o cap u e he idea o maximal pa allelism p esen in his model. In his way he u u e
so wa e would be e y simila o he way he P sys ems compu e. In such a new design
i will be necessa y o s udy and unde s and se e al p oblems ela ed wi h he dis ibu ed
compu a ions and i s di e ences o he pa allel compu ing.
Re e ences
[1] G. Ciobanu, D. Pa aschi , Memb ane So wa e. A P Sys em Simula o , P e-P oceedings
o Wo kshop on Memb ane Compu ing, Cu ea de A ges, Romania, Augus 2001, Tech-
nical Repo 17/01 o Resea ch G oup on Ma hema ical Linguis ics, Ro i a i Vi gili
Uni e si y, Ta agona, Spain, 2001, 45–50, and Fundamen a In o ma icae, 49, 1-3
(2002), 61–66.
[2] A. Co d´on-F anco, M.A. Gu i´e ez-Na anjo, M.J. P´e ez-Jim´enez, F. Sancho-Capa ini,
A P olog Simula o o De e minis ic P Sys ems wi h Ac i e Memb anes, Ro i a i
Vi gili Uni ., Tech. Rep. No. 26, M. Ca alie e, C. Ma in-Vide, Gh. P˘aun (Eds.),
B ains o ming Week on Memb ane Compu ing, Ta agona, Feb 5-11 2003, 141–154.
[3] E. Gamma, R. Helm, R. Johnson, J. Vlissides, Design Pa e ns. Elemen s o Reusable
Objec -O ien ed So wa e. Addison-Wesley.
[4] I.A. Nepomuceno-Chamo o, Simulaciones de P Sys emas en Ja a, aplicaci´on SimCM.
CCIA Uni e sidad de Se illa Secci´on III, N 3, 2003, 1–115.
[5] Gh. P˘aun, Memb ane Compu ing. An In oduc ion. Sp inge -Ve lag, 2002.
[6] M.J. P´e ez-Jim´enez, F. Sancho-Capa ini, Compu aci´on celula con memb anas: Un
modelo no con encional. K onos, 2002.
4Common Objec Reques B oke A chi ec u e
315