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.4. ECOLOGICAL AND EVOLUTIONARY MODELS 455returnelse: # if <strong>the</strong>re are rabbits nearbyif r<strong>and</strong>om() < rf:agents.append(cp.copy(ag))def update_one_unit_time():global agentst = 0.while t < 1.:t += 1. / len(agents)update()import pycxsimula<strong>to</strong>rpycxsimula<strong>to</strong>r.GUI().start(func=[initialize, observe, update_one_unit_time])A typical simulation result is shown in Figure 19.5. The tiny blue dots represent preyindividuals, while <strong>the</strong> larger red circles represent preda<strong>to</strong>rs. As you see in <strong>the</strong> figure,<strong>the</strong> interplay between prey <strong>and</strong> preda<strong>to</strong>rs produces very dynamic spatial patterns, whichsomewhat resemble <strong>the</strong> patterns seen in <strong>the</strong> host-pathogen CA model discussed in Section11.5. The prey population grows <strong>to</strong> form clusters (clouds <strong>of</strong> tiny blue dots), but if <strong>the</strong>yare infested by preda<strong>to</strong>rs, <strong>the</strong> preda<strong>to</strong>rs also grow rapidly <strong>to</strong> consume <strong>the</strong> prey, leavinga deserted empty space behind. As a result, <strong>the</strong> system as a whole begins <strong>to</strong> show dynamicwaves <strong>of</strong> prey followed by preda<strong>to</strong>rs. It is clear that spatial distributions <strong>of</strong> thosespecies are highly heterogeneous. While we observe <strong>the</strong> periodic wax <strong>and</strong> wane <strong>of</strong> <strong>the</strong>sespecies, as predicted in <strong>the</strong> equation-based preda<strong>to</strong>r-prey models, <strong>the</strong> ABM version generatesfar more complex dynamics that involve spatial locality <strong>and</strong> s<strong>to</strong>chasticity. One couldargue that <strong>the</strong> results obtained from this ABM version would be more realistic than thoseobtained from purely equation-based models.We can fur<strong>the</strong>r modify <strong>the</strong> simula<strong>to</strong>r code <strong>of</strong> <strong>the</strong> preda<strong>to</strong>r-prey ABM so that it outputs<strong>the</strong> time series plot <strong>of</strong> prey <strong>and</strong> preda<strong>to</strong>r populations next <strong>to</strong> <strong>the</strong> visualization <strong>of</strong> <strong>the</strong> agents’positions. This can be done in a fairly simple revision: We just need <strong>to</strong> create lists <strong>to</strong> s<strong>to</strong>retime series <strong>of</strong> prey <strong>and</strong> preda<strong>to</strong>r populations, <strong>and</strong> <strong>the</strong>n revise <strong>the</strong> observe function <strong>to</strong>count <strong>the</strong>m, append <strong>the</strong> results <strong>to</strong> <strong>the</strong> lists, <strong>and</strong> visualize <strong>the</strong> lists as time series plots.Here are <strong>the</strong> updated initialize <strong>and</strong> observe functions:Code 19.18: preda<strong>to</strong>r-prey-abm-with-plot.pydef initialize():global agents, rdata, fdata

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

Saved successfully!

Ooh no, something went wrong!