15.08.2015 Views

Introduction to the Modeling and Analysis of Complex Systems

introduction-to-the-modeling-and-analysis-of-complex-systems-sayama-pdf

introduction-to-the-modeling-and-analysis-of-complex-systems-sayama-pdf

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.

19.3. AGENT-ENVIRONMENT INTERACTION 445# simulating diffusion <strong>and</strong> evaporation <strong>of</strong> cAMPfor x in xrange(w):for y in xrange(w):C, R, L, U, D = env[x,y], env[(x+1)%w,y], env[(x-1)%w,y], \env[x,(y+1)%w], env[x,(y-1)%w]lap = (R + L + U + D - 4 * C)/(Dh**2)nextenv[x,y] = env[x,y] + (- k * C + Dc * lap) * Dtenv, nextenv = nextenv, env# simulating secretion <strong>of</strong> cAMP by agentsfor ag in agents:env[ag.x, ag.y] += f * Dt# simulating chemotaxis <strong>of</strong> agentsfor ag in agents:newx, newy = (ag.x + r<strong>and</strong>int(-1, 2)) % w, (ag.y + r<strong>and</strong>int(-1, 2)) % wdiff = (env[newx, newy] - env[ag.x, ag.y]) / 0.1if r<strong>and</strong>om() < exp(diff) / (1 + exp(diff)):ag.x, ag.y = newx, newyimport pycxsimula<strong>to</strong>rpycxsimula<strong>to</strong>r.GUI().start(func=[initialize, observe, update])As you see, <strong>the</strong> code is getting longer <strong>and</strong> more complicated than before, which is atypical consequence when you implement an ABM.Figure 19.4 shows a typical simulation result. The tiny blue dots represent individualcells (agents), while <strong>the</strong> grayscale shades on <strong>the</strong> background show <strong>the</strong> cAMP concentration(environment). As time goes by, <strong>the</strong> slightly more populated areas produce morecAMP, attracting more cells. Eventually, several distinct peaks <strong>of</strong> agent populations arespontaneously formed, reproducing self-organizing patterns that are similar <strong>to</strong> what <strong>the</strong>PDE-based model produced.What is unique about this ABM version <strong>of</strong> <strong>the</strong> Keller-Segel model, compared <strong>to</strong> itsoriginal PDE-based version, is that <strong>the</strong> simulation result looks more “natural”—<strong>the</strong> formation<strong>of</strong> <strong>the</strong> population peaks are not simultaneous, but <strong>the</strong>y gradually appear one afterano<strong>the</strong>r, <strong>and</strong> <strong>the</strong> spatial arrangements <strong>of</strong> those peaks are not regular. In contrast, in<strong>the</strong> PDE-based version, <strong>the</strong> spots are formed simultaneously at regular intervals (see

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

Saved successfully!

Ooh no, something went wrong!