Open Collections

UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

Modelling a two-species interaction in a high intertidal algal community Grabovac, Nickolas 1997

Your browser doesn't seem to have a PDF viewer, please download the PDF to view this item.

Item Metadata

Download

Media
831-ubc_1997-0316.pdf [ 5.42MB ]
Metadata
JSON: 831-1.0087919.json
JSON-LD: 831-1.0087919-ld.json
RDF/XML (Pretty): 831-1.0087919-rdf.xml
RDF/JSON: 831-1.0087919-rdf.json
Turtle: 831-1.0087919-turtle.txt
N-Triples: 831-1.0087919-rdf-ntriples.txt
Original Record: 831-1.0087919-source.json
Full Text
831-1.0087919-fulltext.txt
Citation
831-1.0087919.ris

Full Text

MODELLING A TWO-SPECIES INTERACTION IN A HIGH TNTERTIDAL ALGAL COMMUNITY by Nickolas Grabovac B. Sc., University of British Columbia, 1995 A THESIS SUBMITTED IN PARTIAL F U L F I L L M E N T OF THE REQUIREMENTS FOR THE D E G R E E OF MASTER OF SCIENCE in THE F A C U L T Y OF G R A D U A T E STUDIES (Department of Botany) We accept this thesis as conforming to the required standard THE UNIVERSITY OF BRITISH C O L U M B I A May 1997 © Nickolas Grabovac, 1997 In presenting this thesis in partial fulfilment of the requirements for an advanced degree at the University of British Columbia, I agree that the Library shall make it freely available for reference and study. I further agree that permission for extensive copying of this thesis for scholarly purposes may be granted by the head of my department or by his or her representatives. It is understood that copying or publication of this thesis for financial gain shall not be allowed without my written permission. Department of BOTArO V The University of British Columbia Vancouver, Canada Date DE-6 (2/88) 11 ABSTRACT This study is an approach to simulating the population dynamics and species interactions in an intertidal algal community. The community being modelled is located in Barkley Sound, Vancouver Island and consists of three dominant perennial macroalgae, Mazzaella cornucopiae, Fucus gardneri, and Pelvetiopsis limitata, as well as some ephemeral algae and invertebrates such as barnacles and limpets. Interactions between the two species Mazzaella and Fucus were simulated in order to predict their population dynamics over a two-year period. The empirical basis for the simulation models was provided by the field experiments and observations of previous researchers. In total, eight different models were created, six of them being cellular automata (CA) models and the remaining two being birth-death difference equation models. These models were tested and validated using an independent set of field data. In general, all of the models were. very poor predictors of Fucus density. Two of the models were excellent predictors of Mazzaella percent cover: a stochastic nonseasonal C A model and & Mazzaella birth-death model. The study suggests that simple, few-species models are able to predict the.. dynamics of some species, even when such species interact with many other species in the community. In addition, this study serves as an example of how many of the problems associated with constructing mathematical models of ecological systems, especially C A models, can be overcome and how a greater understanding of the system of interest can be gleaned from their results. I l l T A B L E O F C O N T E N T S Page Abstract ii Table of Contents iii List of Tables . vi List of Figures viii Acknowledgments xiv. CHAPTER 1: Thesis introduction 1 General Introduction 1 The empirical basis for a CA model of a high intertidal community 3 Organization of the thesis 5 CHAPTER 2: Cellular automata models of a two-species interaction in a high intertidal community 8 INTRODUCTION 8 METHODS 10 Types of cellular automata models constructed 10 Parameterization of the cellular automata models: The DIPS algorithm 11 Deterministic cellular automata 16 Stochastic cellular automata 18 Zero neighbour distance cellular automata 21 Cellular automata model implementation 22 iv Cellular automata model testing and validation 22 RESULTS 25 CA model results for Mazzaella 24 months after initial sampling 25 CA model results for Mazzaella 22 months after initial sampling 25 CA model results for Fucus 24 months after initial sampling 27 CA model results for Fucus 22 months after initial sampling 28 CA model results for Mazzaella: observed vs. predicted plots 28 CA model results for Fucus: observed vs. predicted plots 29 CA model validation results 31 DISCUSSION 32 CHAPTER 3: Birth-death model .82 INTRODUCTION 82 METHODS 83 RESULTS 86 DISCUSSION 88 CHAPTER 4: General Discussion 100 Choice of modelling formalism , 100 A summary of model performance 103 The inverse problem in cellular automata and the DIPS algorithm 105 Cellular automata as a modelling formalism in ecology 110 REFERENCES 115 APPENDIX 119 LIST OF TABLES Page Table 2.1. The different cellular automata models constructed 40 Table 2.2. Deterministic, nonseasonal C A model state transition rules for Mqzzaella increase and mortality and Fucus recruitment and mortality, based on the number of Mazzaella and Fucus neighbours, p is the probability of the given state transition 40 Table 2.3. Deterministic, seasonal C A model state transition rules for Mazzaella increase and mortality, based on the number of Mazzaella and Fucus neighbours, p is the probability of the given state transition 41 Table 2.4. Deterministic, seasonal C A model state transition rules for Fucus recruitment and mortality, based on the number of Mazzaella and Fucus neighbours, p is the probability of the given state transition 41 Table 2.5. The season of the interval between each pair of field sampling dates (season of transition) used for parameterizing the seasonal C A models 42 Table 2.6. Stochastic, nonseasonal C A model state transition rules (conditional probability functions) for Mazzaella increase and mortality and Fucus recruitment and mortality, based on the number of Mazzaella and Fucus neighbours, p is the probability of the given state transition 42 Table 2.7. Stochastic, seasonal C A model state transition rules (conditional probability functions) for Mazzaella increase and mortality, based on the number of Mazzaella and Fucus neighbours, p is the probability of the given state transition ....43 Table 2.8. Stochastic, seasonal C A model state transition rules (conditional probability functions) for Fucus recruitment and mortality, based on the number of Mazzaella and Fucus neighbours, p is the probability of the given state transition 43 Table 2.9. Zero Neighbour Distance, nonseasonal C A model state transition . probabilities for Mazzaella increase and mortality mortality and Fucus recruitment and mortality 44 Table 2.10. Zero Neighbour Distance, seasonal C A model state transition probabilities for Mazzaella increase and mortality 44 vi Table 2.11. Zero Neighbour Distance, seasonal C A model state transition probabilities for Fucus recruitment and mortality 45 Table 2.12. Model predictive bias (calculated using the statistic) for all C A models. (Final refers to model predictions for the sampling date 24 months after the initial sample, and Previous refers to model predictions for the sampling date 22 months after the initial sample) 46 Table 2.13. Comparison of C A model predictions to a naive zero-change prediction (calculated using Theil's inequality coefficient, if) for all C A models. (Final refers to model predictions for the sampling date 24 months after the initial sample, and Previous refers to model predictions for the sampling date 22 months after the initial sample) 46 Table 3.1. Parameters for the two Birth-Death (BD) models, /? is the probability of recruitment and £ is the probability of mortality 91 Table 3.2. Birth-Death model predictive bias, calculated using the W statistic, for 22 months after initial sampling and 24 months after initial sampling 91 Table 3.3. Birth-Death model predictions as compared with a naive zero-change prediction, calculated using Theil's inequality coefficient (if), for 22 months after initial sampling and 24 months after initial sampling. A f / 2 = 0 indicates perfect predictions, if < 1. indicates model predictions are better than a naive zero-change prediction, if > 1 indicates the predictive power of the model is worse than a naive zero-change prediction 91 LIST OF FIGURES Page Figure 1.1. Location of Kim's (1995) study sites (from Kim 1995). 6 Figure 1.2. A diagrammatic representation of the interactions among the major component organisms in Kim's (1995) community. PEL and FUC in the upper diagram indicate Pelvetiopsis and Fucus at the recruitment stage, while those in the lower indicate the fucoids after recruitment stage. Small letters are the abbreviations for types of interaction: (co) for competition, (fa) for facilitation, (gr) for grazing, (ov) for overgrowth, (pr) for preemption, (pt) for protection, (re) for refuge, (sh) for shading (Adapted from Kim 1995) 7 Figure 2.1. The DIPS (Direct Identification of Probabilistic Synchronous Cellular Automata) algorithm (adapted from Adamatzky 1994) 47 Figure 2.2. Seasonal recruitment probabilities for Fucus gardneri 48 Figure 2.3. Seasonal mortality probabilities for Fucus gardneri 49 Figure 2.4. Seasonal increase probabilities for Mazzaella cornucopiae .50 Figure 2.5. Seasonal mortality probabilities for Mazzaella cornucopiae 51 Figure 2.6. Transition Probability Vector 0M,EmPty->Mazzaeiia, the probability of Mazzaella increase for the different neighbourhood configurations of Mazzaella. The bars represent the raw output from DIPS and the line . represents the regression equation for the DIPS output. The equation of the regression line is probability = 0.0042 + 0.091(# Mazzaella neighbours), r 2 = 0.98. '. 52 Figure 2.7. Transition Probability Vector 0F,EmPty->Mazzaeiia, the probability of Mazzaella increase for the different neighbourhood configurations of Fucus. The bars represent the raw output from DIPS and the line represents the regression equation for the DIPS output. The equation of the regression line is probability = 0.098 - 0.0030(# Fucus neighbours), r 2 = 0.16 53 v i i i Figure 2.8. Transition Probability Vector 0M ,Mazzaei ia->Em P ty , the probability of Mazzaella mortality for the different neighbourhood configurations of Mazzaella. The bars represent the raw output from DIPS and the line represents the regression equation for the DIPS output. The equation of the regression line is probability = 0.61 - 0.073(# Mazzaella neighbours), 1 r 2 = 0.99 54 Figure 2.9. Transition Probability Vector 0F ,Mazzaei ia->Em P ty , the probability of Mazzaella mortality for the different neighbourhood configurations of Fucus. The bars represent the raw output from DIPS and the line represents the regression equation for the DIPS output. The equation of the regression line is probability = 0.12 + 0.0063(# Fucus neighbours), r 2 = 0.62 55 Figure 2.10. Transition Probability Vector 0 M , E m p t y - > F u c u S , the probability of Fucus recruitment for the different neighbourhood configurations of Mazzaella. The bars represent the raw output from DIPS and the line represents the regression equation for the DIPS output. The equation of the regression line is probability = 0.049 + 0.00027e ( # M a z z a e l l a" e ig h b o u r s>, r 2 = 0.97 56 Figure 2.11. Transition Probability Vector 0 F ,Em P t y ->Fucus , the probability of Fucus recruitment for the different neighbourhood configurations of Fucus. The bars represent the raw output from DIPS and the line represents the regression equation for the DIPS output. The equation of the regression line is probability = 0.012 + 0 . 0 0 3 6 e ( # F " ™ g h b o u r s ) , r 2 = 0.88 '. 57 Figure 2.12. Transition Probability Vector 0M ,Fucus->Em P ty , the probability of Fucus mortality for the different neighbourhood configurations of Mazzaella. The bars represent the raw output from DIPS and the line represents the regression equation for the DIPS output. The equation of the regression line is probability = 0.33 - 0.033(# Mazzaella neighbours), r 2 = 0.68 58 Figure 2.13. Transition Probability Vector 0F ,Fucus->Em P ty , the probability of Fucus mortality for the different neighbourhood configurations of Fucus. The bars represent the raw output from DIPS and the line represents the regression equation for the DIPS output. The equation of the regression line is probability = 0.20 + 0.0025(# Fucus neighbours), r 2 = 0.008 59 Figure 2.14. Percent cover Mazzaella predicted by the six different C A models and the field data from the final sampling dates of the three control test quadrats, C-2 to C-4. The x denotes no field data available for the final sampling date for that quadrat 60 Figure 2.15. Percent cover of Mazzaella predicted by the six different C A models and the field data from the final sampling dates of the three Mazzae I la-removal test quadrats, 1-2 to 1-4 61 ix Figure 2.16. Percent cover of Mazzaella predicted by the six different C A models and the field data from the final sampling dates of the three Fwcws-removal test quadrats, F-2 to F-4 62 Figure 2.17. Percent cover of Mazzaella predicted by the six different C A models and the field data from the final sampling dates of the three Pelvetiopsis-removal test quadrats, P-2 to P-4 63 Figure 2.18. Percent cover of Mazzaella predicted by the six different C A models and the field data from sampling dates just prior to the final sampling dates of the three control test quadrats, C-2 to C-4 64 Figure 2.19. Percent cover of Mazzaella predicted by the six different C A models and the field data from sampling dates just prior to the final sampling dates of the three Mazzaella-removal test quadrats, 1-2 to 1-4. 65 Figure 2.20. Percent cover of Mazzaella predicted by the six different C A models and the field data from sampling dates just prior to the final sampling dates of the three Fucus-removal test quadrats, F-2 to F-4 66 Figure 2.21. Percent cover of Mazzaella predicted by the six different C A models and the field data from sampling dates just prior to the final sampling dates of the three Pelvetiopsis-removal test quadrats, P-2 to P-4 ...67 Figure 2.22. Density of Fucus predicted by the six different C A models and the field data from the final sampling dates of the three control test quadrats, C-2 to C-4. The x denotes no field data available for the final sampling date for that quadrat 68 Figure 2.23. Density of Fucus predicted by the six different C A models and the field data from the final sampling dates of the three Mazzae//a-removal test quadrats, 1-2 to 1-4 69 Figure 2.24. Density of Fucus predicted by the six different C A models and the field data from the final sampling dates of the three Fucus-removal test quadrats, F-2 to F-4 70 Figure 2.25. Density of Fucus predicted by the six different C A models and the field data from the final sampling dates of the three Pelvetiopsis-removal test quadrats, P-2 to P-4 71 Figure 2.26. Density of Fucus predicted by the six different C A models and the field data from sampling dates just prior to the final sampling dates of the three control test quadrats, C-2 to C-4 72 X Figure 2.27. Density of Fucus predicted by the six different C A models and the field data from sampling dates just prior to the final sampling dates of the three . Mazzaella-removal test quadrats, 1-2 to 1-4 73 Figure 2.28. Density of Fucus predicted by the six different C A models and the field data from samples just prior to the final sampling dates of the three Fucus-removal test quadrats, F-2 to F-4 74 Figure 2.29. Density of Fucus predicted by the six different C A models and the field data from sampling dates just prior to the final sampling dates of the three Pelvetiopsis-xomowaX test quadrats, P-2 to P-4 ....75 Figure 2.30. Observed vs. Predicted plot of Mazzaella percent cover for the deterministic C A models. EF = modelling efficiency. A. Deterministic, nonseasonal CA, 24 months after initial sampling, EF = 0.69. B. Deterministic, nonseasonal CA, 22 months after initial sampling, EF = 0.86. C. Deterministic, seasonal CA, 24 months after initial sampling, EF = 0.67. D. Deterministic, seasonal CA, 22 months after initial sampling, EF = 0.87. > 76 Figure 2.31. Observed vs. Predicted plot of Mazzaella percent cover for the stochastic C A models. EF = modelling efficiency. A. Stochastic, nonseasonal CA, 24 months after initial sampling, EF = 0.37. B. Stochastic, nonseasonal CA, 22 months after initial sampling, EF = 0.92. C. Stochastic, seasonal CA, 24 months after initial sampling, EF = - 0.19. D. Stochastic, seasonal CA, 22 months after initial sampling, EF = 0.70. .77 Figure 2.32. Observed vs. Predicted plot of Mazzaella percent cover for the zero neighbour distance (ZND) C A models. EF = modelling efficiency. A. ZND, nonseasonal CA, 24 months after initial sampling, EF = 0.10. B. ZND, nonseasonal CA, 22 months after initial sampling, EF = 0.63. C. ZND, seasonal CA, 24 months after initial sampling, EF = 0.37. D. ZND, seasonal CA, 22 months after initial sampling, EF = 0.53 78 Figure 2.33. Observed vs. Predicted plot of Fucus density for the deterministic C A models. EF = modelling efficiency. A. Deterministic, nonseasonal CA, 24 months after initial sampling, EF = - 0.94. B. Deterministic, nonseasonal CA, 22 months after initial sampling, EF = - 0.79. C. Deterministic, seasonal CA, 24 months after initial sampling, EF = - 0.74. D. Deterministic, seasonal CA, 22 months after initial sampling, EF = - 0.77 79 Figure 2.34. Observed vs. Predicted plot of Fucus density for the stochastic C A models. EF = modelling efficiency. A. Stochastic, nonseasonal CA, 24 months after initial sampling, EF = - 0.88. B. Stochastic, nonseasonal CA, 22 months after initial sampling, EF = - 0.59. C. Stochastic, seasonal CA, 24 months after initial sampling, EF = - 0.72. D. Stochastic, seasonal CA, 22 months after initial sampling, EF = - 0.36 80 Figure 2.35. Observed vs. Predicted plot of Fucus density for the zero neighbour distance (ZND) C A models. EF = modelling efficiency. A. ZND, nonseasonal CA, 24 months after initial sampling, EF = - 1.38. B. ZND, nonseasonal CA, 22 months after initial sampling, EF = - 0.13. C. ZND, seasonal CA, 24 months after initial sampling, EF = - 1.46. D. ZND, seasonal CA, 22 months after initial sampling, EF = - 0.14 81 Figure 3.1. Percent cover of Mazzaella predicted by the Mazzaella Birth-Death model and the field data from the final sampling dates of the 12 test quadrats. The x denotes no field data available for the final sampling date for that quadrat. C-2 to C-4 are control quadrats, 1-2 to 1-4 are Mazzaella-removal quadrats, F-2 to F-4 are Fwcws-removal quadrats and P-2 to P-4 are Pelvetiopsis-removal quadrats 92 Figure 3.2. Percent cover of Mazzaella predicted by the Mazzaella Birth-Death model and the field data from sampling dates just prior to the final sampling dates of the 12 test quadrats. C-2 to C-4 are control quadrats, 1-2 to 1-4 are Mazzaella removal quadrats, F-2 to F-4 are Fucus removal quadrats and P-2 to P-4 are Pelvetiopsis removal quadrats i 93 Figure 3.3. Density of Fucus predicted by the Fucus Birth-Death model and the field data from the final sampling dates of the 12 test quadrats. The x denotes no field data available for the final sampling date for that quadrat. C-2 to C-4 are control quadrats, 1-2 to 1-4 are Mazzaella removal quadrats, F-2 to F-4 are Fucus removal quadrats and P-2 to P-4 are Pelvetiopsis removal quadrats 94 Figure 3.4. Density of Fucus predicted by the Fucus Birth-Death model and the field data from sampling dates just prior to the final sampling dates of the 12 test quadrats. C-2 to C-4 are control quadrats, 1-2 to 1-4 are Mazzaella removal quadrats, F-2 to F-4 are Fucus removal quadrats and P-2 to P-4 are Pelvetiopsis removal quadrats 95 Figure 3.5. Observed vs. predicted plot of Mazzaella percent cover, 24 months after initial sampling. The line indicates the position of the 'perfect fit' (i.e. if the model predicts perfectly, all the points will line up along the line). EF = 0.46 (EF = modelling efficiency) 96 Figure 3.6. Observed vs. predicted plot Mazzaella percent cover, 22 months after initial sampling. The line indicates the position of the 'perfect fit' (i.e. if the model predicts perfectly, all the points will line up along the line). EF = 0.92 (EF = modelling efficiency) Figure 3.7. Observed vs. predicted plot of Fucus density, 24 months after initial sampling. The line indicates the position of the 'perfect fit' (i.e. if the model predicts perfectly, all the points will line up along the line). EF = - 2.2. (EF = modelling efficiency) "... Figure 3.8. Observed vs. predicted plot of Fucus density, 22 months after initial sampling. The line indicates the position of the 'perfect fit' (i.e. if the model predicts perfectly, all the points will line up along the line). EF = - 0.085. (EF = modelling efficiency). : X l l l A C K N O W L E D G M E N T S I would like to thank my teacher, supervisor and long time mentor, Dr. Robert E. DeWreede, for his support, encouragement, good humour, open mind and interest in mathematics. This study was funded by a Natural Science and Engineering Research Council of Canada PGS A scholarship. My thanks also go to my committee members, Drs. Gary Bradfield and Paul G. Harrison, for their critical suggestions and editorial comments on this thesis. I am grateful to Mark J. Kusec, for providing me with the software tools I needed to complete this project, as well as his friendship- helpful suggestions and assistance with debugging. I thank my colleagues in Dr. DeWreede's lab, Ricardo Scrosati, Kristen Drewes, Russell Markel, Tania Thenu, Andrea Sussman and Leonard Dyck, for stimulating discussions, help and friendship. I am very grateful for the love and support of my wife, Andrea Grabovac, without whom I probably never would have gotten my act together. Her help with organization and patience during some of the harrier days, even when she was tired and post-call, allowed me to complete this undertaking in a reasonable amount of time. I would like to thank my parents, Drago and Jelena Grabovac as well as my parents-in-law, Dagmar and Joseph Kalousek, for their understanding, encouragement, wisdom, and many delicious, hot meals during my study at UBC. 1 C H A P T E R 1 T H E S I S I N T R O D U C T I O N General Introduction In 1948, von Neumann proposed that the survival, reproduction and evolution of complex forms of organization could be explained, in principle, by the interactions of many identical and very simple primitives (i.e., fundamental, low-level building blocks) and their resulting dynamics (von Neumann 1966). This ambitious goal gave rise to the theory of cellular automata. Since that time, cellular automata theory has experienced long periods of dormancy, punctuated by periods of increased interest and new developments which closely followed increases in the power of computer hardware (Hogeweg 1988). Informally, cellular automata (also called tessellation automata) are discrete dynamical systems which are represented by a large tessellation (i.e., grid or lattice) of identical finite-state automata (called cells). There exists a large body of literature on the theory of finite-state automata (also known as finite-state machines) (see Bavel 1983 for an introduction). For the purposes of this thesis, the individual cells of the cellular automata (CA) are represented by a discrete number (usually small) of finite states which evolve in discrete time steps. The state of any given cell in the future is a function of its current state and the states of the surrounding cells in a defined neighbourhood. Common neighbourhoods used in the study of C A are the four nearest neighbours (von 2 Neumann neighbourhood) and the eight neighbours (Moore neighbourhood) on a square lattice. The function which determines the state of a given cell based on its neighbourhood configuration is often termed the next-state function, while the individual neighbourhood configurations which give rise to particular states are called the rules of the CA. C A models are discrete in space, state and time, and thus represent an alternative to more traditional differential equation approaches (which are continuous) to modelling. Cellular automata have become popular again in the last decade, especially as a way of modelling physical systems (Vichniac 1984). C A as a modelling approach have also recently received a great deal of interest by biologists (Ermentrout and Edelstein-Keshet 1993, Hogeweg 1988 for reviews). Some examples of applications of C A to biological problems are modelling D N A sequences (Burks and Farmer 1984), as spatially explicit population models for a wide variety of populations in ecology (grass and clover populations, Schwinning and Parsons, 1996; wild daffodil populations, Barkham and Hance 1982; competition between annual and perennial plant species, Crawley and May 1987; metapopulation dynamics of annual plants with a seedbank, Perry and Gonzalez-Andujar 199^ 3; effect of spatial patterns on interspecific competition, Silvertown et al. 1992) and as models of resource dynamics in plant populations (Colosanti and Grime 1993) . What all of these models have in common is the use of C A to answer questions about how population dynamics are altered when various attributes of the environment are manipulated. This is one type of investigation for which C A models are ideally suited (Durrett and Levin 1993). C A models have many advantages over other modeling approaches. First, C A are explicitly spatial and as such, they are ideally suited to modeling the spatial dynamics of organisms. Indeed, in systems where the interactions between individuals are local and there is spatial heterogeneity in species distributions and/or environmental conditions, models which are able to explicitly incorporate space are considered to be a necessity (Caswell and John 1992, Judson 1994). Secondly, C A models are constructed from the "bottom-up" because they explicitly incorporate the behaviours and states of individuals in the system. It is the interaction of these individuals which then determine the dynamics of the system. This is useful because it allows the modeler to reproduce in quantitative detail the results of an experimental manipulation (Ermentrout and Edelstein-Keshet 1993). The empirical basis for a CA model of a high intertidal community From 1991 to 1994, Kim (1996 and 1995) experimentally studied two rocky high intertidal communities at Prasiola Point and Nudibranch Point, located in Barkley Sound on the west coast of Vancouver Island, British Columbia, Canada (48°49' N , 125°10' W) near the Bamfield Marine Station (Fig. 1.1). The community he studied was composed of three dominant perennial macroalgae: Fucus distichus L., Pelvetiopsis limitata Gard (Phaeophyta), and Mazzaella cornucopiae Hommersand (Rhodophyta), as well as some ephemeral algae. In addition, invertebrates such as barnacles, limpets, and snails were also present. Kim examined many biotic and abiotic factors affecting the high intertidal 4 community such as competition, facilitation, herbivory, and disturbance, and proposed a , complex set of interactions to explain the dynamics of the community (Fig. 1.2). Such a conceptual model is an excellent starting point for developing mathematical and computer models to generate testable hypotheses and predictions. In particular, because Kim collected detailed, small-scale, spatial data on his community, his work is an ideal empirical foundation for the construction and quantitative testing of a C A model. In addition, Kim's experimental results stressed that local, spatial interactions between members of the community were very important in determining the dynamics of the system (Kim, 1995), and this provided further incentive for using C A to model this system. The main objective of this thesis was to use the experimental results from Kim's work to construct a series of C A models of Kim's high intertidal community in order to simulate the population dynamics of Mazzaella cornucopiae and Fucus gardneri. This goal was important for two reasons. Firstly, the ability to accurately simulate population dynamics is one of the cornerstones of applied ecology and is important for the management and conservation of populations. Secondly, the use of C A models as simulation tools has never before been attempted in ecology. Thus, using C A models in this way is a genuinely new modelling approach with much potential, and if successful in this study, could prove to be a useful tool for the simulation of other populations. 5 Organization of the Thesis This thesis consists of 5 chapters: an introductory chapter, two research chapters, a concluding chapter and an appendix. In Chapter 2, the construction of six different C A models and their predictions are described. The different model predictions are tested against field data and are compared and ranked in terms of predictive ability. Chapter 3 examines the results from a simple birth-death model as an alternative to the C A models of chapter 2. Predictions from the birth-death model are also tested against field data. Chapter 4 discusses the approach of constructing multiple models of a system as multiple competing hypotheses and ranks all the models created to determine the overall best model. In addition, the implications of constructing C A models as simulation tools in ecology are discussed, as well as some of the problems with the C A approach and how they were resolved in this thesis. The appendix contains the source code for one of the C A models, as an example of how such models are actually implemented Figure 1.1. Location of Kim's (1995) study site. B = Prasiola Point. 3 WAVE IMPACT DESICCATION L E G E N D Solid line : strong interaction Dashed line : weak interaction Arrow head : negative interaction Round head : positive interaction Clear point : indirect interaction Dark point : direct interaction P E L CO . ' CO E P H Figure 1.2. A diagrammatic representation of the interactions among the major component organisms in Kim's (1995) community. PEL and FUC in the upper diagram indicate Pelvetiopsis and Fucus at the recruitment stage, while those in the lower indicate the fucoids after recruitment stage. Small letters are the abbreviations for types of interaction: (co) for competition, (fa) for facilitation, (gr) for grazing, (ov) for overgrowth, (pr) for preemption, (pt) for protection, (re) for refuge, (sh) for shading. (Adapted from Kim 1995). 8 CHAPTER 2 CELLULAR AUTOMATA MODELS OF A TWO-SPECIES INTERACTION IN A HIGH INTERTIDAL COMMUNITY INTRODUCTION There has been an explosion of interest in recent years in the use of cellular automata models in ecology (Ermentrout and Edelstein-Keshet 1993). This is largely the result of frustration with more traditional modelling approaches which assumed a homogenous environment, and thus did not account for spatial heterogeneity. In addition, the availability of relatively cheap, yet computationally powerful, computers has allowed the cellular automata approach to become practical (Judson 1994, DeAngelis and Gross 1992, Huston et al. 1988), and often much simpler and more intuitive for non-mathematically minded ecologists. The majority of cellular automata (CA) models of ecological systems to date are what can be called 'what-if models because they attempt to answer general questions about the types of global behaviours that can be expected given certain local interaction rules between the organisms in the model. Such models are excellent for specifying limitations on the possible causes for the patterns observed in nature, but they are not able to tell us whether or not the rules specified in the model are indeed the particular mechanisms which are acting in nature. The goal of this approach is to eventually arrive at general ecological laws which can be used to explain the distribution and abundance of organisms 9 through time. Although many such models have been constructed, we are still very far from the goal. A different approach is to use C A models to simulate a system as exactly as possible. In this case, we trade the generality of the 'what-if approach for the concreteness of a real system existing in nature. The goal here is to be able to quantitatively predict the distribution and abundance of the. organisms in the particular system of interest at particular times. Such models can be extremely useful tools for the management of specific populations and are useful for answering questions about the effects of specific changes in a particular system on the organisms inhabiting that system. To date, this approach has hardly been explored at all in ecology, possibly due to the preponderance of 'what-if C A models. This is unfortunate since C A are ideal models for simulation in ecology, as well as other fields such as physics where they are being used with increasing regularity (Vichniac 1984). The purpose of this study was to use the cellular automata approach to construct simulation models of Kim's high intertidal community in order to predict the population dynamics of Mazzaella cornucopiae and Fucus gardneri, the two dominant macrophytes in the community. Several different C A models were constructed to provide a set of competing models from which the best model (i.e., the one which most accurately predicted the dynamics of Mazzaella and Fucus) could be chosen. 10 METHODS Types of Cellular Automata Models Constructed Six different cellular automata (CA) models were constructed in an attempt to predict the population dynamics of Mazzaella and Fucus (Table 2.1). These models were divided into three categories: 1) deterministic, 2) stochastic and 3) zero-neighbour distance (ZND) models. Each of these three categories of C A model was further divided into a seasonal and a nonseasonal model. The deterministic models had transition rules which occurred with a probability of 1.0, thus making the behaviour of this class of models completely non-random. The stochastic models, on the other hand, had a probability associated with each transition rule in the model, thus introducing a random component to this class of models. The ZND models were also stochastic (i.e., had probabilistic transition rules) but the neighbourhood size of each cell in the model was zero. In other words, in the ZND models, the behaviour of each cell was not dependent on the state of the cells surrounding it. Thus, a ZND model is a C A model without local interactions present. Nonseasonal models were constructed in such a way that the transition rules did not depend on the season, whereas seasonal models had transition rules which changed depending on what season it was. Al l of the C A models had three possible states for each cell: Mazzaella, Fucus and empty. Transition rules and testing for each of the six C A models were estimated from 16 permanent quadrats of field data, sampled bimonthly over a two-year period by Kim (1995). These data consisted of 20 by 20 cm quadrats which were divided into 400 one cm 2 cells. During each sampling date, Kim recorded whether one or more of the species 11 Mazzaella cornucopiae, Fucus gardneri and Pelvetiopsis limitata were present in each cell of each of the 16 permanent quadrats. These quadrats thus formed maps of the three dominant macrophytes in the community every two months for a period of two years. In order to have independent data sets for both parameterization and testing, it was necessary to split the data pool into two smaller subsets of data. The first subset was used for estimating the transition rules for the various C A models and consisted of four of the 16 permanent quadrats. Each of these four parameterization quadrats represented a different treatment in Kim's (1995) field work: a control quadrat (no treatment applied), a Mazzaella removal quadrat, a Fucus removal quadrat and a Pelvetiopsis removal quadrat. The second subset was used for testing the C A models and consisted of 12 of the 16 permanent quadrats. These 12 quadrats consisted of three quadrats of each of the four treatments described above. Parameterization of the Cellular Automata Models: The DIPS algorithm All of the transition rules for the different C A models were estimated from the four parameterization quadrats using the DIPS (Direct Identification of Probabilistic Synchronous Cellular Automata) algorithm, developed by Adamatzky (1992, 1994) (Fig. 2.1). DIPS treats each quadrat map as a snapshot of the global state of a C A model with unknown rules. Each cell of the parameterization quadrats is treated as if it is a cell in a stochastic CA. DIPS begins by examining the 'state' of a given cell for the first sampling date of a given quadrat. In this case, the 'state' of the quadrat cell can be Mazzaella, Fucus, or 12 empty (bare rock). In the case where a quadrat cell contained more than one species, the extra species was removed by consulting a random number table. If the number from the table was between zero and four, inclusive, then species A would be the 'state' of that cell, otherwise species B would be the 'state' of that cell. DIPS then looks at the neighbourhood of the cell of interest (i.e., examines the states of all of the cells adjacent to the cell of interest). Because the C A models being constructed have three states: Mazzaella, Fucus and empty (bare rock), there are 45 possible neighbourhood configurations of these three states, where a neighbourhood is defined as every cell adjacent to the cell of interest (i.e., the 8 cells surrounding a given cell). Each neighbourhood configuration is identified by the number oi Mazzaella and Fucus cells present in it, ignoring the exact spatial ordering of each of the cells around the given cell. Examples of neighbourhood configurations are three Mazzaella and one Fucus, five Mazzaella and zero Fucus and one Mazzaella and four Fucus. Once DIPS identifies the neighbourhood configuration of a given cell, it then increments a counter representing the number of times that particular configuration has been encountered. DIPS uses the value of the counter to create a Neighbourhood Configuration Matrix, N, where each element of the matrix corresponds to the number of occurrences of each neighbourhood configuration in the quadrat being examined. For the C A being constructed here, N is a 9x9 matrix with the rows representing the number of Mazzaella in the neighbourhood and the columns representing the number of Fucus in the neighbourhood (equation (2.1)). 13 number of Fucus neighbours "0,1 • • • ... "0,8 "2,6 "1,7 0 0 0 "3,5 0 0 0 number of n4,4 0 0 0 0 Mazzaella "5,3 0 0 0 0 0 neighbours 0 0 0 0 0 0 n7] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 where N is the Neighbourhood Configuration Matrix and the nr> c represent the number of occurrences of the neighbourhood configuration with r Mazzaella neighbours and c Fucus neighbours. This matrix is used later to calculate the Transition Probability Matrices (see below). DIPS then takes the next sampling date for the same quadrat and examines the 'state' of the same cell. In this way, DIPS determines the transition which is taking place during the time interval from sample / to sample t+1. After identifying the transition, DIPS increments another counter, representing the number of times that particular state transition has occurred with a particular neighbourhood configuration. DIPS uses this counter to create a series of State Transition Matrices, Tj (one for each possible state transition), where the elements of the matrices correspond to the number of occurrences of a given transition for a particular neighbourhood configuration. In the case of the C A models being constructed here, there were four State Transition Matrices, one for each of the following transitions: 1) Mazzaella to empty, 2) empty to Mazzaella, 3) Fucus to empty and 4) empty to Fucus1. Each of these State Transition Matrices were 9x9 matrices, with the rows representing the number oi Mazzaella cells in the neighbourhood and the columns representing the number of Fucus cells in the neighbourhood (equation (2.2)). number of Fucus neighbours number of Mazzaella (2.2) neighbours where T, is the State Transition Matrix for transition i and the tt, c represent the number of occurrences of transition i with r Mazzaella neighbours and c Fucus neighbours. This process is repeated, with DIPS moving from one cell to another in the quadrat map, until it reaches the last cell for that particular quadrat. At this point, DIPS estimates the Transition Probability Matrices, P; (one for each possible transition), the elements of which represent the probability of a given transition occurring for a particular neighbourhood configuration. Each element in the Pj is calculated by dividing the corresponding element in Tj with the corresponding element in N (i.e., by dividing the 1 The state transitions Mazzaella to Fucus and Fucus to Mazzaella were not included in the CA models because these transitions occurred so rarely in the data set that they were omitted in order to simplify the models. The transition from a given state to itself, such as Mazzaella to Mazzaella, Fucus to Fucus and Empty to Empty, were not estimated, since they represent no-change conditions which are easily incorporated into the model during coding (with no loss of information) and thus did not require explicit estimation of their probabilities. ... ' 1 ,7 0 >2,6 0 0 ' 3 .5 0 0 0 0 0 0 0 ' 5 ,3 0 0 0 0 0 6,2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 number of times a given transition was encountered by the number of times its particular neighbourhood configuration was encountered). Thus for the C A models being constructed here, the Pj consist of four 9x9 matrices, with the rows and columns the same as for the Tj (equation (2.3)). P. = ^0,0 ^0,1 « 0 , 0 "o.i ^1,0 W l , 0 ' 8 , 0 *7J 7,1 number of Fucus neighbours *6,2 n 6,2 *5,3 n 5,3 "•4,4 '4,4 2,6 3,5 1,7 n W0.8 0 1,7 0 0 2,6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 . 0 0 0 number of Mazzaella (2.3) neighbours where P, is the Transition Probability Matrix for transition / and the p r, c represent the probability of transition / with r Mazzaella neighbours and c Fucus neighbours. DIPS then takes the next pair of samples and repeats the entire process, checking to see if the transition probabilities satisfy a Cauchy criterion (i.e., that each transition probability converges to a stable value). If this criterion is satisfied, the algorithm stops. 16 Otherwise, the neighbourhood radius is increased by one and the entire process is" repeated again. DIPS continues to increase the size of the neighbourhood radius until either the transition probabilities converge, or the size of the neighbourhood is too large to fit within the quadrat. Because the quadrat maps did not contain enough data to obtain reliable estimates of transition probabilities from a single pair of samples (see Chapter 4), a modified form of DIPS was used. In the modified form of DIPS, all the sample pairs were enumerated for neighbourhood configurations and state transitions before calculating the transition probabilities, thus pooling the entire two-year data set. In addition, a neighbourhood radius of one was used, even though only 60% of the transition probabilities had -converged at this radius. In order to use DIPS to estimate the transition rules in the C A models being constructed, a computer program was written in C++ (Borland, v4.5) to implement the DIPS algorithm. Data for the four parameterization quadrats were entered into a spreadsheet in Microsoft Excel (v 5.0) and then converted to a text file. Another program was made to read the quadrat maps from the text file and send the data to the . DIPS program. All output from DIPS was then saved in another text file to be analyzed later. Deterministic Cellular Automata In order to construct the deterministic C A models, the Transition Probability Matrices output from DIPS were examined and approximated by the deterministic rules shown in 17 Table 2.2. These rules were used as the state transition rules for the nonseasonal deterministic C A model. In order to construct the seasonal model, the DIPS output was pooled by season to produce seasonal probabilities of recruitment and mortality for Fucus (Figs. 2.2 and 2.3) and seasonal probabilities of increase and mortality for Mazzaella (Figs. 2.4 and 2.5). Thus, if a transition from empty to Mazzaella occurred during the summer, for example, it would be lumped together with all of the other summer empty to Mazzaella transitions in order to determine the probability of Mazzaella increase in the summer. Because the 'transitions' in community structure measured by Kim in the field occurred during the time intervals between successive sampling dates, the transitions in the C A models were timed to occur in the same time intervals. Thus, for the seasonal deterministic C A model (and also for all of the other seasonal C A models), it was necessary to assign a season to each of the time intervals between each pair of successive sampling dates. When both successive sampling dates occurred in the same season, the season assigned to the interval between the sampling dates was simply the season during which both field samples were taken. When the successive sampling dates occurred during different seasons, a method was required in order to assign a season to the interval between the pair of successive sampling dates. This method is shown in Table 2.5. Thus, over a two-year period, with each time interval in the model representing two months of real time, there were 4 spring, 3 summer, 3 fall and 2 winter seasons for each of the 12 test quadrats (Table 2.5). 18 The seasonal transition probabilities were incorporated into the seasonal deterministic C A model by approximating the probabilities using a deterministic rule. The rules used in the seasonal model are shown in Tables 2.3 and 2.4. Stochastic Cellular Automata The raw output from DIPS was not used directly for the transition probabilities of the stochastic C A models, since this would have required that each model have 180 parameters (four transitions, each with 45 different transition probabilities corresponding to the different neighbourhood configurations). To simplify the models the transition probabilities were pooled by reducing the number of neighbourhood configurations from 45 to 9 for each given transition, using equations (2.4) to (2.9): TJM = N z (2.4) where rjM is the Neighbourhood Configuration Vector for the different neighbourhood configurations of Mazzaella (i.e., pooled across all Fucus configurations) and z= 1 . VF = ^Z (2.5) where TJF is the Neighbourhood Configuration Vector for the different neighbourhood configurations of Fucus (i.e., pooled across all Mazzaella configurations) and N l is the transpose of N . 19 TM,i = T, z (2.6) where XM is the State Transition Vector for the different neighbourhood configurations oi Mazzaella (i.e., pooled across all Fucus configurations). TF,i = T\z (2.7) where TF is the State Transition Vector for the different neighbourhood configurations of Fucus (i.e., pooled across all Mazzaella configurations) and T ' , - is the transpose of T , - . (2.8) where QM,I is the Transition Probability Vector for the different neighbourhood configurations of Mazzaella for transition i . (2.9) where QF,i is the Transition Probability Vector for the different neighbourhood configurations of Fucus for transition i. Regressions were performed on the Transition Probability Vectors to give conditional probability functions, in order to simplify the construction of the stochastic C A even further, and also to allow for easier modification of the models. The Transition Probability Vectors for each stochastic C A model transition, and their corresponding conditional probability functions are shown in Figures 2.6 to 2.13. 20 An examination of Figures 2.6 and 2.7 revealed that the probability oi Mazzaella increase was dependent on the number of Mazzaella neighbours in its neighbourhood, and that it appeared to be largely independent of the number of Fucus neighbours. For this reason, only the conditional probability function for Mazzaella increase for a given neighbourhood configuration oi Mazzaella was used in the model. Although the " probability oi Mazzaella mortality was dependent on both the numbers oi Mazzaella and Fucus neighbours in its neighbourhood, the dependence oi Mazzaella mortality on Mazzaella largely outweighed its dependence on Fucus (Figs. 2.8 and 2.9). thus, only the conditional probability function for Mazzaella mortality for a given neighbourhood configuration oi Mazzaella was used in the model. There was a strong relationship between the number oi Mazzaella neighbours and the probability of recruitment for Fucus (Fig. 2.10), resulting in a range of recruitment probabilities from 0.05 to 0.8. Although there was a relationship between the number of Fucus neighbours and the probability of Fucus recruitment (Fig. 2.11), the range of recruitment probabilities was only from 0.02 to 0.09. The number oi Mazzaella neighbours thus accounted for much greater magnitude changes in Fucus recruitment probabilities than the number of Fucus neighbours. For this reason, only the conditional probability function for Fucus recruitment for a given neighbourhood configuration of Mazzaella was used in the stochastic C A models. Although the probability of Fucus mortality was dependent on both the numbers of Mazzaella and Fucus neighbours in its neighbourhood, the dependence of Fucus mortality on Mazzaella largely outweighed its dependence on Fucus (Figs. 2.12 and 2.13). For this reason, only the conditional 21 probability function for Fucus increase for a given neighbourhood configuration of Mazzaella was used in the model. The nonseasonal stochastic C A model was test run 100 times for 12 iterations (equivalent to 2 years in the real world) and the model results were compared to the final sample for the control quadrat C-2 from the model testing data set. The conditional probability functions for the model were then modified slightly (usually be changing the value of the y-intercept in the regression equation) in order to produce a better fit to the C-2 field results. These modified conditional probability functions were then used in the final versions of the stochastic C A models and are shown in Tables 2.6 to 2.8. To construct the seasonal stochastic C A model, the same deterministic rules as for the deterministic seasonal C A model were used, with respect to the behaviour of each species in the different seasons. The seasonal stochastic transition rules were thus a combination of deterministic and probabilistic rules and are shown in Tables 2.7 and 2.8. Zero-Neighbour Distance Cellular Automata In order to estimate the probability of recruitment or increase for a given species, the number of recruitment or increase events over all of the samples in the four parameterization quadrats for that species were counted and divided by the total number of possible recruitment or increase events (i.e., the DIPS output was pooled across all possible neighbourhood configurations so as to reduce the Transition Probability Matrices to scalars representing the total probability of a given state transition). The total number of possible recruitment events was estimated by the total number of empty 22 sites in which recruitment was able to occur (i.e., by counting every empty cell for each sampling date for each quadrat). The probability of mortality for the two species was determined similarly, by counting all the mortality events for a given species and dividing by the total number of possible mortality events. In this case, the total number of possible mortality events was simply the total number of the species in question in all of the samples of all of the quadrats. Table 2.9 shows the estimated recruitment and mortality probabilities for Fucus and the increase and mortality probabilities for Mazzaella which were used in the nonseasonal ZND C A model. The raw output from DIPS for seasonal probabilities of increase and mortality for Mazzaella and seasonal probabilities of recruitment and mortality for Fucus were used as the stochastic seasonal transition rules for the seasonal ZND C A model (Tables 2.10 and 2.11). Cellular Automata Model Implementation The six different C A models discussed above were implemented by writing a computer program for each model in Turbo C (Borland, v4.5) (see the Appendix for the source code of the nonseasonal Zero-Neighbour Distance C A model). Cellular Automata Model Testing and Validation Because transition probabilities were estimated from each successive pair of samples taken from the four parameterization quadrats, and the interval between successive field samples was approximately two months (Kim 1995), each time step (iteration) in the C A models represented two months in the real world. Data from the four parameterization 23 quadrats were pooled over the two year sampling period in order to estimate the transition rules in the models (see DIPS algorithm above). Thus, any monthly dynamics present in the parameters were destroyed since the parameters were calculated as averaged transition probabilities over a two year period. As a result, predictions from the C A models were only possible every 12 iterations (two years in the real world). In order to generate predictions from the different C A models, each model was run for 12 iterations. The deterministic C A models were only run once, since additional runs could only produce identical results. The stochastic C A models and the ZND, C A models were run 100 times each and the average of the 100 runs used for testing and validation. Model predictions for each C A model were obtained for each of the 12 test quadrats by initializing the initial states of every cell in the C A models with the corresponding one cm 2 cell of the initial sampling date of each of the 12 test quadrats. Model predictions for a given test quadrat were then paired with that test quadrat for testing purposes. In order to mimic the various treatments performed by Kim (1995) in 9 of the 12 test quadrats, the C A models were coded so that at each iteration of the model, the appropriate treatment was also performed in the model. The model results were compared with both the last sampling date of the test quadrats (which occurred 24 months after the initial sampling) and the sampling date just prior to the last one (which occurred 22 months after the initial sampling), for each test quadrat. The reason for this was twofold: 1) data from the last sampling date for test quadrat C-4 was incomplete and therefore could not be used to test model predictions, and 2) nearly all densities and percent covers for both Fucus and Mazzaella from the last sampling date tended to be markedly lower than the 24 22 month sample, much more so than at any other time observed in the two year sampling history. Comparison of the C A model results to the field data from the test quadrats was performed in several ways. First, the model predictions were plotted next to the actual field data for visual inspection of the model results. In addition, observed vs. predicted plots were made and model efficiencies, EF, (equation 2.10) (Mayer and Butler 1993) were calculated for all the C A models. E F = 1_IMZ^)L (2.10) Z ( » - * ) 2 where the numerator represents the sum of squares about the line of perfect fit ( y = y) and the denominator represents the corrected sum of squares. An EF of 1.0 indicates that the model predictions are identical to the observed results. An EF less than zero indicates a very poor fit between model predictions and observed results (Mayer and Butler 1993). Models were then tested for systematic errors in prediction by calculating model predictive bias W (Power 1993) using the following formula: W = ^ l (2.11) where m is the number of quadrats in the model testing data set, 5 is the sample standard deviation of the data values in the model testing data set and e is the model bias, where 25 m e = ^ (2.12) m and et = Mt - St, where e, is the predictive error at time t, calculated as the difference between the model prediction at time t and the actual field data value at time /. Because the models were being tested using a single data point from each test quadrat, the predictive bias was calculated across the 12 different quadrats rather than over 12 different times. In order to test the predictive power of the models (by comparing with a naive zero change prediction), and to facilitate comparison between the different C A models, Theil's inequality coefficient (Power 1993) (equation (2.13)) was also calculated for the six models. m U2=^—m (2.13) t=\ where U2 is Theil's inequality coefficient. If the model predicts perfectly, then U= 0. If U < 1 then the model predicts better than a naive zero change prediction, and if U > 1 then the model predicts more poorly than a naive zero change prediction. As with predictive bias, rather than testing over time, the C A models were tested across quadrats. Thus, a naive zero change prediction assumes that the percent cover and density of Mazzaella and Fucus, respectively, will be the same in every quadrat. The different C A models were then ranked according to their U values. 26 R E S U L T S CA model results for Mazzaella 24 months after initial sampling The percent covers of Mazzaella predicted by the C A models and compared with the field results, 24 months after the initial sampling date, are shown in Figures 2.14 to 2.17. All of the C A models overestimated the percent cover of Mazzaella in control quadrat C-3, all the Fucus-removal quadrats (F-2 to F-4) and all of the Pelvetiopsis-vemoval quadrats (P2 to P4) (Figs. 2.14, 2.16 and 2.17). Model predictions in these quadrats tended to differ from the field results by 10 percent cover or more. Only the Zero-Neighbour Distance models predicted greater that zero Mazzaella percent cover for the Mazzaella-removal quadrats (1-2 to 1-4) (Fig. 2.15). No comparisons between model predictions and field data were possible for the C-4 control quadrat because there were no field data for the final sampling date (24 months after the initial sampling) for that quadrat; however, a great deal of variation occurred between the C A model predictions for that quadrat and sampling date (Fig 2.15). Model predictions for this quadrat ranged from zero percent cover to almost 10 percent cover. CA model results for Mazzaella 22 months after initial sampling The percent covers of Mazzaella predicted by the C A models and compared with the field results, 22 months after the initial sampling date, are shown in Figures 2.18 to 2.21. In general, model predictions for Mazzaella percent cover for the sampling date 22 27 months after the initial sampling were closer to the field results than for the 24 month sampling date. No systematic overestimation or underestimation was present, except for the Pelvetiopsis-remowal quadrat, P-3, in which all the models overestimated the percent cover of Mazzaella (Fig. 2.21). Only the ZND and stochastic seasonal models predicted greater than zero percent cover of Mazzaella for the Mazzaella-removal quadrats (1-2 to 1-4) (Fig. 2.19). CA model results for Fucus 24 months after initial sampling There was high variability between different C A model predictions of Fucus density for the 24 month sampling date, especially for control quadrat C-4 (Figs. 2.22 to 2.25). In general, the models did not seem to predict Fucus densities well - differences in density between the model results and field data were often greater than 10 plants per 400 cm2. Fucus densities were consistently underestimated in all of the Mazzaella-removal quadrats (1-2 to 1-4) and in the Pelvetiopsis-r emoval quadrat P-2 (Figs. 2.27 and 2.29). On the other hand, Fucus densities in the Fucus-removal quadrats F-2 and F-4 were consistently overestimated (Fig. 2.24). Only the nondeterministic models (i.e., the stochastic nonseasonal and seasonal, and the seasonal and nonseasonal ZND models) predicted greater than zero densities of Fucus for the Fwcws-removal quadrats (F-2 to F-4) (Fig. 2.24). As with Mazzaella percent cover results for the same sampling date, no comparisons between Fucus C A model results and field data were possible for the C-4 control quadrat due to a lack of field data. .. 28 CA model results for Fucus 22 months after initial sampling In contrast to the Mazzaella percent cover results, the Fucus density predictions did not seem to improve in the 22 month sampling date as compared with the 24 month sampling date results (Figs. 2.22 to 2.29). Fucus densities in the Mazzaella-removal quadrats, 1-2 and 1-4, as well as all Fucus-removal quadrats (F-2 to F-4) were consistently overestimated by the various C A models (Figs. 2.27 and 2.28). As with the model predictions for the 24 month sampling date, only the nondeterministic models predicted greater than zero Fucus densities for the Fucus-removal quadrats (F-2 to F-4) (Fig. 2.28). CA model results for Mazzaella: observed vs. predicted plots The observed vs. predicted plots of Mazzaella percent cover showed very clearly which C A models predominantly overestimated the percent cover of Mazzaella, since most of the points in the plots in which overestimation occurred fell below the line of perfect fit. Very little difference in predictive ability was observed between the deterministic, nonseasonal and the deterministic, seasonal C A models for the sampling date 24 months after the initial sampling (Fig. 2.30, A and C; EF = 0.69 and 0.67 for the nonseasonal and seasonal deterministic CA, respectively), as well as between the same two models for the 22 month sampling date (Fig. 2.30, B and D; EF = 0.86 and 0.87 for the nonseasonal and seasonal deterministic CA, respectively). For all of the deterministic model results, the predictions of Mazzaella percent cover in the 22 month sampling date (EF = 0.86 and 0.87) were much better than for the 24 month sampling date (EF = 0.69 and 0.67). Comparison between the 22 and 24 month sampling date stochastic model 29 results were similar in that the 22 month sampling date predictions (Fig. 2.31, B and D; EF = 0.92, 0.70 for the nonseasonal and seasonal stochastic CA, respectively) were much better than the 24 month predictions (Fig. 2.31, A and C; EF = 0.37, -0.19 for the nonseasonal and seasonal stochastic CA, respectively). For both sampling dates, the nonseasonal stochastic C A model predicted substantially better than the seasonal stochastic model. In fact, examination of the observed vs. predicted plots for these models revealed that the seasonal model tended to overestimate Mazzaella percent cover more than the nonseasonal model (Fig. 2.31 A to D). These observations were confirmed by the large difference in model efficiency between the two models. Zero-Neighbourhood Distance predictions of Mazzaella percent cover for both the 22 and 24 month sampling date seemed to bear no relationship with the actual field results, since the points in the observed vs. predicted plots of these models did not cluster around the line of perfect fit at all (Fig. 2.32, A to D). The predictive abilities for this entire class of models thus seemed quite poor, with the 24 month sampling date predictions being worse than the 22 month predictions, as reflected in the model efficiencies for these models. In addition, the seasonal ZND model seemed to predict better than its nonseasonal counterpart (EF = 0.10 and 0.37 for the 24 month nonseasonal and seasonal ZND, respectively; EF = 0.63 and 0.53 for the 22 month nonseasonal and seasonal ZND, respectively). CA model results for Fucus: observed vs. predicted plots An examination of the observed vs. predicted plots of Fucus density revealed that all the C A models were very poor predictors of Fucus density. The plots of the model 30 predictions from the 24 month sampling date showed very clearly that the deterministic models consistently underestimated Fucus density, since all the points fell above the line of perfect fit (Fig. 2.33, A and C). This was reflected in the poor model efficiencies of these two models (EF = -0.94 and -0.74 for the nonseasonal and seasonal deterministic CA, respectively). Plots for the 22 month sampling date predictions of the same models did not show any consistent underestimation of Fucus density; however, the scatter of points seemed to bear no relationship to the line of perfect fit, indicating that these models also had no predictive power for the 22 month sampling date (Fig 2.33, B and D). Again, this was clearly reflected in the poor model efficiencies for these models (EF = -0.79 and -0.77 for the nonseasonal and seasonal deterministic CA, respectively). Results for the stochastic C A models, for both the 22 and 24 month sampling dates, were also extremely poor. Examination of the observed vs. predicted plots for these models revealed very little relationship between the scatter of points and the line of perfect fit (Fig. 2.34, A to D). Again, this was reflected in the poor model efficiencies for these models (EF = -0.88 and -0.72 for the 24 month predictions of the nonseasonal and seasonal stochastic CA, respectively; EF = -0.59 and -0.36 for the 22 month predictions of the nonseasonal and seasonal stochastic CA, respectively). The ZND models were similarly poor predictors of Fucus density at both sampling dates (Fig. 2.35, A to D) and also had correspondingly low model efficiencies (EF = -1.38 and -1.46 for the 24 month predictions of the nonseasonal and seasonal ZND CA, respectively; EF = -0.13 and -0.14 for the 22 month predictions of the nonseasonal and seasonal ZND CA, respectively). 31 C A model validation results Table 2.12 shows the W statistic for predictive bias for all of the C A models. Several of the models were statistically significantly biased in their predictions, thus making them unacceptable for use on statistical grounds. The models which were found to be statistically significantly biased predictors of Mazzaella percent cover were the stochastic seasonal model (24 month predictions) and the nonseasonal ZND C A (24 month predictions). Both of these models showed large overestimation of Mazzaella percent covers in the observed vs. predicted plots (Figs. 2.31 C and 2.32 A). Models which were unacceptable predictors of Fucus included all of the C A models when predicting the density of Fucus 24 months after the initial sampling date (with the exception of the stochastic C A models), all of which showed marked underestimation of Fucus densities in the observed vs. predicted plots (Figs. 2.33 A, C and 2.35 A and C). Both stochastic models were found to be statistically significantly biased in their predictions of Fucus density for the 22 month sampling date. The remaining models did not show any statistically significant predictive bias (Table 2.12). Although many of the C A models were poor predictors of Mazzaella percent cover and Fucus density, all of them predicted better than a naive zero change prediction (Table 2.13), including the C A model predictions of Fucus density (which tended to give very poor predictions). Since Theil's inequality coefficient can be used to rank competing models in terms of predictive power (the best models are those with the lowest if values), these results indicate that the greatest predictive power was obtained by the stochastic, nonseasonal C A when predicting the percent cover of Mazzaella 22 months after the initial sampling date (U =0.159). This model also had the highest model efficiency of all the C A models (EF = 0.92) (Fig. 2.31 B). The best predictor of Mazzaella percent cover 24 months after the initial sampling date was the deterministic, nonseasonal C A (if = 0.356). In terms of predicting Fucus density 24 months after the initial sampling date, the best model was the stochastic, seasonal C A (if = 0.595), one of only two C A models which were found to be statistically unbiased in its predictions of Fucus density for that sampling date (Table 2.12). The best predictor of Fucus density 22 months after the initial sampling date was the nonseasonal ZND C A (if = 0.668), which also had the highest model efficiency for predicting Fucus densities for that sampling date (EF = -0.13) (Fig. 2.35 B). When considering all of the C A models together, if values were lowest when predicting percent covers of Mazzaella for the 22 month sampling date, followed by predictions of Mazzaella percent cover for the 24 month sampling date, predictions of Fucus density for the 24 month sampling date, and finally, predictions of Fucus density for the 22 month sampling date. DISCUSSION It was found that the predictive abilities of the models depended greatly on whether the model results were compared with field data from the last sampling date (24 months after the initial sampling) or from the sampling date just prior to the last sampling date (22 months after the initial sampling). In general, for all the C A models, predictions of Mazzaella percent cover were much better when compared with the 22 month samples, than when compared with the 24 month samples: A similar, though not nearly as 33 dramatic, difference in predictive ability was also found for the C A models when predicting Fucus densities. An examination of the parameterization data set revealed that there was a marked difference in the percent covers of Mazzaella and densities of Fucus in the final sampling date. There are many possible explanations to account for the poorer predictive abilities of the C A models for the 24 month sampling date percent covers of Mazzaella and densities of Fucus. First, it may be that climatic conditions at the field site caused the percent cover of Mazzaella to change in a way impossible for the C A models to predict, since the models only take into account abundances of Mazzaella and Fucus and the interactions between the two species. Any factors extrinsic to these would be unpredictable by the models. The experiences of other researchers in the Pacific Northwest tends to support this possibility, since many noticed unusual changes in similar intertidal systems during the same time period, perhaps due to an el Nino event (DeWreede, pers. comm.). In addition, it has been well documented that during the summer months, Mazzaella blades growing in the upper limit of its habitat suffer from bleaching, which leads to loss of tissue by the end of the summer (Scrosati and Kim, pers. comm.). Anything which would enhance this process, such as an unusually hot day with little cloud cover during a low tide, could cause an unseasonably large decline in the Mazzaella population. Such a decline would be impossible to predict simply by observing percent covers of Mazzaella and densities of Fucus, thus resulting in poor predictions by the models. Another possible reason for the difference in predictive ability between the 24 and 22 month samples could be that other biotic factors, such as herbivory, caused the 34 unseasonable changes in Mazzaella percent cover during the fall of 1993, when the last sampling date occurred. It is known that snails of the genus Littorina feed preferentially on Mazzaella (Kim and DeWreede 1996). If these snails were more abundant than usual, they may have caused an unseasonable decline in the Mazzaella population; combinations of these abiotic and biotic factors could also have the same effect. Since none of these possible factors were explicitly included in the C A models, the models would be unable to predict the consequent changes in Mazzaella percent cover, thus leading to poorer predictive ability in the 24 month samples than in the 22 month samples. An important point about the usefulness and applicability of such models (and other models in general) for predicting population dynamics is that if the dynamics of the population of interest are sensitive to factors which have not been explicitly included in the models, then there will be times when the model predictions do not mimic closely the dynamics in the field. In general, it is difficult in ecological systems to determine all the factors to which a population is sensitive and to include those in predictive models. Indeed, doing so often leads to enormous, intractable models which make poor predictions (Brooks and Tobias 1996, Stockle 1992). Although such extrinsic factors are included implicitly in the C A models constructed here, since these effects do impact the densities of Fucus and percent cover of Mazzaella and thus are present in the parameterization data set, they are too abstractly represented in the models to provide good predictive power when the factors behave outside their normal or average ranges. Thus, a balance must often be struck between including enough factors in the model and 35 keeping the model simple enough to be usable. In general, the proper balance depends on both the system being modelled and the purpose of the model. Alternatively, if the parameterization data set was not representative of normal or average conditions in the field, the resultant model parameters could result in poor predictions under normal or average conditions. Without a long term data set spanning several years (which was unavailable for this community) it would not be possible to determine whether the models were parameterized with average or non-average data. When the C A model predictions were examined individually, it was found that a few of the models were good predictors of Mazzaella percent cover for the 22 month sampling date: the deterministic GA, both nonseasonal and seasonal, and the nonseasonal stochastic CA. No model was able to satisfactorily predict Fucus densities. This suggests that Mazzaella dynamics can be explained by the interaction between Mazzaella and Fucus alone. In fact, for the stochastic C A models, the dynamics were explicitly dependent only on Mazzaella individuals, since the conditional probability functions used to parameterize these models only considered the different neighbourhood configurations of Mazzaella. This was due to the fact that, although Fucus individuals did affect both Mazzaella and Fucus, the effect of the different neighbourhood configurations of Fucus were overpowered, in general, by the effects of the different neighbourhood configurations of Mazzaella. Thus, it may be that Mazzaella population dynamics are even simpler than suggested by the two-species C A models and may be explicitly dependent only on Mazzaella 1 individuals. This suggests that, even though Mazzaella is highly connected to other species in the community, and was found to interact directly with Fucus, Pelvetiopsis, and littorine snails (Kim 1995), its population dynamics may be predominantly governed by one or two simple interactions. Fucus, on the other hand was very poorly predicted by the models. This suggests either that interactions between Fucus and Mazzaella have little or nothing to do with Fucus dynamics, or that additional species and interactions, such as with Pelvetiopsis and/or invertebrates, are needed to predict the dynamics. It is unlikely that Mazzaella does not play a role in Fucus dynamics, since parameterizing the C A models revealed exactly the opposite: that Mazzaella plays an important role in Fucus dynamics, often even more important that Fucus itself. Thus, it seems most likely that Fucus dynamics can only be predicted by a more complex model, one that incorporates additional interactions with other species in the community and/or additional abiotic factors. As a group, the zero neighbour distance (ZND) C A models predicted both Mazzaella and Fucus very poorly. Since this class of model was constructed1 to serve as a kind of control (namely a C A model lacking local interactions), its poor predictive ability, although not a definitive test, would suggest that local interactions are indeed important between Mazzaella and Fucus. Although many of the C A model predictions were quite poor, especially for Fucus, all of the. models made predictions that were better than assuming no change in the populations of Mazzaella and Fucus. Since the comparisons of the model predictions to a zero change prediction were performed across space rather than across time, these results suggest that population densities and percent covers of Fucus and Mazzaella change enough over space that even poor predictions of a population change are better than predicting no change at all. When the C A models were compared with one another, it was found that the best predictor of Mazzaella percent cover for the 22 month sampling date was the stochastic, nonseasonal CA. For the 24 month sampling date, the deterministic, nonseasonal C A was the best predictor of Mazzaella dynamics. Given that Mazzaella tends to have seasonal variations in abundance (Kim 1995, Kim and Scrosati, pers. comm.) this result seems somewhat surprising. Although seasonal effects are observed in the field, their incorporation into the models resulted in a decline in predictive ability, rather than an increase. The reason for this may be that the way in which seasonal effects were incorporated into the models were too great a simplification of the field data to allow for good predictions, and the deterministic seasonal rules used were indeed a very abstract representation of the effects of season on Fucus and Mazzaella. Another possibility is that this is another case where the model required to simulate the system of interest is simpler than field results would initially suggest. If Mazzaella dynamics can be accurately predicted by a model without incorporating all of the interactions that it has with other species (as was the case with both of these models), then it does not seem unreasonable that some abiotic factors, such as seasonality, can also be safely ignored. None of the C A models was adequate for predicting Fucus dynamics, either due to extremely poor modelling efficiencies, statistically significant predictive bias, or both. The fact that the best C A models for predicting Mazzaella dynamics were poor at predicting Fucus is not that unusual. It is the exception, rather than the rule, that a given model is good at predicting everything that the modeller sets out to model (Law and Kelton 1991). In general, the approach taken to construct and parameterize the C A models, by using the DIPS algorithm on a subset of available field data, is a viable method for the construction of simulation-style cellular automata models in ecology. Since C A are generally only used as "what-if models, this study should serve to expand their usefulness to ecologists, as well as researchers in other sciences. To date, the only other C A used as a simulation tool was as a model for simulating the growth of NFLBr crystals (Richards et al. 1990). Although Ermentrout and Keshet (1993) stated that one of the advantages of C A models was their ability to quantitatively reproduce 'real-world' experiments, this advantage had remained largely unexploited until the present study. Attempting to reproduce experimental results (such as clearings in the field, or competition experiments) with a C A constructed either from field data (as was done here) or from an understanding of the system to be modelled, could be a very powerful approach in determining the importance of various mechanisms for producing observed patterns and behaviours in the system of interest. As an example from this study, the ability of the nonseasonal stochastic C A model, which only explicitly included Mazzaella and Fucus, to accurately predict the 22 month percent cover of Mazzaella under the effects of a Pelvetiopsis-remov&l treatment indicates that Pelvetiopsis is relatively unimportant in determining Mazzaella percent cover. This result is certainly not obvious from examining the interaction web of Kim's community (Fig. 1.2). Another advantage to such an approach is that it forces the modeller to cast the parameters of the model in a form that can actually be measured in the field or lab (unlike many Lotka-Volterra style models, as well as others). This serves to make the model much more concrete and aids greatly in the interpretation of model predictions, by reducing model vagueness and ambiguity. Thus, a simulation approach to the use of cellular automata models in ecology provides a number of additional benefits to both the modeller and experimentalist, over the conventional "what-if' C A approach. 40 Table 2.1. The different cellular automata models constructed. Model Types Deterministic, nonseasonal Deterministic, seasonal Stochastic, nonseasonal Stochastic, seasonal Zero-Neighbour Distance, nonseasonal Zero-Neighbour Distance, seasonal Table 2.2. Deterministic, nonseasonal C A model state transition rules for Mazzaella increase and mortality and Fucus recruitment and mortality, based on the number of Mazzaella and Fucus neighbours, p is the probability of the given state transition. Species State Transition Rule Increase / Recruitment State Transition Rule Mortality Mazzaella Fucus •P = 1.0 i f no. Fucus neigh.< 4 A N D no. Mazzaella neigh. > 5 0:0 otherwise 1.0 i f no. Mazzaella neigh. > 4 0.0 otherwise P = S 1.0 i f no. Fucus neigh. > 3 O R no. Mazzaella neigh. < 2 0.0 otherwise 1.0 i f no. Mazzaella neigh. < 3 0.0 otherwise 41 Table 2.3. Deterministic, seasonal C A model state transition rules for Mazzaella increase and mortality, based on the number of Mazzaella and Fucus neighbours, p is the probability of the given state transition. Season State Transition Rule Increase State Transition Rule Mortality Spring Summer Fall Winter P = j 1.0 i f no. Fucus neigh. < 4 A N D no. Mazzaella neigh. > 5 0.0 otherwise p = 0.0 1.0 i f no. Fucus neigh. < 4 A N D no. Mazzaella neigh. > 5 0.0 otherwise 1.0 i f no. Fucus neigh. < 4 A N D no. Mazzaella neigh. > 5 0.0 otherwise P = p = 0.0 1.0 i f no. Fucus neigh. ^ 3 O R no. Mazzaella neigh- ^ 2 0.0 otherwise p = 0.0 p = 0.0 An increase occurs when an empty cell at time t becomes occupied by Mazzaella at time 7+1. Table 2.4. Deterministic, seasonal C A model state transition rules for Fucus recruitment and mortality, based on the number of Mazzaella and Fucus neighbours. p is the probability of the given state transition. Season State Transition Rule Recruitment State Transition Rule Mortality Spring Summer Fall Winter P = 1.0 i f no. Mazzaella neigh. > 4 0.0 otherwise 1.0 i f no. Mazzaella neigh. > 4 0.0 otherwise 1.0 i f no. Mazzaella neigh. > 4 0.0 otherwise 1.0 i f no. Mazzaella neigh. > 4 0.0 otherwise 1.0 i f no. Mazzaella neigh. < 3 0.0 otherwise 1.0 i f no. Mazzaella neigh. < 3 0.0 otherwise /? = CO-LO i f no. Mazzaella neigh. < 3 0.0 otherwise 42 Table 2.5. The season of the interval between each pair of field sampling dates (season of transition) used for parameterizing the seasonal C A models. Sample Pair Sampling Dates Season of Transition 1 Aug 10, Oct 23 Fall 2 Oct 23, Nov 23 Fall 3 Nov 23, Feb 15 Winter 4 Feb 15, Apr 16 Spring 5 Apr 16, Jun 1 Spring , 6 Jun 1, Jul 30 Summer 7 Jul 30, Oct 24 Summer 8 Oct 24, Dec 10 Fall 9 Dec 10, Feb 5 Winter 10 Feb 5, Apr 23 Spring 11 Apr 23, Jun 3 Spring 12 Jun 3, Oct 15 Summer Table 2.6. Stochastic, nonseasonal C A model state transition rules (conditional probability functions) for Mazzaella increase and mortality and Fucus recruitment and mortality, based on the number of Mazzaella and Fucus neighbours, p is the probability of the given state transition. Species State Transition Rule Increase / Recruitment State Transition Rule Mortality Mazzaella p = 0.004 + 0.091 (# Mazzaella neigh.) p = 0.37 - 0.073 (# Mazzaella neigh.) Fucus p = 0.049 + 0.00027e <•»M"™°u°™sh> p = 0.43 - 0.033 (# Mazzaella neigh.) 43 Table 2.7. Stochastic, seasonal C A model state transition rules (conditional probability functions) for Mazzaella increase and mortality, based on the number of Mazzaella and Fucus neighbours, p is the probability of the given state transition. Season State Transition Rule Increase State Transition Rule Mortality Spring p = 0.004 + 0.091 (# Mazzaella neigh.) p = 0.0 Summer p = 0.0 p = 0.37 - 0.073 (# Mazzaella neigh.) Fall Winter p = 0.004 + 0.091 (# Mazzaella neigh.) p = 0.004 + 0.091 (# Mazzaella neigh.) p = 0.0 p = 0.0 Table 2.8. Stochastic, seasonal C A model state transition rules (conditional probability functions) for Fucus recruitment and mortality, based on the number of Mazzaella and, Fucus neighbours, p is the probability of the given state transition. Season State Transition Rule Recruitment State Transition Rule Mortality Spring p = 0.049 + 0.00027e WM™°°«°"°<&h) p = 0.43 - 0.033 (# Mazzaella neigh.) Summer p = 0.049 + 0.00027e p = 0.43 - 0.033 (# Mazzaella neigh.) Fall p = 0.049 + 0.00027e <•« p = 0.0 Winter p = 0.049 + 0.00027e p = 0.43 - 0.033 (# Mazzaella neigh.) 44 Table 2.9. Zero Neighbour Distance, nonseasonal C A model state transition probabilities for Mazzaella increase and mortality and Fucus recruitment and mortality. State Transition Probability State Transition Probability Species Increase / Recruitment Mortality Mazzaella 0.185 0.171 Fucus 0.0194 0.250 Table 2.10. Zero Neighbour Distance, seasonal C A model state transition probabilities fox Mazzaella increase and mortality. State Transition Probability State Transition Probability Season Increase Mortality Spring 0.212 0.0619 Summer 0.0536 0.226 Fall 0.175 0.0980 Winter 0.312 0.0817 45 Table 2.11. Zero Neighbour Distance, seasonal C A model state transition probabilities for Fucus recruitment and mortality. State Transition Probability State Transition Probability Season Recruitment Mortality Spring 0.0173 0.247 Summer 0.0182 0.324 Fall 0.0234 0.154 Winter 0.0182 0.255 46 Table 2.12. Model predictive bias (calculated using the statistic) for all C A models. (Final refers to model predictions for the sampling date 24 months after the initial sample, and Previous refers to model predictions for the sampling date 22 months after the initial sample). Mazzaella Fucus Model Final Previous Final Previous Deterministic, nonseasonal 1.01 -0.742 -3.44* -1.57 Deterministic, seasonal 1.06 -0.660 -3.23* -1.38 Stochastic, nonseasonal 1.78 -0.145 0.335 2.60* Stochastic, seasonal * 2.68 1.45 -0.253 2.13* ZND, nonseasonal * 2.09 0.569 -2.40* -0.211 ZND, seasonal 1.28 1.26 * -2.85 -0.384 * statistically significant predictive bias present, a = 0.05. Table 2.13. Comparison of C A model predictions to a naive zero-change prediction (calculated using Theil's inequality coefficient, if) for all C A models. (Final refers to model predictions for the sampling date 24 months after the initial sample, and Previous refers to model predictions for the sampling date 22 months after the initial sample). Mazzaella Fucus Model Final Previous Final Previous Deterministic, nonseasonal 0.356 0.217 0.631 0.840 Deterministic,' seasonal 0.367 0.208 0.598 0.837 Stochastic, nonseasonal 0.505 0.159 0.622 0.794 Stochastic, seasonal 0.694 0.318 0.595 0.734 ZND, nonseasonal 0.604 0.351 0.699 0.668 ZND, seasonal 0.506 0.394 0.711 0.671 n e i g h b o u r h o o d r a d i u s , r = 0 ; r e p e a t r = r + 1 ; c u r r e n t s a m p l e , t = 0 ; s e t t h e e l e m e n t s o f t h e S t a t e T r a n s i t i o n M a t r i x ( f o r . t r a n s i t i o n z ) , T i j / Z = 0 , f o r e v e r y i , f o r e v e r y j , f o r e v e r y z ; s e t t h e e l e m e n t s o f t h e T r a n s i t i o n P r o b a b i l i t y M a t r i x ( f o r t r a n s i t i o n z ) , P j . j , z = 0 , f o r e v e r y i , f o r e v e r y j , f o r e v e r y z ; r e p e a t t = t + 1 ; x = f i r s t c e l l o f l a t t i c e s e t t h e e l e m e n t s o f t h e N e i g h b o u r h o o d C o n f i g u r a t i o n M a t r i x , N i j = 0 , f o r e v e r y i , f o r e v e r y j ; r e p e a t g e t n e i g h b o u r h o o d ( o f r a d i u s r ) o f c e l l x g e t s t a t e o f c e l l x a t n e x t t i m e s t e p ( x ' ) i , j = c u r r e n t n e i g h b o u r h o o d c o n f i g u r a t i o n z = s t a t e t r a n s i t i o n f r o m x t o x ' N i j = N i j + 1 ; T i j , z ~ 1 " i j / Z + l ; x = n e x t c e l l u n t i l x = l a s t c e l l o f l a t t i c e c a l c u l a t e t h e t r a n s i t i o n p r o b a b i l i t y m a t r i x : f o r e v e r y i , f o r e v e r y j , f o r e v e r y z P i j , z = T i j , z / B I J ; u n t i l ( t h e t r a n s i t i o n p r o b a b i l i t i e s c o n v e r g e o r t >= n - 1 ) u n t i l ( t h e t r a n s i t i o n p r o b a b i l i t i e s c o n v e r g e o r r >= n 1 / d ) Figure 2.1. The DIPS (Direct Identification of Probabilistic Synchronous Cellular Automata) algorithm (adapted from Adamatzky 1994). 0.03 0.02 -0.01 --0.00 -i 1 —I J—; 1 1 1 1 1 1 L -SPRING SUMMER FALL WINTER SEASON Figure 2.2. Seasonal recruitment probabilities for Fucus gardneri 49 0.40 SPRING SUMMER FALL SEASON WINTER Figure 2.3. Seasonal mortality probabilities for Fucus gardneri. 0.40 0.30 -_ j CO < 0.20 m O or D_ 0.10 -0.00 4 J 1 1 1 1 — ; — I — — L 1 1 1 - 1 -S P R I N G S U M M E R F A L L W I N T E R S E A S O N Figure 2.4. Seasonal increase probabilities for Mazzaella cornucopiae. 0.40 -i 0.30 4-_j CD < 0.20 --DO O or o_ 0.10 4-0.00 4 — J 1 1 1 1 1 h 1 _L_ ' SPRING SUMMER FALL WINTER SEASON Figure 2.5. Seasonal mortality probabilities for Mazzaella cornucopiae. 52 1.0 i 0.9 --0 1 2 3 4 5 6 7 8 NO. MAZZAELLA NEIGHBOURS Figure 2.6. Transition Probability Vector 0M , Em P t y - »Mazzae i ia , the probability of Mazzaella increase for the different neighbourhood configurations of Mazzaella. The bars represent the raw output from DIPS and the line represents the regression equation for the DIPS output. The equation of the regression line is probability = 0.0042 + 0.091 (# Mazzaella neighbours), r 2 = 0.98. 0.20 0.18 0.16 + 0.14 £ 0.12 -_ i CO < 0.10 CO O £ 0.08 + 0.06 + 0.04 0.02 0.00 I DIPS output •regression 1 2 NO. FUCUS NEIGHBOURS Figure 2.7. Transition Probability Vector 0F ,Em P ty->Mazzaei ia , the probability of Mazzaella increase for the different neighbourhood configurations of Fucus. The bars represent the raw output from DIPS and the line represents the regression equation for the DIPS output. The equation of the regression line is probability = 0.098 - 0.0030(# Fucus neighbours), r 2 = 0.16. 54 0.8 0.7 0.6 0.5 GO < 0.4 GO O or Q- 0.3 0.2 0.1 0.0 II DIPS output - regression + + + + 2 3 4 5 6 7 NO. MAZZAELLA NEIGHBOURS Figure 2.8. Transition Probability Vector 0M,Mazzaeiia->EmPty, the probability of Mazzaella mortality for the different neighbourhood configurations of Mazzaella. The bars represent the raw output from DIPS and the line represents the regression equation for the DIPS output. The equation of the regression line is probability = 0.61 - 0.073(#Mazzaella neighbours), r 2 = 0.99. 55 0.50 0.45 0.40 0.35 £ 0.30 CO < 0.25 m O £ 0.20 + 0.15 0.10 o;o5 0.00 • DIPS output - regression 1 NO. FUCUS NEIGHBOURS Figure 2.9. Transition Probability Vector 0 F , M a z z a e i i a - » E m P t y , the probability of Mazzaella mortality for the different neighbourhood configurations of Fucus. The bars represent the raw output from DIPS and the line represents the regression equation for the DIPS output. The equation of the regression line is probability = 0.12 + 0.0063(# Fucus neighbours), r 2 - 0.62. 56 1.0 0.9 0.8 0.7 hj 0.6 00 < 0.5 m O of 0.4 o_ 0.3 0.2 0.1 0.0 L Z Z I D I P S output regress ion n , n + 2 3 4 5 6 NO. MAZZAELLA N E I G H B O U R S 8 Figure 2.10. Transition Probability Vector 0 M , E m P « y ^ F u c u s , the probability of Fucus recruitment for the different neighbourhood configurations of Mazzaella. The bars represent the raw output from DIPS and the line represents the regression equation for the DIPS output. The equation of the regression line is probability = 0.049 + 0.00027e ^ Ma™ella "®**™\ f = 0 9 7 0.10 0.09 : -0.01 --0.00 4 1 1 1 1 1 1 1 1 h-—1 1 1 0 1 2 3 NO. FUCUS N E I G H B O U R S Figure 2.11. Transition Probability Vector 0F,Em Pty-*Fucu S , the probability of Fucus recruitment for the different neighbourhood configurations of Fucus. The bars represent the raw output from DIPS and the line represents the regression equation for the DIPS output. The equation of the regression line probability = 0.012 + 0 . 0 0 3 6 e ( # / w ™shb°™\ r 2 = 0.88. 58 0.50 0.45 0.40 0.35 £ 0.30 -J m < 0.25 m O £ 0.20 0.15 0.10 0.05 0.00 rz=l DIPS output regression + + 2 3 4 5 6 7 NO. MAZZAELLA NEIGHBOURS Figure 2.12. Transition Probability Vector 0M,FUCUS->Empty, the probability of Fucus mortality for the different neighbourhood configurations of Mazzaella. The bars represent the raw output from DIPS and the line represents the regression equation for the DIPS output. The equation of the regression line is probability = 0.33 - 0.033(#Mazzaella neighbours), r 2 = 0.68. 59 0.40 0 .35 0 . 3 0 0 .25 0Q < 0 .20 CO O rr. Q- 0 . 1 5 4-0 . 1 0 0 .05 0 .00 • .DIPS output regression + + 1 2 3 NO. FUCUS NEIGHBOURS Figure 2.13. Transition Probability Vector 0F,Fucu S-*Em Pty , the probability of Fucus mortality for the different neighbourhood configurations of Fucus. The bars represent the raw output from DIPS and the line represents the regression equation for the DIPS output. The equation of the regression line is probability = 0.20 + 0.0025(# Fucus neighbours), r 2 = 0.008. 60 100 cn c LU co O 1 o i I— z Z (1) UJ «i O 0 3 UJ £ °- § £ C-2 • F i e l d D a t a • De te rmin i s t i c , n o n s e a s o n a l • De te rmin i s t i c , s e a s o n a l I S t o c h a s t i c , n o n s e a s o n a l HD S t o c h a s t i c , s e a s o n a l I Z e r o N e i g h b o u r D i s t a n c e , n o n s e a s o n a l I Z e r o N e i g h b o u r D i s t a n c e , s e a s o n a l - I — C-3 TEST QUADRAT NUMBER C-4 Figure 2.14. Percent cover of Mazzaella predicted by the six different C A models and the field data from the final sampling dates of the three control test quadrats, C-2 to C-4. The x denotes no field data available for the final sampling date for that quadrat. 61 20 | > 1 5 or E LU </) O -S o | LU C O or w UJ £ °- g E CM O • Field Data FJ Deterministic, nonseasonal • Deterministic, seasonal H Stochastic, nonseasonal 1 1 Stochastic, seasonal El Zero Neighbour Distance, nonseasonal • Zero Neighbour Distance, seasonal I-2 I-3 I-4 TEST QUADRAT NUMBER Figure 2.15. Percent cover of Mazzaella predicted by the six different C A models and the field data from the final sampling dates of the three Mazzaella -removal test quadrats, 1-2 to 1-4. 62 100 90 80 70 60 • Field Data • Deterministic, nonseasonal • Deterministic, seasonal H Stochastic, nonseasonal OH Stochastic, seasonal HZero Neighbour Distance, nonseasonal • Zero Neighbour Distance, seasonal F-2 F-3 F-4 TEST QUADRAT NUMBER Figure 2.16. Percent cover oi Mazzaella predicted by the six different C A models and the field data from the final sampling dates of the three Fucus -removal test quadrats, F-2 to F-4. 63 100 90 80 • Field Data FJ Deterministic, nonseasonal • Deterministic, seasonal B Stochastic, nonseasonal • Stochastic, seasonal I Zero Neighbour Distance, nonseasonal • Zero Neighbour Distance, seasonal P-2 P-3 P-4 TEST QUADRAT NUMBER Figure 2.17. Percent cover of Mazzaella predicted by the six different C A models and the field data from the final sampling dates of the three Pelvetiopsis removal test quadrats, P-2 to P-4. 64 100 O ) c E ro CO or U J o 5 o i UJ t : O « o r r < « UJ £ °" § E CM CM C-2 C-3 TEST QUADRAT NUMBER C-4 Figure 2.18. Percent cover of Mazzaella predicted by the six different C A models and the field data from sampling dates just prior to the final sampling dates of the three control test quadrats, C-2 to C-4. 65 20 g> 15 t - 10 1 • Field Data S Deterministic, nonseasonal • Deterministic, seasonal S Stochastic, nonseasonal DI Stochastic, seasonal SZero Neighbour Distance, nonseasonal BZero Neighbour Distance, seasonal 1-2 1-3 1-4 TEST QUADRAT NUMBER Figure 2.19. Percent cover of Mazzaella predicted by the six different C A models and the field data from sampling dates just prior to the final sampling dates of the three Mazzaella -removal test quadrats, 1-2 to 1-4. 66 100 90 80 70 • Field Data El Deterministic, nonseasonal • Deterministic, seasonal B Stochastic, nonseasonal ED Stochastic, seasonal • Zero Neighbour Distance, nonseasonal 13 Zero Neighbour Distance, seasonal F-2 F-3 F-4 TEST QUADRAT NUMBER Figure 2.20. Percent cover of Mazzaella predicted by the six different C A models and the field data from sampling dates just prior to the final sampling dates of the three Fucus -removal test quadrats, F-2 to F-4. 67 100 90 80 •E 70 60 • Field Data S Deterministic, nonseasonal • Deterministic, seasonal B Stochastic, nonseasonal ED Stochastic, seasonal SZero Neighbour Distance, nonseasonal EJZero Neighbour Distance, seasonal P-2 P-3 P-4 TEST QUADRAT NUMBER Figure 2.21. Percent cover of Mazzaella predicted by the six different C A models and the field data from sampling dates just prior to the final sampling dates of the three Pelvetiopsis -removal test quadrats, P-2 to P-4. 68 CO c Q_ E ro CO 50 45 40 35 « 30 CO z 111 Q 0 ro CO -C c o E -^CN • Field Data • Deterministic, nonseasonal • Deterministic, seasonal H Stochastic, nonseasonal M Stochastic, seasonal 0Zero Neighbour Distance, nonseasonal E2Zero Neighbour Distance, seasonal C-2 C-3 TEST QUADRAT NUMBER C-4 Figure 2.22. Density of Fucus predicted by the six different C A models and the field data from the final sampling dates of the three control test quadrats, C-2 to C-4. The x denotes no field data available for the final sampling date for that quadrat. 69 CD c E ro 50 45 40 35 • Field Data S Deterministic, nonseasonal • Deterministic, seasonal EH Stochastic, nonseasonal mi Stochastic, seasonal E Zero Neighbour Distance, nonseasonal EZero Neighbour Distance, seasonal 1-2 1-3 1-4 TEST QUADRAT NUMBER Figure 2.23. Density of Fucus predicted by the six different C A models and the field data from the final sampling dates of the three Mazzaella- removal test quadrats, 1-2 to 1-4. 70 cn c E ro W >-w z LU i £ Q CD CO C O E CM 80 70 60 50 40 • Field Data S Deterministic, nonseasonal • Deterministic, seasonal D Stochastic, nonseasonal n Stochastic, seasonal EiZero Neighbour Distance, nonseasonal • Zero Neighbour Distance, seasonal F-2 F-3 F-4 TEST QUADRAT NUMBER Figure 2.24. Density of Fucus predicted by the six different C A models and the field data from the final sampling dates of the three Fucus -removal test quadrats, F-2 to F-4. 71 P-2 P-3 P-4 TEST QUADRAT NUMBER Figure 2.25. Density of Fucus predicted by the six different C A models and the field data from the final sampling dates of the three Pelvetiopsis- removal test quadrats, P-2 to P-4. 72 UJ iT Q CO c o E CN CN 80 70 |> 60 8 50 CO • Field Data • Deterministic, nonseasonal • Deterministic, seasonal H Stochastic, nonseasonal ED Stochastic, seasonal I Zero Neighbour Distance, nonseasonal • Zero Neighbour Distance, seasonal C-2 C-3 T E S T Q U A D R A T N U M B E R C-4 1 Figure 2.26. Density of Fucus predicted by the six different C A models and the field data from sampling dates just prior to the final sampling dates of the three control test quadrats, C-2 to C-4. 73 50 45 -40 35 --• Field Data S Deterministic, nonseasonal • Deterministic, seasonal H Stochastic, nonseasonal ED Stochastic, seasonal 0 Zero Neighbour Distance, nonseasonal • Zero Neighbour Distance, seasonal 1-2 1-3 TEST QUADRAT NUMBER Figure 2.27. Density of Fucus predicted by the six different C A models and the field data from sampling dates just prior to the final sampling dates of the three Mazzaella- removal test quadrats, 1-2 to 1-4. 74 80 70 60 50 40 £ 30 c o E a 20 10 • Field Data S Deterministic, nonseasonal • Deterministic, seasonal H Stochastic, nonseasonal E] Stochastic, seasonal SZero Neighbour Distance, nonseasonal 0Zero Neighbour Distance, seasonal I i F-2 F-3 F-4 TEST QUADRAT NUMBER Figure 2.28. Density of Fucus predicted by the six different C A models and the field data from samples just prior to the final sampling dates of the three Fucus-removal test quadrats, F-2 to F-4. 75 • Field Data • Deterministic, nonseasonal • Deterministic, seasonal SB Stochastic, nonseasonal > HU Stochastic, seasonal 13 Zero Neighbour Distance, nonseasonal • Zero Neighbour Distance, seasonal P-2 P-3 TEST QUADRAT NUMBER P-4 Figure 2.29. Density of Fucus predicted by the six different C A models and the field data from sampling dates just prior to the final sampling dates of the three Pelvetiopsis- removal test quadrats, P-2 to P-4. 76 SIMULATED PERCENT COVER 0 25 50 75 . 100 SIMULATED PERCENT COVER Figure 2.30. Observed vs. Predicted plot of Mazzaella percent cover for the deterministic C A models. EF = modelling efficiency. A. Deterministic, nonseasonal CA, 24 months after initial sampling, EF = 0.69. B. Deterministic, nonseasonal CA, 22 months after initial sampling, EF = 0.86. C. Deterministic, seasonal CA, 24 months after initial sampling, EF = 0.67'. D. Deterministic, seasonal CA, 22 months after initial sampling, EF = 0.87. SIMULATED PERCENT COVER 0 25 50 75 100 SIMULATED PERCENT COVER SIMULATED PERCENT COVER SIMULATED PERCENT COVER Figure 2.31. Observed vs. Predicted plot of Mazzaella percent cover for the stochastic C A models. EF = modelling efficiency. A. Stochastic, nonseasonal CA, 24 months after initial sampling, EF = 0.37. B. Stochastic, nonseasonal CA, 22 months after initial sampling, EF = 0.92. C. Stochastic, seasonal CA, 24 months after initial sampling, EF = - 0.19. D. Stochastic, seasonal CA, 22 months after initial sampling, EF = 0.70. Figure 2.32. Observed vs. Predicted plot ofMazzaella percent cover for the zero neighbour distance (ZND) C A models. EF = modelling efficiency. A. ZND, nonseasonal CA, 24 months after initial sampling, EF = 0.10. B. ZND, nonseasonal CA, 22 months after initial sampling, EF = 0.63. C. ZND, seasonal CA, 24 months after initial sampling, EF = 0.37. D. ZND, seasonal CA, 22 months after initial sampling, EF = 0.53. 79 Figure 2.33. Observed vs. Predicted plot of Fucus density for the deterministic C A models. EF = modelling efficiency. A. Deterministic, nonseasonal CA, 24 months after initial sampling, EF = - 0.94~ B. Deterministic, nonseasonal CA, 22 months after initial sampling, EF = - 0.79. C. Deterministic, seasonal CA, 24 months after initial sampling, EF = - 0.74. D. Deterministic, seasonal CA, 22 months after initial sampling, EF = - 0.77. 80 Figure 2.34. Observed vs. Predicted plot of Fucus density for the stochastic C A models. EF - modelling efficiency. . A. Stochastic, nonseasonal CA, 24 months after initial sampling, EF = - 0.88. B. Stochastic, nonseasonal CA, 22 months after initial sampling, EF = - 0.59. C. Stochastic, seasonal CA, 24-months after initial sampling, EF = - 0.72. D. Stochastic, seasonal CA, 22 months after initial sampling, EF = - 0.36. 81 Figure 2.35. Observed vs. Predicted plot of Fucus density for the zero neighbour distance (ZND) C A models. EF = modelling efficiency. A. ZND, nonseasonal CA, 24 months after initial sampling, EF = - 1.38. B. ZND, nonseasonal CA, 22 months after initial sampling, EF = - 0.13. C. ZND, seasonal CA, 24 months after initial sampling, EF = - 1.46. D. ZND, seasonal CA, 22 months after initial sampling, EF = - G. 14. 82 C H A P T E R 3 B I R T H - D E A T H M O D E L I N T R O D U C T I O N Difference equation models have been used in ecology for decades as models of single and multi-species population dynamics. A classic example is the Nicholson-Bailey model used to describe host-parasitoid dynamics (Hassell and May 1989). Part of the reason for their early and widespread use in ecology is that such models are very simple, both to construct and analyze. Despite their simplicity, such models can give rise to extremely complex dynamics, including chaos (May 1974, 1976). Difference equation models are simply the mathematical formulation of what Begon et al. (1990) called "the fundamental and unalterable ecological fact of life": the size of a population at the present moment is determined by the population size at some previous instant in time with the addition of all individuals born into the population between the previous time and now, minus the number of deaths, minus the number of emigrants, plus the number of immigrants. Difference equation models are discrete in terms of time and do not explicitly incorporate any spatial information of the system being modeled. In other words, such models assume that all members of a population respond instantly to changes in population size or other model parameters, and thus no local interactions are possible. 83 The purpose of this study was to construct two simple difference equation models, hereafter referred to as birth-death (BD) models, one to predict the population dynamics of Mazzaella cornucopiae, the other to predict the dynamics of Fucus gardneri, the two dominant macrophytes in Kim's community (Kim 1995). The intention was to use these BD models as a non-spatial alternative to the C A models discussed in chapter 2, thus providing a kind of control for the importance of local spatial interactions in Kim's community. METHODS Two birth-death (BD) models were created, one for Mazzaella and the other for Fucus. Their equations are shown below: Mt+1 =Mt + pMMt-8MMt (1) Ft+1=Ft + pFFt-SFFt (2) where Mt+i andFt+! are the percent cover of Mazzaella and density of Fucus at time t+1, Mt and Ft are the percent cover of Mazzaella and density of Fucus at time t, fiM and @F are the probabilities of recruitment for Mazzaella2 and Fucus, respectively and 5M and SF are the probabilities of mortality for Mazzaella and Fucus, respectively. 2 In general, it is not known for the clonal species Mazzaella whether a collection of fronds is made up of more than one genetically distinct individual, or whether a patch is formed from vegetative growth from a large holdfast (Scrosati, pers comm.). Thus, all references in this thesis to Mazzaella recruitment should be taken to mean that the plant was found in a cell which was previously unoccupied. It was not possible, given the available data, to determine whether this 'new' Mazzaella was the result of actual recruitment or vegetative growth. 84 The parameters (3M ,PF,8M and <SF were estimated from Kim's (1995) 16 permanent quadrats of field data, sampled bimonthly over a two-year period. As with the C A models described in Chapter 2, data from the 16 permanent quadrats were split into two groups: 1) a parameterization data set and 2) a model testing data set. The parameterization data set consisted of four of the 16 quadrats, three of which represented different treatments performed by Kim (1995) and a control quadrat. The three treatment quadrats from which parameterization data were obtained were Mazzaella removal, Fucus removal and Pelvetiopsis removal. The testing data set consisted of 12 quadrats, including three controls, three Mazzaella removal quadrats, three Fucus removal quadrats and three Pelvetiopsis removal quadrats. In order to estimate the probability of recruitment for a given species, the number of recruitment events between each pair of consecutive sampling dates in the four quadrats for that species were counted and summed to give the total number of recruitment events over the entire two-year data set. This was divided by the total number of possible recruitment events to give the probability of recruitment over a two-year period. The total number of possible recruitment events were estimated by the total number of empty sites in which recruitment was able to occur (i.e., by counting every empty cell for each sampling date for each quadrat, summed over the two-year period). The probability of mortality for the two species was determined similarly, by counting all the mortality events for a given species and dividing by the total number of possible mortality events. In this case, the total number of possible mortality events was simply the total number of the species in question in all of the samples of all of the quadrats. Table 3.1 shows the 85 estimated recruitment and mortality parameters for Mazzaella and Fucus. As with the C A models described in Chapter 2, because the parameters were calculated using data pooled over a two-year period, the time-step in the BD model (i.e., the interval from t to t+1) represented two years in the 'real world'. In order to generate predictions from the BD model, M, for equation (1) and F, for equation (2) were taken from the percent cover of Mazzaella and the density of Fucus present in the first sampling date of a given test quadrat. Equations (1) and (2) were then solved to determine model predictions for the percent cover of Mazzaella and the density of Fucus after a two-year period. This was done 12 times, once for each test quadrat. The 12 model percent covers oi Mazzaella and densities of Fucus were then compared to the actual field data taken from the 12 test quadrats. As with the C A models in Chapter 2, the B D model results were compared with both the last sampling date (which occurred 24 months after the initial sampling), and the sampling date just prior to the last one (which occurred 22 months after the initial sampling), for each test quadrat. Comparison of the BD model results to the field data from the test quadrats was performed in the same way as for the C A models in Chapter 2. Observed vs. predicted plots were made and model efficiencies were calculated (Mayer and Butler 1993) for both B D models (equations (1) and (2)). The two models were then tested for systematic errors in prediction by calculating model bias (Power 1993). Finally, Theil's inequality coefficient was calculated for both BD models to compare their predictions with a naive zero change prediction, and also to facilitate comparison of the B D models with the C A models. 86 R E S U L T S Figure 3.1 shows the BD model and field data percent cover 24 months after the first sampling date for each of the 12 test quadrats. For the control quadrats C-2 and C-3 and the Mazzaella removal quadrats 1-2,1-3 and 1-4, the model predictions were very close to what was actually observed in the field. For control quadrat C-4, no field data were available for this sampling date, so comparison was not possible. For the remaining test quadrats, the model overestimated the percent cover of Mazzaella (Fig. 3.1). The model predictions were much closer to what was actually observed in the field, when the B D model results were compared with field data taken 22 months after the initial sampling date (Fig. 3.2). Fucus density, on the other hand, was very poorly predicted by the BD model, both for the 24 month sampling date and the 22 month sampling date (Figs 3.3 and 3.4). On average, the BD model tended to underestimate Fucus density in both the 24 month and 22 month sampling dates. Model predictions were especially poor for the Pelvetiopsis removal quadrat, P-2, 24 months after initial sampling (Fig. 3.3) and the control quadrat, C-4, 22 months after initial sampling (Fig. 3.4). Validation of the B D models is shown graphically in Figures 3.5 to 3.8. The tendency for the Mazzaella BD model to overestimate test quadrat percent covers of Mazzaella, 24 months after initial sampling can be seen quite clearly in Figure 3.5, where the " majority of the points fall below the line of perfect fit. The model efficiency (EF) of this model is 0.46, further suggesting that the predictive ability of the Mazzaella B D model 24 months after initial sampling is quite poor. The predictive ability of the same model 87 22 months after initial sampling is markedly better, having an EF of 0.92. In the observed vs. predicted plot for this model, all of the points tend to cluster closely to the line of perfect fit (Fig. 3.6). Examination of the observed vs. predicted plots of the Fucus B D models indicates very clearly that this model was unable to predict densities of Fucus, both 22 and 24 months after the initial sampling date, since the scatter of points bears no relationship with the line of best fit (Figs. 3.7 and 3.8). The results from graphically comparing model predictions to the 12 test quadrats were reiterated in the results obtained from examining the predictive bias of each of the models (Table 3.2). No statistically significant predictive bias was present in the Mazzaella B D model (for both the 22 and 24 month sampling date). The Fucus BD model, on the other hand, was statistically significantly biased in its predictions, meaning that this model produced systematic errors in its predictions of Fucus densities for both the 22 and 24 month sampling date. This can be easily seen in the observed vs. predicted plots of the Fucus B D model, since nearly all of the points fall above the line of perfect fit, indicating that most of the model predictions underestimated the densities recorded in the field (Figs'. 3.7 and 3.8). Both the Mazzaella and Fucus BD models were found to predict better than a naive zero-change prediction (Table 3.3), although the Mazzaella model predicted much better than the Fucus model, since the if statistics for the Mazzaella BD model were much closer to zero than those for the Fucus BD model. 88 DISCUSSION Simple birth death models (BD) were constructed to describe the population dynamics of Mazzaella and Fucus. The predictions of the BD models were compared to an independent set of field data, both statistically and graphically, in order to determine how well they predicted the percent cover of Mazzaella and the density of Fucus after a two year period: The predictive abilities of the BD models closely paralleled those of the C A models: model predictions were better for the sampling date 22 months after the initial sampling compared to 24 months after the initial sampling. Because these models were simple one-species models, any extraneous factors in the system such as weather, temperature, or other stochastic events were only incorporated implicitly in the models through the field data used in parameterization. Consequently, the effects of sudden variation in such factors on the population dynamics of Mazzaella and Fucus could not be predicted by these models. Thus the discussion in Chapter 2 pertaining to the possible causes for the differences in predictive ability of the models for the 22 month and 24 month sampling dates also applies here. The fact that Fucus densities were very poorly predicted by the B D model supports the notion from chapter 2 that important interactions were lacking in this simple model, since incorporating only Fucus into the BD model was obviously not able to generate the observed dynamics. This was similar to the results observed for the C A models in Chapter 2. Because most of the model predictions of Fucus density underestimated the densities recorded in the field, it may be possible to improve the BD model predictions of 89 Fucus density by incorporating a 'correction factor' to increase Fucus densities in the model. Such 'correction factors' must be used with caution, however, since their inappropriate use results in models which are nothing more than curve-fitting devices (Law and Kelton 1991). Because there was no apparent biological basis for the use of a 'correction factor' in the BD model, none was employed. Similarly to the C A models, the percent cover of Mazzaella was predicted far more accurately than Fucus densities, irrespective of whether the 22 month or 24 month sampling dates were used. This supports the suggestion that Mazzaella dynamics can be predicted well using a simple model. In this case, the presence of Fucus was not explicitly encoded in the Mazzaella B D model, and yet the model predictions were quite good, especially for the 22 month sampling date. This suggests that even Fucus is not required in order to predict Mazzaella population dynamics. This result is surprising, given the number of interactions that Mazzaella has with other organisms in this community, and indicates that some ecological systems may not require enormously complex models in order for ecologists to be able to understand and predict them. Indeed, this was found to be the case with several different models by Brooks and Tobias (1996), including a model of radiation interception by plant canopies, models of freshwater ecosystems and timber harvesting models. In addition, since the BD models are not spatial (in the sense that they do not explicitly incorporate spatial information), the ability to predict the percent cover of Mazzaella suggests that local, spatial interactions are not important for this species, in contrast to the results from chapter 2. Thus, simple BD models can be useful for predicting the population dynamics of a single species, even when that species, such as Mazzaella, is enmeshed within a complex set of interactions with other members of the community. They are also useful as 'controls' for more complex models because they serve as a baseline of predictive ability from which to judge the power of more complex models. Table 3.1. Parameters for the two Birth-Death (BD) models, /? is the probability of recruitment and S is the probability of mortality. Mazzaella Fucus BD Model BD Model p 0.092 0.019 s 0.12 0.25 Table 3.2. Birth-Death model predictive bias, calculated using the W statistic, for 22 months after initial sampling and 24 months after initial sampling. 22 month sample 24 month sample Mazzaella BD Model -0.23 1.58 Fucus BD Model -4.39* -2.08* 1 * Statistically significant predictive bias present, a = 0.05. Table 3.3. Birth-Death model predictions as compared with a naive zero-change prediction, calculated using Theil's inequality coefficient (if), for 22 months after initial sampling and 24 months after initial sampling. A if = 0 indicates perfect predictions, if < 1 indicates model predictions are better than a naive zero-change prediction, if > 1 indicates the predictive power of the model is worse than a naive zero-change prediction. 22 month sample 24 month sample MazzaeilaBD Model 0.167* 0.467* Fucus BD Model 0.654* 0.813* Predictive ability of the model is better than a naive zero-change prediction. 92 Figure 3.1. Percent cover of Mazzaella predicted by the Mazzaella Birth-Death model and the field data from the final sampling dates of the. 12 test quadrats. The x denotes no field data available for the final sampling date for that quadrat. C-2 to C-4 are control quadrats, 1-2 to 1-4 are Mazzqella removal quadrats, F-2 to F-4 are Fucus removal quadrats and P-2 to P-4 are Pelvetiopsis removal quadrats. 93 100 90 3 .£ 80 Q . U J CO O 1 O E U J & o; co U J £ °- § CM CM 70 60 50 40 30 20 10 A 0 • Field Data • Model Prediction O O O PERMANENT QUADRAT NO. Figure 3.2. Percent cover of Mazzaella predicted by the Mazzaella Birth-Death model and the field data from sampling dates just prior to the final sampling dates of the 12 test quadrats. C-2 to C-4 are control quadrats, 1-2 to 1-4 are Mazzaella removal quadrats, F-2 to F-4 are Fucus removal quadrats and P-2 to P-4 are, Pelvetiopsis removal quadrats. 94 100 c o. E ca CO 90 80 70 • Field Data • Model Prediction ^ ( N ( O ^ — — — L i . L i . L L PERMANENT QUADRAT NO. Figure 3.3. Density of Fucus predicted by the Fucus Birth-Death model and the field data from the final sampling dates of the 12 test quadrats. The x denotes no field data available for the final sampling date for that quadrat. C-2 to C-4 are control quadrats, 1-2 to 1-4 art Mazzaella removal quadrats, F-2 to F-4 are Fucus removal quadrats and P-2 to P-4 are Pelvetiopsis removal quadrats. 95 100 -t 90 -Q O O ~ — — LL. L L U_ Q L Q L Q_ PERMANENT QUADRAT NO. Figure 3.4. Density of Fucus predicted by the Fucus Birth-Death model and the field data from sampling dates just prior to the final sampling dates of the 12 test quadrats. C-2 to C-4 are control quadrats, 1-2 to 1-4 are Mazzaella removal quadrats, F-2 to F-4 are Fucus removal quadrats and P-2 to P-4 are Pelvetiopsis removal quadrats. 96 SIMULATED PERCENT COVER Figure 3.5. Observed vs. predicted plot of Mazzaella percent cover, 24 months after initial sampling. The line indicates the position of the 'perfect fit' (i.e. if the model predicts perfectly, all the points will line up along the line). EF = 0.46 (EF = modelling efficiency). 97 SIMULATED PERCENT COVER Figure 3.6. Observed vs. predicted plot of Mazzaella percent cover, 22 months after initial sampling. The line indicates the position of the 'perfect fit' (i.e. if the model predicts perfectly, all the points will line up along the line). EF = 0.92 (EF = modelling efficiency). " SIMULATED DENSITY Figure 3.7. Observed vs. predicted plot of Fucus density, 24 months after initial sampling. The line indicates the position of the 'perfect fit' (i.e. i f the model predicts perfectly, all the points will line up along the line). EF = - 2.2 (EF = modelling efficiency). 99 SIMULATED DENSITY Figure 3.8. Observed vs. predicted plot of Fucus density, 22 months after initial sampling. The line indicates the position of the 'perfect fit' (i.e. if the model predicts perfectly, all the points will line up along the line). EF = - 0.085 (EF = modelling efficiency). 100 CHAPTER 4 GENERAL DISCUSSION In total, eight different models were constructed in order to predict the population dynamics of Mazzaella cornucopiae and Fucus gardneri in Kim's (1995) community. Six of the models were cellular automata (CA) models, and two were birth-death (BD) models. A rationale for constructing these different models of Kim's community was that it allowed for the different models to be thought of as different hypotheses which attempt to explain the dynamics of Mazzaella and Fucus observed in the field. The use of alternative, competing models allowed for the selection of the best models among many when subjected to appropriate tests. In this case, the predictions of the different models were tested against an independent set of field data. Choice of modelling formalism Whenever one attempts to construct a model of a system, there is always the choice of what particular type or class of model to employ. Often, such choices are made with less thought than they should be given, since the choice of modelling formalism largely determines the potential results from the model (Hogeweg 1988). In other words model choice will affect the ease or difficulty with which the system can be modeled. In this thesis, C A and BD models were used for a variety of reasons. Firstly, Kim's research indicated that the survivorship of Fucus individuals was dependent on the distance between the Fucus plant and the nearest patch of Mazzaella turf (Kim 1995). 101 This suggested that local spatial interactions were important in this system. The explicit spatial nature of C A lends itself very well to the simulation and description of local spatial interactions and thus C A were an obvious choice for modelling interactions between Mazzaella and Fucus in Kim's community. In addition, since the purpose of the models was simulation of population dynamics, rather than simply the resolution of 'what-if' questions, it was important that the resultant models mimic, as closely as possible, the experimental design used in the field work. C A models again seemed the natural choice because of their ability to explicitly and quantitatively reproduce the results of experimental manipulations (Ermentrout and Keshet 1993). In this case, the spatial maps produced by Kim (1995) during his field work provided an ideal data set for the construction of C A models. This close match between the model and the experimental investigations in the field was also important because it would allow for a much easier (and clearer) interpretation of the model results. All individual-based models (of which C A are a subset), and most computer simulations, are capable of producing enormous amounts of results and data. This can make the interpretation of model results extremely difficult, thus it is a great advantage to keep the model as unambiguous as possible, as was done here (Caswell and Brault 1992, Law and Kelton 1991). There are other modelling approaches which could have been used to simulate this system. One such approach, which is very similar to C A is the coupled map lattice (CML) (Hendry et al. 1996, McGlade 1995, Hassell et al. 1991). Like a CA, a coupled map lattice is usually constructed as a grid of cells where each cell can interact locally with other cells in its neighbourhood. In contrast to CA, however, the state of each cell 102 in a C M L is a continuous variable (rather than a discrete variable) and thus varies as a continuous function of its own value and those of its neighbours. This approach was not as suitable for modelling Kim's community because the field data were coded in discrete form in 20x20 cm grids where the individual cells of the grid were assigned one of a finite number of discrete states representing the life history stage of the species occupying the grid. Although in reality, each individual Fucus plant, for example, grows in a continuous (rather than discrete) fashion, and thus it would seem at first glance that a C M L would be a better approach to modelling this system, the continuous variable representing plant size was approximated by Kim using discrete life history classes. Thus Fucus was placed into three disjoint size classes (Kim 1995). For this reason, it was more appropriate to use a C A approach, rather than a C M L . Another possible approach was to employ a different individual-based formalism, one which attempted to generate the observed dynamics of Mazzaella and Fucus from even lower-level processes, such as physiology. This approach has been used very successfully in simulating the population dynamics of Daphnia (Murdoch et al. 1992). Unfortunately, detailed physiological data were only available for Fucus (Chapman 1995) and almost nothing of the physiology of Mazzaella was known. Thus, there simply were not enough available data to warrant this approach. Matrix population models, which are more distantly related to C A than the previous examples, could also have been used. Such models consider population dynamics as a Markov chain (Caswell 1989). The problem with this approach is that it does not 103 incorporate any spatial information in the model, which seemed to be important in Kim's community. Yet another alternative was to use a continuous, differential equation model. This modelling approach was not used because the discrete nature of the data and the seeming importance of local spatial interactions could not easily be specified in a continuous model. One alternative to C A which was employed was a simple birth-death (BD) difference equation model, where the population density at a given time step is determined by the density at the previous time step minus the number of deaths plus the number of births in the population. Such a model had the properties of being discrete in time and explicitly nonspatial. Thus, it would be compatible with the C A models since they would all use the same discrete time intervals, while at the same time providing a test of the alternative 'hypothesis' regarding the importance of local spatial interactions in Kim's community. A summary of model performance The predictions of the eight different models (six C A and two BD) discussed above were tested against an independent set of field data. In addition to statistics for measuring the predictive bias of the models, Theil's inequality coefficient was calculated for each of the models in order to compare the predictions to a naive zero change prediction. The main purpose for using Theil's inequality coefficient (TIC) was to rank the different models in terms of predictive ability and thus be able to determine the model which best simulated Mazzaella and Fucus dynamics in Kim's community. This 104 approach has often been used to determine the best model from a group of competing models (Power 1993). Unfortunately, it was not possible to select a 'best model' from those constructed here, since the models predicted percent covers of Mazzaella and densities of Fucus with differing ability for the two different sampling dates (24 months and 22 months after the initial sampling); however, since all of the models were found to be extremely poor predictors of Fucus density, it was concluded that none of the models were adequate at predicting Fucus dynamics. In terms of predictions of Mazzaella percent cover, all of the models consistently predicted the 22 month sampling date percent cover of Mazzaella better than the 24 month sampling date percent cover. Thus, for the purposes of selecting the best model for predicting Mazzaella dynamics, only the 22 month sample data were considered. Based on Theil's inequality coefficient (TIC), the two best models for predicting Mazzaella percent cover at the 22 month sampling date were the stochastic, nonseasonal C A and the simple BD model for Mazzaella. Because the B D model was originally constructed to serve as a kind of'control' for the importance of local spatial interactions in governing the dynamics of Fucus and Mazzaella in Kim's community, some important questions arise from the fact that the two models were equally good at predicting Mazzaella percent cover. Using the principle of Occam's razor, the best model is the simplest model which does the job, hence the Mazzaella B D model is the most utilitarian for the purpose of predicting Mazzaella percent cover. The choice of best model is not so simple, however, since models must be constructed with a particular purpose in mind. Depending on the questions that are being 105 asked, either model can be considered as appropriate. For example, because the B D model is strictly deterministic and all future population predictions are based on the size of the population during the previous time step in the model, it cannot answer questions related to recovery time of Mazzaella after Mazzaella is removed from the system (such as in the Mazzaella-removal treatments performed by Kim (1995)). The reason for this is that, according to the BD model, once the percent cover of Mazzaella reaches zero, there will be no individuals left from which new ones can be born and so the population will stay at zero forever. The stochastic C A model, on the other hand, does not suffer from this restriction and would be a good model with which to answer such a question. In addition, the C A model is able to answer questions regarding spatial patterning or organization in the Mazzaella population which simply cannot be asked for the B D model, since the BD model has no way of specifying spatial information. On the other hand, if one simply wanted to know the percent cover of Mazzaella in a given patch in two years time, it is much easier to type a few numbers into a calculator (using the B D model) than to construct a computer program, debug it, generate results from a hundred runs of the model, and take the average percent cover from those runs (using the C A model). Thus the utility and appropriateness of the models depends on the questions being asked andthe purpose for using the model. The inverse problem in cellular automata and the DIPS algorithm To date, most of the research on cellular automata and their applications in various fields have focused on what is known as the forward problem: given a rule or set of rules for a CA, predict the properties of the resultant C A (Adamatzky 1994, Gutowitz 1990a). 106 There is, however, another way of approaching CA: given a set of properties of a system, derive a rule or set of rules which produce these properties in a C A (Adamatzky 1994 and 1992, Gutowitz 1990a, Richards et al. 1990). This alternative approach is called the inverse problem, and is the way in which C A were treated in this thesis. Adamatzky (1994, 1992) developed algorithms for solving the inverse problem for a wide variety of systems and CA, one of which was the DIPS (Direct Identification of Probabilistic Synchronous Cellular Automata) algorithm used here. There are several assumptions inherent in DIPS. The first is that the system from which the C A rules are being extracted is probabilistic (i.e., stochastic). This is obviously a false assumption when dealing with a completely deterministic system, yet DIPS can still be successfully applied to such a system because as the algorithm proceeds, all of the transition probabilities in the C A will converge to either zero or one in a deterministic system. Thus, whether the system of interest is deterministic or stochastic, DIPS can be used to extract the rules from the system. The other major assumption of DIPS is that the system of interest is synchronous. In this case, synchronous simply means that each transition in the system occurs in one time step and that all transitions are synchronized so that each change occurs simultaneously. This assumption is almost certainly not valid, since it is unlikely that each species examined in Kim's field quadrats responds to the various biotic and abiotic interactions in the community in the same time frame and all at the same time. In general, this assumption of synchronous updating for modelling ecological systems is false. Interactions and processes in ecology take place on many different temporal 107 scales (Holling 1992 and Levin 1992). In the particular case of the models presented here, however, synchronous updating made sense because the field data used to parameterize the model came in synchronous form (each quadrat was resampled every two months, on average). Thus, in this case, the assumption of synchronous updating was upheld because the field data were collected synchronously. It is important to realize that any C A models resulting from the application of DIPS will necessarily be synchronous models. Although synchronous C A are considered, in general, to be inappropriate for ecological modelling (Hogeweg 1988), it was both necessary and appropriate for the models considered here because it allowed for each iteration in the model to correspond to the time interval between sampling dates in the field, thus mirroring Kim's experimental design as closely as possible. Because ecologists usually collect field data in a synchronous fashion, the DIPS algorithm should be generally applicable in ecology, provided that the resultant C A models are used for the purposes of simulation. The construction of C A models using DIPS for the purpose of resolving 'what-if questions would suffer from the problem that any model results would be specific to a synchronous system, thus placing rather severe (and very likely unrealistic) restrictions on the generality of the conclusions based on the model. There is another assumption inherent in the DIPS algorithm, however, which did not hold in this study. DIPS is an iterative algorithm in that it improves the estimates of transition probabilities at each iteration by successively increasing the neighbourhood radius from which it calculates transition events until the transition probabilities satisfy a Cauchy criterion (i.e., until each individual transition probability converges to a stable 108 value). All of the C A models presented here used a neighbourhood radius of one. An examination of the convergence of the transition probabilities for these models revealed that, on average, only 60 percent of the transition probabilities converged to stable values using a neighbourhood radius of one. This suggests that the neighbourhood radius for the C A models used here should have been larger than one to obtain better estimates for the transition probabilities. Although true in theory, there are practical problems with this conclusion. One problem arises from the fact that DIPS estimates the C A rules as the frequency of occurrence of the different states in the system, thus approximating a probability distribution (Adamatzky 1994, 1992). For this approximation to be valid, the data set used by DIPS must grow exponentially as the neighbourhood radius increases, since increasing the neighbourhood radius results in an exponential increase in thenumber of possible neighbourhood configurations for that neighbourhood (Richards et al. 1990). From an information theory standpoint, the problem here is that the mutual information3 (a measure of how two variables, or symbol sequences, are correlated) is being over-estimated because the number of instances of the given states in Kim's field data is relatively small in comparison to the number of possible neighbourhood configurations. Richards et al. (1990) give a good intuitive example of how this can occur when tossing a pair of dice. After one toss, the dice appear to be completely correlated. As the dice are tossed repeatedly, however, this apparent correlation rapidly disappears. Thus, increasing the neighbourhood radius in order to obtain better estimates of transition probabilities should only be attempted if there is a corresponding increase in the data 3 In the case of DIPS, mutual information measures the correlation between the state of a given cell at time t+l and its neighbourhood configuration at time t. 109 available from which to estimate the probabilities. In the case of the C A models presented here, the data were already so sparse that it was necessary to pool the data together into a two-year block just to obtain reliable probability estimates for a neighbourhood radius of one. It is doubtful that enough data would have been available to increase the radius further. Exponentially increasing amounts of data are generally not possible to obtain in most ecological field studies. The data collected by Kim (1996 and 1995) required two years of intensive sampling. Given that most grants last less than four years and graduate students typically spend at most two to three years collecting field data, it is improbable that enough data for constructing complex models using DIPS would ever be available for the majority of ecological systems. This is the greatest problem with the DLPS approach to simulating ecological systems. An additional practical problem encountered when increasing the neighbourhood radius is that, as the radius is increased (and thus the number of configurations for that neighbourhood is increased exponentially), the memory requirements for the C A model increases exponentially, as well as the time complexity4 of the DLPS algorithm itself. Thus DLPS is a very computationally inefficient algorithm. Genetic algorithms (Richards et al. 1990), which are more efficient than DIPS, have also been developed for solving the inverse problem, and may prove to be a better approach. Although the genetic algorithms are more efficient, they are also more complicated to implement (especially as, 4 Time complexity refers to the number of operations performed by an algorithm for a given input. In the case of the DIPS algorithm, the input is the neighbourhood radius. Thus the number of operations performed by DIPS increases exponentially with increasing neighbourhood radius. 110 the number of states in the system increases) and still suffer from the problem of requiring exponentially increasing amounts of data with increases in the neighbourhood radius. Al l these problems having been mentioned, it is important to remember that, even though the convergence of the transition probabilities in the C A models constructed here was only 60%, it was still possible to produce a C A model which was able to predict the percent cover of Mazzaella very well. This leads to a very practical question: what is the relationship between parameter convergence using DIPS and the predictive ability of the resulting C A model? It may be that the theoretical requirements for convergence heed not always be satisfied in order to produce C A models with good predictive abilities. This is an important open question that has so far received no attention in the literature. Cellular automata as a modelling formalism in ecology Because of the simplicity of their construction, and the apparent lack of formal mathematical training required for their use, C A models have almost started to become 'standard fare' with ecologists. Cellular automata models, however, are not a panacea for ecologists and the construction and use of such models give rise to a myriad of problems. The first difficulty with these models arises from their accessibility which, paradoxically, is also one of their greatest advantages. It is easy to naively construct C A models, without resorting to any mathematics whatsoever. Unfortunately, once constructed, the results of these models can be nearly impossible to interpret. This is because C A models, as already mentioned, (and individual-based models in general) are capable of producing vast amounts of data, often with no clear indication of how such I l l data should everi be visualized, let alone analyzed (statistically or otherwise) (DeAngelis et al. 1994). Because the data produced from C A (and nearly all other simulation, models) are often nonstationary (i.e., the distributions of the successive observations change over time) and autocorrelated, standard statistical treatments familiar to ecologists may be generally inapplicable (Law and Kelton 1991). So far, thishas not really been a problem in the ecological application of C A models for the reason that the results of such models are almost never tested against field results to begin with (Mayer and Butler 1993)! Another problem with the use of C A models which is almost never mentioned in the literature, is that these models are implemented by writing computer programs. It is not widely known to ecologists that the average number of errors in computer programs written by industry professionals is about 5 to 10 errors per thousand lines of code (Kusec, pers. comm.). Debugging and testing of computer programs has been a long-standing issue in computer science, and has an obvious impact on the use of computer programs in modelling. In the software design process, great pains and a highly structured approach are taken to ensure the absolute minimum number of bugs possible in the resulting code, and extensive testing of the program is performed to ensure the reliability of the software produced. Ecologists who construct C A models and are not aware of rigorous program testing and validation methods should become familiar with these. Traditional modelling approaches, using ordinary differential equations for example, have an advantage over C A models in that their behaviour is well understood and 112 characterized, and can be analytically derived from the equations in the model. Even simple CA, on the other hand, are still poorly understood, and those used by most ecologists are analytically intractable (i.e., they cannot be solved analytically using currently available mathematics) (DeAngelis et al. 1994). Thus, it can be difficult, or even impossible, to understand or even identify the components of the model most critical to its behaviour (Cushing 1994). Progress is being made in this area by researchers who are beginning to accurately characterize the statistical properties of the simpler C A and are searching for the underlying parameters which give rise to those properties (Gutowitz 1990b, L i et al. 1990 and Wolfram 1984). Eventually, it is hoped, a general theory of cellular automata, and perhaps even complex systems in general, will be the result. Until such theory is available, however, we must rely on extensive simulation to give an indication of the robustness and sensitivity of the behaviour of a particular CA. Spatial scale may also pose problems in C A models. For example, in a model which includes new seedlings and adult plants, these different life history stages would usually occupy only one cell each in the C A lattice, even though in the 'real world', the size difference between these two stages may be an order of magnitude or more. Attempting to overcome these problems by incorporating numerous additional states (such as additional growth stages) or creating enormous lattices to allow the sizes all life history stages to be accurately represented in the model add considerable complexity to the model and may quickly outstrip the ability of the computer to simulate the CA. DeAngelis et al. (1994) discuss many of the other problems associated with individual-based models, of which C A are a proper subset. These include changes in the 113 global behaviour of the models resulting from the order in which model rules are evaluated, exceeding the limits of available computing power when simulating large populations and problems associated with the simulation of several different populations simultaneously. A problem which is seldom discussed in the ecological C A literature is the effect of boundary conditions and synchronous updating on the behaviour of C A models. It is . , known that changing the updating of cells in some C A from synchronous to asynchronous can dramatically alter the ensuing behaviour of the model, and it is often the case that the more interesting structures produced by C A are an artifact of synchronous updating (Hogeweg 1988). It has been suggested (Hogeweg 1988) that for the majority of ecological applications, asynchronous C A models are much more appropriate; however, most of the C A models used in ecology continue to be, synchronous. Finally, it is important, when basing conclusions on the results of C A models, to ensure that the model results are invariant with respect to the dimensions of the lattice used. This is generally not done with C A models in ecology, even though statistical techniques for doing so are available (Hendry et al. 1996, McGlade 1995). Although there are problems with the C A formalism, many of them can be resolved with some careful thought about the purpose for the model and the reasons for selecting particular boundary conditions and lattice sizes. Thus it is unacceptable to simply employ the designs used by other researchers unless the system being modelled is very similar. It is hoped that the approach taken here, carefully justifying the reasons for choosing to use C A in the first place and for implementing the models in a particular way, will help other 114 ecologists in deciding how and when to use CA. If care is taken in their specification and implementation, C A models can be an extremely useful and powerful modelling approach for ecologists. 115 REFERENCES Adamatzky, A. (1994). Identification of Cellular Automata, Taylor and Francis, Ltd., London, 1994, pp. 81-87. Adamatzky, A. (1992). Identification of Probabilistic Cellular Automata. Soviet Journal of Computer and Systems Sciences, 30: 118-123. Barkham, J.P. and Hance, C E . (1982). Population dynamics of the wild daffodil (Narcissus pseudonarcissus) III. Implications of a computer model of 1000 years of population change. Journal of Ecology, 70: 323-344. Bavel, Z. (1983). Introduction to the theory of Automata, Reston Publishing Co., Reston, V A , 658pp. Begon, M . , Harper, J.L. and Townsend, C.R. (1990). Ecology: Individuals', Populations and Communities, Blackwell Scientific Publications, Boston, 945 pp. Brooks, R.J. and Tobias, A . M . (1996). Choosing the best model: level of detail, complexity, and model performance. Mathematical and Computer Modelling, 24: 1- 14. Burks, C. and Farmer, D. (1984). Towards modelling D N A sequences as automata. PhysicaD, 10: 157-167. Caswell, H. (1989). Matrix Population Models, Sinauer Associates, Inc., Massachusetts, 328 pgs. Caswell, H. and Brault, S. (1992). Life cycles and population dynamics: mathematical models for marine organisms. Oceanus, Fall 1992: 86-93. Caswell, H. and John, A M . (1992). In Individual-based Models and Approaches in Ecology: Populations, Communities and Ecosystems (DeAngelis, D.L. and Gross, L.J. , eds), pp. 36-61, Chapman & Hall. Chapman, A.R.O. (1995). Functional ecology of fucoid algae: twenty-three years of progress. Phycologia, 34: 1-32. Colasanti, R.L. and Grime, J.P. (1993). Resource dynamics and vegetation processes: a deterministic model using two-dimensional cellular automata. Functional Ecology 7: 169-76. 116 Crawley, M.J. and May, R . M . (1987). Population dynamics and plant community structure: competition between annuals and perennials. Journal of Theoretical Biology 125. 475 -489. Cushing, J.M. (1994). Structured population dynamics. In Levin, S.A., ed., Lecture Notes in Biomathematics: Frontiers in Mathematical Biology, Springer-Verlag, Berlin; 1994, pp. 280 - 295. DeAngelis, D.L. and Gross, L.J. , eds (1992). Individual-based Models and Approaches in Ecology: Populations, Communities and Ecosystems, Chapman & Hall, 525 PP-DeAngelis, D.L., Rose, K A . and Huston, M.A. (1994). Individual-oriented approaches, to modeling ecological populations and communities. In Levin, S.A., ed., Lecture Notes in Biomathematics: Frontiers in Mathematical Biology, Springer-Verlag, Berlin, 1994, pp. 390-410. Durrett, R. and Levin, S. A. (1993). Stochastic spatial models: a user's guide to ecological applications. Unpublished manuscript. Ermentrout G.B. and Edelstein-Keshet, L. (1993). Cellular automata approaches to biological modeling. Journal of Theoretical Biology, 160: 97-133. Gutowitz, H A . (1990a). Introduction. PhysicaD, 45: vii-xiv. Gutowitz, H A . (1990b). A hierarchical classification of cellular automata. PhysicaD, 45: 136-158. Hassell, M P . and May, R . M . (1989). The population biology of host-parasite and host-parasitoid associations. In Perspectives in Ecological Theory (Roughgarden, J., May, R .M. and Levin, S.A., eds.), pp 319-347. Hassell, M P . , Commins, H.N. and May, R . M . (1991). Spatial structure and chaos in insect population dynamics. Nature, 353: 255-258. Hendry, R.J., McGlade, J.M. and Weiner, J. (1996). A coupled map lattice model of the growth of plant monocultures. Ecological Modelling, 84: 81-90. Hogeweg, P. (1988). Cellular automata as a paradigm for ecological modeling. Applied Mathematics and Computation, 27: 81-100. Holling, C.S. (1992). Cross-scale morphology, geometry, and dynamics of ecosystems. Ecological Monographs, 62: 447-502. 117 Huston, M , DeAngelis, D. and Post, W. (1988). New computer models unify ecological theory, Bioscience, 3 8: 682-691. Judson, O P . (1994). The rise of the individual-based model in ecology. TREE 9: 9-14. Kim, J.H. (1995). Biological and physical dynamics producing structure in a high intertidal algal community. Ph.D. Thesis, University of British Columbia, 140 pp. Kim, J.H. (1996). Effects of size and season of disturbance on algal patch recovery in a rocky intertidal community. Marine Ecology Progress Series, 133: 217-228. Kim, J.H. and DeWreede, R E . (1996). Distribution and feeding preference of a high intertidal Littorinid. Botanica Marina, 39: 561-569. Law, A . M . and Kelton, W D . (1991). Simulation Modelling and Analysis, McGraw-Hill, Inc, New York, 1991. Levin, S. (1992). The problem of pattern and scale in ecology. Ecology, 73: 1943-1967. L i , W., Packard, N .H . and Langton, C.G. (1990). Transition phenomena in cellular automata rule space. Physica D, 45: 77-94. May, R . M . (1974). Biological populations with nonoverlapping generations: stable points, stable cycles, and chaos. Science, 186: 645-647. May, R . M . (1976). Simple mathematical models with very complicated dynamics. Nature, 261: 459-467. Mayer, D.G. and Butler, D.G. (1993). Statistical validation. Ecological Modelling, 68: 21-32: McGlade, J.M. (1995). Dynamics of complex ecologies. InModelling the Dynamics of Biological Systems: Nonlinear Phenomena and Pattern Formation (E. Mosekilde and O.G. Mouritsen, eds.), Springer-Verlag, Berlin, pp. 251-268. Murdoch, W W . , McCauley, E., Nisbet, R .M. , Gurney, W.S.C. and de Roos, A . M . (1992). Individual-based models: combining testability and generality. In Individual-based Models and Approaches in Ecology: Populations, Communities and Ecosystems(DeAngelis, D.L. and Gross, L.J. , eds.), Chapman & Hall, pp. 19-35. Von Neumann, J. (1966). Theory of Selfreproducing Automata (A.W. Burks, ed.), Univ. of Illinois Press, 388 pp. 118 Perry, J.N. and Gonzalez-Andujar, J.L. (1993). Dispersal in a metapopulation neighbourhood model of an annual plant with a seedbank. Journal of Ecology 81: 453-63. Power, M . (1993). The predictive validation of ecological and environmental models. Ecological Modelling, 68: 33-50. Richards, F.C., Meyer, T P . and Packard, N . H . (1990). Extracting cellular automata rules directly from experimental data. Physica D, 45: 189-202. Schwinning, S. and Parsons, A.J. (1996). A spatially explicit population model of stoloniferous N-fixing legumes in mixed pasture with grass. Journal of Ecology, 84: 815-826. Silvertown, J., Holtier, S. and Johnson, J. (1992). Cellular automaton models of interspecific competition for space—the effect of pattern on process. Journal of Ecology 80: 527-33. Stockle, C O . (1992). Canopy photosynthesis and transpiration estimates using radiation interception models with different levels of detail. Ecological Modelling, 60: 31-44. Vichniac, G.Y. (1984) Simulating physics with cellular automata. PhysicaD, 10: 96-116. Wolfram, S. (1994). Cellular automata as models of complexity. Nature, 311: 419-424. 1 1 9 APPENDIX The Appendix contains the source code for the nonseasonal zero neighbour distance cellular automata model. It consists of the model specification (C header file) and impementation (C source file). The code for the other models was similar. 120 / / N o n s e a s o n a l Z e r o N e i g h b o u r D i s t a n c e C e l l u l a r A u t o m a t a M o d e l : c a 8 . c / / V e r s i o n 1 . 0 , S e p t . 1 5 , 1 9 9 6 . / / b y N i c k o l a s G r a b o v a c / / B o t a n y D e p a r t m e n t , U n i v e r s i t y o f B r i t i s h C o l u m b i a / / - . / / F e a t u r e s i n c l u d e : i n i t i a l c o n d i t i o n s l o a d e d f r o m m a p f i l e , / / : m o d e l p a r a m e t e r s o b t a i n e d f r o m m a p r - x . c f o r b i r t h a n d / / d e a t h p r o b a b i l i t i e s o f M a z a e l l a a n d F u c u s / / : 3 c e l l s t a t e s : e m p t y ; M a z a a e l l a ; F u c u s ; / / . : s i m u l t a n e o u s u p d a t i n g o f c e l l s i n t h e L a t t i c e // // / / I N C L U D E F I L E S / / # i n c l u d e < s t d i o . h > # i n c l u d e < s t d l i b . h > # i n c l u d e < s t r i n g . h > # i n c l u d e < c o n i o . h > # i n c l u d e < c t y p e . h > # i n c l u d e < g r a p h i c s . h > # i n c l u d e < m a t h . h > # i n c l u d e < d o s . h > // / / D E F I N I T I O N S O F C O N S T A N T S / / / / D e f i n i t i o n o f c e l l s t a t e s i n L a t t i c e : # d e f i n e E M P T Y 0 # d e f i n e F 1 # d e f i n e M 2 # d e f i n e F I 1 # d e f i n e F i r 2 # d e f i n e F 2 3 # d e f i n e F 2 r 4 # d e f i n e F 3 5 # d e f i n e F 3 r 6, # d e f i n e P I 7 # d e f i n e P l r 8 # d e f i n e P2 9 # d e f i n e P 2 r 1 0 # d e f i n e P 3 1 1 # d e f i n e P 3 r 12 / / D e f i n i t i o n s f o r r a n d o m n u m b e r g e n e r a t o r r m a r i n a n d r m a r : # d e f i n e NO 7 8 • / / A S C I I c o d e f o r " N " # d e f i n e T R U E - 1 # d e f i n e F A L S E 0 # d e f i n e b o o l e a n i n t # d e f i n e I L A T T I C E _ F I L E " d : \ \ c a \ \ i l a t t i c e \ \ i l a t c 2 . m a p " # d e f i n e P A R A M _ F I L E " d : \ \ c a \ \ p a r a m s \ \ c a 6 p a r . t x t " # d e f i n e R E S U L T S _ F I L E " d : \ \ c a \ \ r e s u l t s \ \ r 8 . t x t " # d e f i n e S A V E L A T T I C E F I L E " d : \ \ c a \ \ r e s u l t s \ \ 1 8 . t x t " # d e f i n e M A Z _ B I R T H _ P R O B 0 . 0 9 2 4 # d e f i n e M A Z _ D E A T H _ P R O B 0 . 1 1 7 # d e f i n e F U C _ B I R T H _ P R O B 0 . 0 1 9 3 7 # d e f i n e F U C _ D E A T H _ P R O B 0 . 2 5 // / / G L O B A L V A R I A B L E D E C L A R A T I O N S / / / / G l o b a l D e c l a r a t i o n s f o r F i l e s : 121 F I L E * r e s u l t s F i l e ; F I L E * s a v e L a t t i c e F i l e ; / / G l o b a l D e c l a r a t i o n s f o r C A L a t t i c e s : i n t c u r r L a t t i c e [ 5 2 ] [ 5 2 ] , / / A r r a y w h i c h h o l d s t h e c u r r e n t C A L a t t i c e p a s t L a t t i c e [ 5 2 ] [ 5 2 ] ; / / A r r a y w h i c h h o l d s a c o p y o f t h e L a t t i c e / / o f t h e p r e v i o u s t i m e " s t e p s o t h a t / / s i m u l t a n e o u s u p d a t i n g c a n b e p e r f o r m e d / / G l o b a l D e c l a r a t i o n s f o r G r a p h i c s : c o n s t i n t c o l o u r l n d e x [ 1 6 ] = { B L A C K , L I G H T G R E E N , L I G H T R E D } ; / / G l o b a l D e c l a r a t i o n s f o r M o d e l R e s u l t s : l o n g i n t h a m m i n g D i s t ; / / T h e h a m m i n g d i s t a n c e f o r e a c h i t e r a t i o n i n t d e n s i t y [ 3 ] ; / / D e n s i t y o f t h e d i f f e r e n t s t a t e s a f t e r e a c h i t e r a t i o n / / G l o b a l D e c l a r a t i o n s f o r M o d e l S e t u p : i n t t r e a t m e n t T y p e , l a t t i c e T y p e , m a x D i s t S i z e = 1 2 ; f l o a t d i s t u r b a h c e R a t e = 0 . 1 ; / / G l o b a l D e c l a r a t i o n s f o r M o d e l I n i t i a l C o n d i t i o n s : i n t l a t t i c e R , l a t t i c e C , / / T h e X a n d Y d i m e n s i o n s o f t h e l a t t i c e r u n s , / / T h e n u m b e r o f r u n s t o p e r f o r m i t e r a t i o n s = 5 0 0 , / / T h e n u m b e r o f i t e r a t i o n s t o p e r f o r m c u r r R u n , / / T h e c u r r e n t r u n c u r r l t e r a t i o n ; / / T h e c u r r e n t i t e r a t i o n / / G l o b a l D e c l a r a t i o n s f o r R a n d o m N u m b e r G e n e r a t o r : s t a t i c f l o a t u [ 9 8 ] , c , c d , c m ; s t a t i c i n t i 9 7 , j 9 7 ; s t a t i c b o o l e a n t e s t = F A L S E ; f l o a t r a n d o m N u m b e r s [ 1 0 0 1 ] ; i n t r a n d N u m C o u n t ; // / / F U N C T I O N D E C L A R A T I O N S / / / / F i l e F u n c t i o n s : v o i d L o a d L a t t i c e ( v o i d ) ; v o i d L o a d P a r a m s ( v o i d ) ; v o i d C l o s e R e s u l t s ( i n t r u n U s e d ) ; v o i d S a v e R e s u l t s ( v o i d ) ; v o i d S a v e l t e r a t i o n ( v o i d ) ; v o i d S a v e l t e r a t i o n L a t t i c e ( v o i d ) ; v o i d F G e t W o r d ( F I L E * f i l e p t r , c h a r f i l e i n p u t [ ] ) ; / / M o d e l s e t u p a n d i n i t i a l i z a t i o n s F u n c t i o n s : v o i d G e t l n i t i a l C o n d . i t i o n s ( v o i d ) ; v o i d C o n v e r t L a t t i c e ( v o i d ) ; v o i d S e t U p L a t t i c e ( v o i d ) ; v o i d S e t U p R e s u l t s ( v o i d ) ; / / G r a p h i c s F u n c t i o n s : v o i d S e t U p G r a p h i c s ( v o i d ) ; v o i d D i s p l a y G r a p h i c s ( v o i d ) ; v o i d P l o t C e l l ( i n t x , i n t y , i n t s t a t e ) ; v o i d P l o t D e n s i t y ( i n t s t a t e D e n , i n t s t a t e ) ; v o i d S h u t O f f G r a p h i c s ( v o i d ) ; v o i d S h o w R e s u l t s ( v o i d ) ; / / C A C a l c u l a t i n g F u n c t i o n s : v o i d M a k e C l e a r i n g ( v o i d ) ; v o i d D o T r e a t m e n t ( v o i d ) ; i n t C a l c D i s t u r b a n c e R a d i u s ( i n t s e a s o n ) ; u n s i g n e d l o n g i n t F a c t o r i a l ( i n t n ) ; v o i d D o D i s t u r b a n c e ( i n t s e a s o n ) ; v o i d R e m o v e M a z ( v o i d ) ; v o i d R e m o v e F u c ( v o i d ) ; v o i d R e m o v e P e l ( v o i d ) ; i n t O d d ( i n t n u m ) ; v o i d C a l c D e n s i t i e s ( v o i d ) ; v o i d C o p y L a t t i c e ( v o i d ) ; v o i d D o O n e l t e r a t i o n ( v o i d ) ; v o i d C a l c u l a t e C e l l ( i n t c , i n t r ) ; v o i d G e t N e i g h b o u r s ( i n t c , i n t r , i n t n u m N e i [ ] ) v o i d M a z R u l e s ( i n t c , i n t r ) ; v o i d F u c R u l e s ( i n t c , i n t r , i n t L H s t a g e ) ; v o i d P e l R u l e s ( i n t c , i n t r , i n t L H s t a g e ) ; v o i d F u c G r o w t h R u l e s ( i n t c , i n t r , i n t L H s t a g e ) v o i d P e l G r o w t h R u l e s ( i n t c , i n t r , i n t L H s t a g e ) v o i d F u c R e p r o d R u l e s ( i n t c , i n t r , i n t L H s t a g e ) v o i d P e l R e p r o d R u l e s ( i n t c , i n t r , i n t L H s t a g e ) v o i d B i r t h R u l e s ( i n t c , i n t r ) ; / / R a n d o m N u m b e r G e n e r a t i o n F u n c t i o n s : s t a t i c v o i d r m a r i n ( i n t i j , i n t k l ) ; v o i d r a n m a r ( f l o a t r v e c [ ] , i n t l e n ) ; f l o a t R a n d N u m ( v o i d ) ; v o i d G e n e r a t e R a n d N u m s ( v o i d ) ; / / D e b u g g i n g F u n c t i o n s : v o i d T e s t L o a d L a t t i c e ( v o i d ) ; v o i d T e s t L o a d P a r a m s ( v o i d ) ; 123 / / N o n s e a s o n a l Z e r o N e i g h b o u r D i s t a n c e C e l l u l a r A u t o m a t a M o d e l : c a 8 . c / / V e r s i o n ' 1 . 0 , S e p t . 1 5 , 1 9 9 6 . // // // // // // // // // by Nickolas Grabovac Botany Department, U n i v e r s i t y of B r i t i s h Columbia Features include: i n i t i a l c o n d i t i o n s l o a d e d f r o m map f i l e , m o d e l p a r a m e t e r s o b t a i n e d f r o m m a p r - x . c f o r b i r t h a n d d e a t h p r o b a b i l i t i e s o f M a z a e l l a a n d F u c u s 3 c e l l s t a t e s : e m p t y ; M a z a a e l l a ; F u c u s ; s i m u l t a n e o u s u p d a t i n g o f c e l l s i n t h e L a t t i c e // // INCLUDE FILES // # i n c l u d e " c a 8 . h " // / / F U N C T I O N I M P L E M E N T A T I O N S // // / / F i l e F u n c t i o n s : / / v o i d L o a d L a t t i c e ( ) { / / / / L o a d s t h e n e x t C A l a t t i c e p a i r f r o m a f i l e c a l l e d i l a t c a 2 . m a p . / / T h i s f i l e c o n t a i n s a s i n g l e 2 0 x 2 0 a r r a y o f i n t e g e r s ( r a n g i n g f r o m 0 t o / / 1 3 ) w h i c h r e p r e s e n t s t h e f i r s t p e r m a n e n t q u a d r a t m a p f o r a g i v e n / / t r e a t m e n t ) . T h e n u m b e r s i n t h e f i l e a r e s e p a r a t e d b y T A B S a n d e a c h r o w / / i s s e p a r a t e d b y a L F . // F I L E * l a t t i c e F i l e ; / / t h e f i l e p o i n t e r t o t h e i l a t t i c e . m a p f i l e i n t r ; / / t h e c u r r e n t r o w o f t h e 2 0 x 2 0 a r r a y i n t h e f i l e i n t c ; / / t h e c u r r e n t c o l u m n o f t h e 2 0 x 2 0 a r r a y i n t h e f i l e c h a r f i l e i n p u t [ 1 3 ] = " " ; / / a s t r i n g u s e d t o h o l d t h e c h a r a c t e r s r e a d / / f r o m t h e i l a t t i c e . m a p f i l e . i f ( ( l a t t i c e F i l e = f o p e n ( I L A T T I C E _ F I L E , " r " ) ) == N U L L ) { p r i n t f ( " \ n \ n C a n ' t o p e n i l a t t . m a p f i l e ! " ) ; e x i t ( 0 ) ; } f o r ( r = 1 ; r <= l a t t i c e C ; r++) { f o r ( c .= 1 ; c <= l a t t i c e R ; C++) { F G e t W o r d ( l a t t i c e F i l e , f i l e i n p u t ) ; c u r r L a t t i c e [ r ] [ c ] = a t o i ( f i l e i n p u t ) ; } } f c l o s e ( l a t t i c e F i l e ) ; } / / L o a d L a t t i c e . v o i d L o a d P a r a m s ( ) { / / / / L o a d s t h e C A p a r a m e t e r s f r o m a f i l e c a l l e d c a 2 p a r . t x t . T h i s f i l e c o n t a i n s / / 3 6 8 x 8 f l o a t a r r a y s w h e r e e a c h n u m b e r i s s e p a r a t e d b y a T A B a n d r o w s a r e / / s e p a r a t e d b y a L F . N o t e , i n d i v i d u a l 8 x 8 a r r a y s a r e NOT s e p a r a t e d f r o m o n e / / a n o t h e r b y a n e x t r a L F ( i . e . t h e 8 x 8 p a r a m e t e r b l o c k s n o t s e p a r a t e d / / f r o m o n e a n o t h e r b y a b l a n k l i n e ) . A l s o , e a c h f l o a t n u m b e r i s 12 c h a r ' s / / l o n g , t h u s s t r m u s t b e d i m m e d a s 1 3 . T h e o r d e r o f p a r a m e t e r s i s : / / b i r t h p a r a m s , d e a t h p a r a m s , r e p r o d p a r a m s , g r o w t h p a r a m s . T h e o r d e r / / w i t h i n e a c h o f t h e s e g r o u p i n g s c o r r e s p o n d s t o t h e o r d e r o f s t a t e s g i v e n / / i n t h e g l o b a l s t a t e d e f i n i t i o n s . F I L E * p a r a m F i l e ; / / p o i n t e r t o t h e p a r a m t e r f i l e c h a r s t r [ 1 3 ] ; / / a s t r i n g u s e d t o h o l d d a t a r e a d f r o m t h e f i l e i n t n u m N e i l , n u m N e i 2 ; / / t h e n u m b e r o f n e i g h b o u r s o f a g i v e n t y p e / / d e n o t e d a s 1 a n d 2 ) a r o u n d t h e c u r r e n t s t a t e . i n t s t a t e ; / / t h e c u r r e n t s t a t e i f ( ( p a r a m F i l e = f o p e n ( P A R A M _ F I L E , " r " ) ) == N U L L ) { p r i n t f ( " \ n \ n C a n ' t o p e n p a r a m e t e r f i l e c a 6 p a r . t x t ! " ) ; e x i t ( 0 ) ; } / * f o r ( s t a t e = F ; s t a t e <= M ; s t a t e + + ) { f o r ( n u m N e i l = 0 ; n u m N e i l <= 8 ; n u m N e i l + + ) { f o r ( n u m N e i 2 = 0 ; n u m N e i 2 <= 8 ; n u m N e i 2 + + ) { F G e t W o r d ( p a r a m F i l e , s t r ) ; b i r t h P r o b [ s t a t e ] [ n u m N e i l ] [ n u m N e i 2 ] = a t o f ( s t r ) ; } } } f o r ( s t a t e = F ; s t a t e <= M ; s t a t e + + ) { f o r ( n u m N e i l = 0 ; n u m N e i l <= 8 ; n u m N e i l + + ) { f o r ( n u m N e i 2 = 0 ; n u m N e i 2 <= 8 ; n u m N e i 2 + + ) { F G e t W o r d ( p a r a m F i l e , s t r ) ; d e a t h P r o b [ s t a t e ] [ n u m N e i l ] [ n u m N e i 2 ] = a t o f ( s t r ) ; } ). } V f c l o s e ( p a r a m F i l e ) ; } / / e n d L o a d P a r a m s v o i d F G e t W o r d ( F I L E * f i l e p t r , c h a r f i l e i n p u t [ ] ) { / / / / R e t r i e v e s a s i n g l e w o r d f r o m t h e f i l e p o i n t e d t o b e * f i l e p t r a n d p l a c e s / / i t i n f i l e i n p u t [ ] . // c o n s t i n t T A B = 9 ; / / t h e A S C I I v a l u e f o r T A B c o n s t i n t L F = 1 0 ; / / t h e A S C I I v a l u e f o r L F c o n s t i n t S P = 3 2 ; / / t h e A S C I I v a l u e f o r S p a c e i n t i n d e x ; / / t h e n u m b e r o f c h a r a c t e r s r e a d f r o m t h e f i l e i n t a n y k e y ; / / u s e d f o r e r r o r c h e c k i n g i n t e n d l o o p = F A L S E ; / / i f == T R U E , t h e n e n d t h e w h i l e l o o p c h a r b l a n k S t r [ 1 3 ] = " " ; / / a b l a n k s t r i n g u s e d t o c l e a r f i l e i n p u t S P ) ) { i n d e x = 0 ; s t r c p y ( f i l e i n p u t , b l a n k S t r ) ; f i l e i n p u t [ i n d e x ] = g e t c ( f i l e p t r ) ; w h i l e ( e n d l o o p != T R U E ) { i f ( f i l e i n p u t [ i n d e x ] == E O F ) { / / T h i s i s e r r o r - c h e c k i n g c o d e / / p r i n t f ( " \ n \ n E n d o f F i l e r e a c h e d . ( F G e t W o r d ) . " ) ; / / p r i n t f ( " \ n i n d e x = % d " , i n d e x ) ; / / a n y k e y = g e t c h ( ) ; e n d l o o p = T R U E ; e l s e i f ( ( f i l e i n p u t [ i n d e x ] == T A B ) | | ( f i l e i n p u t [ i n d e x ] == } i f ( i n d e x == 0) { f i l e i n p u t [ i n d e x ] } e l s e { e n d l o o p = T R U E ; } } e l s e i f ( f i l e i n p u t [ i n d e x ] == i f ( i n d e x = = 0 ) { s t r c p y ( f i l e i n p u t , f i l e i n p u t [ i n d e x ] = } e l s e { e n d l o o p = T R U E ; } } e l s e { = g e t c ( f i l e p t r ) ; L F ) { b l a n k S t r ) ; : g e t c ( f i l e p t r ) ; 125 i n d e x + + ; f i l e i n p u t [ i n d e x ] = g e t c ( f i l e p t r ) ; } ) } / / F G e t W o r d v o i d C l o s e R e s u l t s ( i n t r u n U s e d ) { / / / / C l o s e s a l l t h e r e s u l t s f i l e s / / f p r i n t f ( s a v e L a t t i c e F i l e , " \ n \ n R u n U s e d : % d " , r u n U s e d ) ; f c l o s e ( r e s u l t s F i l e ) ; f c l o s e ( s a v e L a t t i c e F i l e ) ; } / / C l o s e R e s u l t s v o i d S e t U p R e s u l t s ( ) { / / / / O p e n s t h e r e s u l t s f i l e a n d s e t s i t u p f o r r e c o r d i n g d a t a / / i f ( ( r e s u l t s F i l e = f o p e n ( R E S U L T S _ F I L E , " w " ) ) == N U L L ) { p r i n t f ( " \ n \ n C a n 1 t o p e n r e s u l t s f i l e r e s c a 6 . t x t ! " ) ; e x i t ( 0 ) ; } f p r i n t f ( r e s u l t s F i l e , " R u n \ t I t e r a t i o n \ t M a z D e n \ t F u c D e n \ n " ) ; i f ( ( s a v e L a t t i c e F i l e = f o p e n ( S A V E _ L A T T I C E _ F I L E , " w " ) ) == N U L L ) { p r i n t f ( " \ n \ n C a n ' t o p e n r e s u l t s f i l e l a t t 7 d . t x t ! " ) ; e x i t ( 0 ) ; } f p r i n t f ( s a v e L a t t i c e F i l e , " L a t t i c e m a p s f r o m C A 7 d : D e t e r m i n i s t i c C A w i t h 3 s t a t e s . \ n " ) ; } / / S e t U p R e s u l t s v o i d S a v e R e s u l t s ( ) { / / / / S a v e s t h e r e s u l t s o f t h e c u r r e n t r u n t o a f i l e / / i n t r , c ; f p r i n t f ( r e s u l t s F i l e , " % d \ t % d \ t % d \ n " , c u r r R u n , d e n s i t y [ M ] , d e n s i t y [ F ] ) ; / / f p r i n t f ( s a v e L a t t i c e F i l e , " \ n \ n \ n " j ; / / f o r ( r = 1 ; r <= l a t t i c e R ; r++) { / / f o r ( c = 1 ; c <= l a t t i c e C ; C++) { / / f p r i n t f ( s a v e L a t t i c e F i l e , " % d \ t " , c u r r L a t t i c e [ r ] [ c ] ) ; / / ) / / f p r i n t f ( s a v e L a t t i c e F i l e , " \ n " ) ; / / ) ) / / S a v e R e s u l t s v o i d S a v e l t e r a t i o n () { / / / / S a v e s t h e r e s u l t s o f t h e c u r r e n t i t e r a t i o n t o a f i l e / / i n t r , c ; f p r i n t f ( r e s u l t s F i l e , " % d \ t % d \ t % d \ t % d \ n " , c u r r R u n , c u r r l t e r a t i o n , d e n s i t y f M ] , d e n s i t y f F ] ) ; / / f p r i n t f ( s a v e L a t t i c e F i l e , " \ n \ n \ n " ) ; / / f o r ( r = 1 ; r <= l a t t i c e R ; r++) { / / f o r ( c = 1 ; c <= l a t t i c e C ; C++) { / / f p r i n t f ( s a v e L a t t i c e F i l e , " % d \ t " , c u r r L a t t i c e [ r ] [ c ] ) ; / / } -/ / f p r i n t f ( s a v e L a t t i c e F i l e , " \ n " ) ; 126 // } } / / S a v e l t e r a t i o n < v o i d S a v e l t e r a t i o n L a t t i c e ( ) { II II S a v e s t h e r e s u l t s o f t h e c u r r e n t i t e r a t i o n t o a f i l e / / i n t r , c ; f p r i n t f ( s a v e L a t t i c e F i l e , " \ n \ n \ n " ) ; f o r ( r = 1 ; r <= l a t t i c e R ; r++) { . . . . . . f o r ( c = 1 ; c <= l a t t i c e C ; C + + ) { f p r i n t f ( s a v e L a t t i c e F i l e , " % d \ t " , c u r r L a t t i c e [ r ] [ c ] ) ; } f p r i n t f ( s a v e L a t t i c e F i l e , " \ n " ) ; } } / / S a v e l t e r a t i o n L a t t i c e / / . -/ / M o d e l s e t u p a n d i n i t i a l i z a t i o n F u c n t i o n s : • // v o i d G e t l n i t i a l C o n d i t i o n s ( ) { / / / / G e t s i n p u t f r o m t h e u s e r t o s p e c i f y t h e i n i t i a l c o n d i t i o n s o f t h e / / m o d e l s u c h a s , l a t t i c e C , l a t t i c e R , r u n s , a n d i t e r a t i o n s . // c h a r u s e r l n p u t [ 6 ] , y e s n o ; c l r s c r ( ) ; p r i n t f ( " S e t C A R u l e s : \ n \ n " ) ; p r i n t f ( " \ n S p e c i f y L a t t i c e T y p e (0 = r a n d o m ^ 1 = l o a d f r o m f i l e ) : " ) ; g e t s ( u s e r l n p u t ) ; l a t t i c e T y p e = a t o i ( u s e r l n p u t ) ; i f ( l a t t i c e T y p e == 0) { l a t t i c e C = 5 0 ; . . .. , l a t t i c e R = 5 0 ; } e l s e { l a t t i c e C = 2 0 ; l a t t i c e R = 2 0 ; } p r i n t f ( " \ n S p e c i f y T r e a t m e n t ( \ n \ t 0 = n o n e \ n \ t l = 2 0 x 2 0 c l e a r i n g \ n \ t 2 = r e m o v e a l l M a z a e l l a \ n \ t 3 = r e m o v e a l l F u c u s \ n \ t 4 = r e m o v e a l l P e l v e t i o p s i s : " ) ; g e t s ( u s e r l n p u t ) ; t r e a t m e n t T y p e = a t o i ( u s e r l n p u t ) ; / * p r i n t f ( " \ n \ n S p e c i f y L a t t i c e D i m e n s i o n s : \ n " ) ; p r i n t f ( " \ t X - d i m e n s i o n : " ) ; g e t s ( u s e r l n p u t ) ; l a t t i c e C = a t o i ( u s e r l n p u t ) ; p r i n t f ( " \ t Y - d i m e n s i o n : " ) ; g e t s ( u s e r l n p u t ) ; l a t t i c e R = a t o i ( u s e r l n p u t ) ; * / p r i n t f ( " \ n \ n N u m b e r o f M o d e l R u n s : " ) ; g e t s ( u s e r l n p u t ) ; r u n s = a t o i ( u s e r l n p u t ) ; p r i n t f ( " \ n \ n \ n D o y o u w i s h t o r u n t h e m o d e l ( y / n ) : " ) ; y e s n o = g e t c h e ( ) ; y e s n o = t o u p p e r ( y e s n o ) ; i f ( y e s n o == NO) { p r i n t f ( " \ n y o u s a i d N O ! " ) ; e x i t ( 0 ) ; } } / / G e t l n i t i a l C o n d i t i o n s 127 v o i d C o n v e r t - L a t t i c e () { / / / / C o n v e r t s t h e c u r r L a t t i c e f r o m c o n t a i n i n g a l l 14 p o s s i b l e s t a t e s t o / / c o n t a i n i n g 4 s t a t e s . A l l F u c u s L H s t a g e s a r e g i v e n t h e v a l u e F I a n d / / a l l P e l v e t i o p s i s L H s . t a g e s a r e g i v e n t h e v a l u e P I . // i n t r ; / / t h e c u r r e n t r o w o f t h e 2 0 x 2 0 a r r a y i n t h e f i l e i n t c ; / / t h e c u r r e n t c o l u m n o f t h e 2 0 x 2 0 a r r a y i n t h e f i l e f o r ( r = 1 ; r <= l a t t i c e C ; r++) { f o r ( c = 1 ; c <= l a t t i c e R ; C++) { s w i t c h . ( c u r r L a t t i c e [ r ] [ c ] ) { c a s e F I : c u r r L a t t i c e [ r ] [ c ] = F ; . b r e a k ; b r e a k ; b r e a k ; b r e a k ; b r e a k ; b r e a k ; b r e a k ; } } } / / C o n v e r t L a t t i c e c a s e F i r : c u r r L a t t i c e [ r ] [ c ] = F ; b r e a k ; c a s e F 2 : c u r r L a t t i c e [ r ] [ c ] = F ; c a s e F 2 r : c u r r L a t t i c e [ r ] [ c ] = F ; b r e a k ; c a s e F 3 : c u r r L a t t i c e [ r ] [ c ] = F ; c a s e F 3 r : c u r r L a t t i c e [ r ] [ c ] = F ; b r e a k ; c a s e P I : c u r r L a t t i c e [ r ] [ c ] = E M P T Y ; c a s e P l r : c u r r L a t t i c e [ r ] [ c ] = E M P T Y ; b r e a k ; c a s e P2 : c u r r L a t t i c e [ r ] [ c ] = E M P T Y ; c a s e P 2 r : c u r r L a t t i c e [ r ] [ c ] = E M P T Y ; b r e a k ; c a s e P 3 : c u r r L a t t i c e [ r ] [ c ] = E M P T Y ; c a s e P 3 r : c u r r L a t t i c e [ r ] [ c ] = E M P T Y ; b r e a k ; c a s e 1 3 : c u r r L a t t i c e [ r ] [ c ] = M ; d e f a u l t : b r e a k ; v o i d S e t U p L a t t i c e ( ) { / / / / C r e a t e s a L a t t i c e o f d i m e n s i o n s ( l a t t i c e C , l a t t i c e R ) / / i n t r n u m ; i n t r , c ; f o r ( r = 0 ; r <= l a t t i c e C + 1 ; r++) { f o r ( c = 0 ; c <= l a t t i c e R + 1 ; _ c + + ) { c u r r L a t t i c e [ r ] [ c ] = 0 ; } } i f ( l a t t i c e T y p e == 0) { f o r ( r = 1 ; r <= l a t t i c e C ; r++) { f o r ( c = 1 ; c <= l a t t i c e R ; C++) { r n u m = ( i n t ) 3 . 0 * R a n d N u m ( ) ; s w i t c h ( r n u m ) { c a s e 0 : c u r r L a t t i c e [ r ] [ c ] = E M P T Y ; b r e a k ; c a s e 1 : / / A L H - s t a g e o f F u c u s c u r r L a t t i c e [ r ] [ c ] = F ; b r e a k ; . c a s e 2 : c u r r L a t t i c e [ r ] [ c ] = M ; b r e a k ; 128 d e f a u l t : b r e a k ; } ) } ) e l s e { L o a d L a t t i c e ( ) ; C o n v e r t L a t t i c e ( ) ; } } / / S e t U p L a t t i c e // / / G r a p h i c s F u n c t i o n s : / / v o i d P l o t C e l l ( i n t r , i n t c , i n t s t a t e ) { / / / / G r a p h i c a l l y d i s p l a y s t h e s t a t e o f a c e l l . / / c i s t h e c u r r e n t c o l u m n o f t h e C A L a t t i c e / / r i s t h e c u r r e n t r o w o f t h e C A L a t t i c e i n t l e f t , t o p , r i g h t , b o t t o m ; / / t h e c o o r d i n a t e s o f t h e s q u a r e w h i c h // d e f i n e s t h e C A l a t t i c e c e l l c o n s t i n t c a W i n d o w T o p = 1 5 ; / / ( c a W i n d o w L e f t , c a W i n d o w T o p ) a r e t h e c o n s t i n t c a W i n d o w L e f t = 1 5 ; / / c o o r d i n a t e s f o r p o s i t i o n i n g t h e t o p - L H // c o r n e r o f t h e C A l a t t i c e o n t h e g r a p h i c s // o u t p u t . c o n s t i n t c e l l S i z e = 1 0 ; / / t h e s i z e i n p i x e l s o f t h e d i a m e t e r o f a s i n g l e / / C A l a t t i c e .. .. , c e l l . l e f t = c e l l S i z e * ( r - 1) + c a W i n d o w L e f t ; t o p = c e l l S i z e * ( c - 1) + c a W i n d o w T o p ; r i g h t = , l e f t + c e l l S i z e - 1 ; b o t t o m = t o p + c e l l S i z e - 1 ; s e t c o l o r ( c o l o u r l n d e x [ s t a t e ] ) ; s e t f i l l s t y l e ( S O L I D _ F I L L , c o l o u r l n d e x [ s t a t e ] ) ; / / r e c t a n g l e ( l e f t , t o p , r i g h t , b o t t o m ) ; b a r ( l e f t , t o p , r i g h t , b o t t o m ) ; } / / P l o t C e l l v o i d P l o t D e n s i t y ( i n t s t a t e D e r i , i n t s t a t e ) { / / / / G r a p h i c a l l y d i s p l a y s t h e d e n s i t y o f a s p e c i e s . / / ( n o t e : t h e x - a x i s o f t h e g r a p h i s 6 0 0 p e l s l o n g a n d t h e y - a x i s i s / / 2 0 0 p e l s h i g h . // i n t m o d i f i e d D e n ; / / t h e d e n s i t y w h i c h i s p l o t t e d o n t h e y - a x i s i n t m a x D e n s i t y ; / / t h e m a x i m u m d e n s i t y a s t a t e c a n a t t a i n i n t h e C A f l o a t d e n D i v i s o r ; / / a s c a l i n g p a r a m e t e r f o r p l o t t i n g t h e d e n s i t y o n / / t h e y - a x i s . c o n s t f l o a t y A x i s H e i g h t = 2 0 0 . 0 ; c o n s t f l o a t x A x i s L e n g t h = 6 0 0 . 0 ; i n t x , y ; / / t h e ( x , y ) c o o r i d i n a t e s o f t h e p i x e l t o p l o t m a x D e n s i t y = l a t t i c e C * l a t t i c e R ; .. .. , d e n D i v i s o r = ( f l o a t ) m a x D e n s i t y / y A x i s H e i g h t ; m o d i f i e d D e n = ( i n t ) ( ( f l o a t ) s t a t e D e n / d e n D i v i s o r ) ; i f ( i t e r a t i o n s > 6 0 0 ) { x = ( c u r r l t e r a t i o n / 2 ) + 1 4 ; } e l s e { x = c u r r l t e r a t i o n + 1 4 ; 129 } y = 4 5 0 - m o d i f i e d D e n ; . p u t p i x e l ( x , y , c o l o u r l n d e x [ s t a t e ] ) ; } / / P l o t D e n s i t y v o i d S e t U p G r a p h i c s ( ) { / / / / S e t s u p t h e g r a p h i c a l d i s p l a y a n d d r a w s t h e b a c k g r o u n d s c r e e n . / / i n t g d r i v e r = V G A ; i n t g m o d e = V G A H I ; i n t e r r o r c o d e ; e r r o r c o d e = r e g i s t e r f a r b g i d r i v e r ( E G A V G A _ d r i v e r _ f a r ) ; i f ( e r r o r c o d e < 0) { p r i n t f ( " \ n \ n G r a p h i c s e r r o r ! P r o b l e m r e g i s t e r i n g d r i v e r ! " ) ; e x i t (1) ; } i n i t g r a p h ( S g d r i v e r , S g m o d e , " d : W t c W b g i " ) ; D i s p l a y G r a p h i c s ( ) ; } / / S e t U p G r a p h i c s v o i d D i s p l a y G r a p h i c s ( ) { / / / / D r a w s t h e b a c k g r o u n d s c r e e n . // c l e a r v i e w p o r t ( ) ; s e t c o l o r ( L I G H T G R A Y ) ; r e c t a n g l e ( 1 4 , 1 4 , 2 1 5 , 2 1 5 ) ; l i n e ( 1 4 , 2 5 0 , 1 4 , 4 5 0 ) ; l i n e ( 1 5 , 4 5 0 , 6 1 5 , 4 5 0 ) ; s e t t e x t s t y l e ( S M A L L _ F O N T , H O R I Z _ D I R , 4 ) ; o u t t e x t x y ( 1 4 , 1 , " C A M O D E L L I N G K I T : C A 6 v l . 0 , c o p y r i g h t 1 9 9 6 , N i c k o l a s G r a b o v a c " ) ; o u t t e x t x y ( 2 9 5 , 4 5 5 , " I T E R A T I O N " ) ; s e t t e x t s t y l e ( S M A L L _ F O N T , V E R T _ D I R , 4 ) ; o u t t e x t x y ( l , 3 2 0 , " D E N S I T Y " ) ; g o t o x y ( 3 1 , 9 ) ; p r i n t f ( " L e g e n d : " ) ; g o t o x y ( 3 4 , 1 0 ) ; p r i n t f ( " F u c u s " ) ; s e t c o l o r ( c o l o u r l n d e x [ F ] ) ; r e c t a n g l e ( 2 4 5 , 1 4 5 , 2 5 5 , 1 5 5 ) ; / / g o t o x y ( 3 4 , 1 1 ) ; / / p r i n t f ( " P e l v e t i o p s i s " ) ; / / s e t c o l o r ( c o l o u r l n d e x [ P a l l ] ) ; / / r e c t a n g l e ( 2 4 5 , 1 6 1 , 2 5 5 , 1 7 1 ) ; g o t o x y ( 3 4 , 1 2 ) ; p r i n t f ( " M a z a e l l a " ) ; s e t c o l o r ( c o l o u r l n d e x [ M ] ) ; r e c t a n g l e ( 2 4 5 , 1 7 6 , 2 5 5 , 1 8 6 ) ; } / / D i s p l a y G r a p h i c s v o i d S h u t O f f G r a p h i c s () { / / / / C l o s e s t h e g r a p h i c a l d i s p l a y . / / c l o s e g r a p h ( ) ; } / / S h u t O f f G r a p h i c s ( ) v o i d S h o w R e s u l t s ( ) { / / / / D i s p l a y s t h e r e s u l t s g r a p h i c a l l y o n t h e s c r e e n // g o t o x y ( 3 1 , 2 ) ; p r i n t f ( " R u n : % d " , c u r r R u n ) ; g o t o x y ( 3 1 , 3 ) ; p r i n t f ( " I t e r a t i o n : % d " , c u r r l t e r a t i o n ) ; g o t o x y ( 3 1 , 5 ) ; p r i n t f ( " " ) ; g o t o x y ( 3 1 , 5 ) ; p r i n t f ( " T o t a l F u c u s D e n s i t y : % d " , d e n s i t y [ F ] ) ; g o t o x y ( 3 1 , 6 ) ; p r i n t f ( " " ) ; g o t o x y ( 3 1 , 6 ) ; p r i n t f ( " M a z a e l l a D e n s i t y : % d " , d e n s i t y [ M ] ) ; / / g o t o x y ( 3 1 , 7 ) ; / / p r i n t f ( " " ) ; / / g o t o x y ( 3 1 , 7 ) ; / / p r i n t f ( " T o t a l P e l v e t i o p s i s D e n s i t y : % d " , d e n s i t y [ P a l l ] ) ; P l o t D e n s i t y ( d e n s i t y [ F ] , F ) ; P l o t D e n s i t y ( d e n s i t y [ M ] , M ) ; / / P l o t D e n s i t y ( d e n s i t y [ P ] , P a l l ) ; } / / S h o w R e s u l t s // / / C A C a l c u l a t i n g F u n c t i o n s : I I . v o i d D o T r e a t m e n t ( ) { / / / / P e r f o r m s a t r e a t m e n t o n t h e l a t t i c e a c c o r d i n g t o t h e t r e a t m e n t T y p e : / / 0 = n o n e ; 1 = 2 0 x 2 0 c l e a r i n g ; 2 = r e m o v e a l l M a z a e l l a ; / / 3 = r e m o v e a l l F u c u s ; 4 = r e m o v e a l l P e l v e t i o p s i s ; II s w i t c h ( t r e a t m e n t T y p e ) { c a s e 0 : b r e a k ; c a s e 1 : i f ( c u r r l t e r a t i o n == 0) { M a k e C l e a r i n g ( ) ; ) b r e a k ; c a s e 2 : R e m o v e M a z ( ) ; b r e a k ; c a s e 3 : R e m o v e F u c ( ) ; b r e a k ; i d e f a u l t : b r e a k ; } } / / D o T r e a t m e n t v o i d M a k e C l e a r i n g ( ) { / / / / C r e a t e s a 2 0 x 2 0 c l e a r i n g i n t h e C A l a t t i c e , l o c a t e d r a n d o m l y w i t h i n / / t h e l a t t i c e . // c o n s t i n t c l e a r i n g S i z e X = 2 0 ; / / t h e s i z e o f t h e c l e a r i n g o n t h e a x i s c o n s t i n t c l e a r i n g S i z e Y = 2 0 ; / / t h e s i z e o f t h e c l e a r i n g o n t h e y -a x i s i n t c l e a r X ; / / t h e x - c o o r d o f t h e c l e a r i n g ( f r o m 1 t o c l e a r i n g S i z e ) i n t c l e a r Y ; / / t h e y - c o o r d o f t h e c l e a r i n g ( f r o m 1 t o c l e a r i n g S i i n t r , / / ( r , c ) i s t h e t o p l e f t h a n d c o r n e r o f t h e c l e a r i n g c ; i n t m i n R , / / t h e s m a l l e s t r t o l o c a t e t h e c l e a r i n g m a x R , / / t h e l a r g e s t r t o l o c a t e t h e c l e a r i n g m i n C , / / t h e s m a l l e s t c t o l o c a t e t h e c l e a r i n g m a x C ; / / t h e l a r g e s t c t o l o c a t e t h e c l e a r i n g f l o a t r n u m ; / / ' a r a n d o m n u m b e r f r o m 0 t o 1 131 m i n R = 1 ; m i n C = 1 ; m a x R = l a t t i c e C - c l e a r i n g S i z e X - 1 ; m a x C = l a t t i c e R - c l e a r i n g S i z e Y - 1 ; r n u m = R a n d N u m ( ) ; r = m i n R + ( i n t ) ( m a x R * r n u m ) ; r n u m = R a n d N u m ( ) ; c = m i n C + ( i n t ) ( m a x C * r n u m ) ; f o r ( c l e a r X = 0 ; c l e a r X < c l e a r i n g S i z e X ; c l e a r X + + ) { f o r ( c l e a r Y = 0 ; c l e a r Y < c l e a r i n g S i z e Y ; c l e a r Y + + ) { c u r r L a t t i c e [ r + c l e a r X ] [ c + c l e a r Y ] = E M P T Y ; } } ) / / e n d M a k e C l e a r i n g i n t C a l c D i s t u r b a n c e R a d i u s ( i n t s e a s o n ) { / / / / C a l c u l a t e s t h e s i z e o f t h e d i s t u r b a n c e ( r a d i u s ) b a s e d o n a P o i s s o n / / d i s t r i b u t i o n , w h e r e x = t h e s i z e o f t h e d i s t u r b a n c e ( d i s t S i z e ) a n d / / l a m b d a i s t h e d i s t u r b a n c e r a t e o r f r e q u e n c y ( d i s t u r b a n c e R a t e ) . / / T h e f u n c t i o n r e t u r n s t h e d i s t u r b a n c e r a d i u s ( d i s t R a d i u s ) . // c o n s t f l o a t e = 2 . 7 1 8 2 8 1 8 2 8 ; i n t d i s t S i z e ; / / t h e p o s s i b l e s i z e s o f t h e d i s t u r b a n c e , ( r a d i u s ) i n t d i s t R a d i u s ; / / t h e a c t u a l d i s t u r b a n c e s i z e ( r a d i u s ) u n s i g n e d l o n g i n t f a c t ; / / t h e f a c t o r i a l o f d i s t S i z e f l o a t p r o b D i s t S i z e [ 2 0 ] ; / / t h e p r o b a b i l i t y a d i s t u r b a n c e o f a g i v e n / / s i z e w i l l o c c u r . f l o a t c u m P r o b D i s t S i z e [ 2 0 ] ; / / t h e c u m u l a t i v e p r o b a b i l i t y a d i s t u r b a n c e o f / / a g i v e n s i z e w i l l o c c u r . f l o a t r n u m ; / / a r a n d o m n u m b e r b e t w e e n 0 . 0 a n d 1 . 0 ; f o r ( d i s t S i z e = • 0 ; d i s t S i z e <= m a x D i s t S i z e ; d i s t S i z e + + ) { f a c t = F a c t o r i a l ( d i s t S i z e ) ; p r o b D i s t S i z e [ d i s t S i z e ] = p o w ( e , - l * d i s t u r b a n c e R a t e ) * p o w ( d i s t u r b a n c e R a t e , d i s t S i z e ) / f a c t ; } f o r ( d i s t S i z e = 1 ; d i s t S i z e <= m a x D i s t S i z e ; d i s t S i z e + + ) { c u m P r o b D i s t S i z e [ d i s t S i z e ] = p r o b D i s t S i z e [ d i s t S i z e ] + p r o b D i s t S i z e [ d i s t S i z e - 1 ] ; } c u m P r o b D i s t S i z e [ 0 ] = p r o b D i s t S i z e [ 0 ] ; c u m P r o b D i s t S i z e [ m a x D i s t S i z e ] = 1 . 0 ; r n u m = R a n d N u m () ; i f ( r n u m > c u m P r o b D i s t S i z e [ 0 ] ) { f o r ( d i s t S i z e = 1 ; d i s t S i z e <= m a x D i s t S i z e ; d i s t S i z e + + ) { i f ( ( r n u m > c u m P r o b D i s t S i z e [ d i s t S i z e - 1 ] ) && < ( r n u m <= c u m P r o b D i s t S i z e [ d i s t S i z e ] ) ) { d i s t R a d i u s = d i s t S i z e ; d i s t S i z e = m a x D i s t S i z e ; } } } e l s e { d i s t R a d i u s = 0 ; ) r e t u r n d i s t R a d i u s ; } / / C a l c D i s t u r b a n c e R a d i u s v o i d D o D i s t u r b a n c e ( i n t s e a s o n ) { / / / / C r e a t e s a d i s t u r b a n c e i n t h e l a t t i c e b y s e t t i n g a r a n d o m l y l o c a t e d / / c i r c u l a r a r e a o f r a d i u s d i s t R a d i u s t o E M P T Y . / / s e a s o n i s t h e s e a s o n o f t h e c u r r e n t i t e r a t i o n o f t h e m o d e l . // i n t d i s t R a d i u s ; / / t h e s i z e ( r a d i u s ) o f t h e d i s t u r b a n c e i n t x ; / / t h e h o r i z o n t a l a s p e c t o f t h e d i s t u r b a n c e c i r c l e i n t y ; / / t h e v e r t i c a l a s p e c t o f t h e d i s t u r b a n c e c i r c l e i n t c e n t r e Y ; / / t h e y - c o o r d o f t h e c e n t r e o f t h e d i s t u r b a n c e , i n t c e n t r e X ; / / t h e x - c o o r d o f t h e c e n t r e o f t h e d i s t u r b a n c e f l o a t r n u m ; / / a r a n d o m n u m b e r b e t w e e n 0 a n d 1 . d i s t R a d i u s = C a l c D i s t u r b a n c e R a d i u s ( s e a s o n ) ; r n u m = R a n d N u m () ; c e n t r e Y = ( i n t ) ( l a t t i c e R * r n u m ) ; r n u m = R a n d N u m ( ) ; c e n t r e X = ( i n t ) ( l a t t i c e C * r n u m ) ; f o r ( y = c e n t r e Y - d i s t R a d i u s ; y <= c e n t r e Y + d i s t R a d i u s ; y++) { f o r ( x = c e n t r e X - d i s t R a d i u s + a b s ( c e n t r e Y - y ) ; x <= c e n t r e X + d i s t R a d i u s - a b s ( c e n t r e Y - y ) ; x++) { i f ( ( ( x <= l a t t i c e C ) && (x >= 1 ) ) & & ( ( y <= l a t t i c e R ) ( y >= 1 ) ) ) { c u r r L a t t i c e [ x ] [ y ] = E M P T Y ; } }' } } / / D o D i s t u r b a n c e u n s i g n e d l o n g i n t F a c t o r i a l ( i n t n ) { / / / / R e t u r n s t h e f a c t o r i a l o f a n i n t e g e r ( n ) . / / T h e m a x i m u m s i z e o f n ' i s 1 2 , o t h e r w i s e i t w i l l o v e r f l o w ! // i n t c o u n t e r ; / / a c o u n t e r t h a t g o e s f r o m 1 t o n . u n s i g n e d l o n g i n t f a c t o r i a l ; / / t h e f a c t o r i a l o f n f a c t o r i a l = 1 ; f o r ( c o u n t e r = 1 ; c o u n t e r <= n ; c o u n t e r + + ) { f a c t o r i a l = f a c t o r i a l * c o u n t e r ; } r e t u r n f a c t o r i a l ; } / / F a c t o r i a l v o i d R e m o v e M a z ( ) { . / / / / C h a n g e s t h e s t a t e o f a l l M a z a e l l a c e l l s t o E M P T Y / / i n t r ; / / t h e c u r r e n t r o w o f t h e L a t t i c e a r r a y i n t h e f i l e i n t c ; / / t h e c u r r e n t c o l u m n o f t h e L a t t i c e a r r a y i n t h e f i l e f o r ( r = 1 ; r . < = l a t t i c e C ; r++) { f o r ( c = 1 ; c <= l a t t i c e R ; C + + ) { i f ( c u r r L a t t i c e [ r ] [ c ] == M) { c u r r L a t t i c e [ r ] [ c ] = E M P T Y ; } } / / R e m o v e M a z v o i d R e m o v e F u c ( ) { / / / / C h a n g e s t h e s t a t e o f a l l F u c c e l l s t o E M P T Y / / 133 i n t r ; / / t h e c u r r e n t r o w o f t h e L a t t i c e a r r a y i n t h e f i l e i n t c ; / / t h e c u r r e n t c o l u m n o f t h e L a t t i c e a r r a y i n t h e f i l e f o r ( r = 1 ; r <= l a t t i c e C ; r++) { f o r ( c = 1 ; c <= l a t t i c e R ; C++) { i f ( c u r r L a t t i c e [ r ] [ c ] == F ) { c u r r L a t t i c e [ r ] [ c ] = E M P T Y ; ) } •} / / R e m o v e F u c i n t O d d ( i n t num) { / / / / R e t u r n s 1 ( T R U E ) i f n u m i s o d d , r e t u r n s 0 ( F A L S E ) i f n u m i s e v e n . / / d i v _ t d i v i d e N u m ; / / h o l d s t h e q u o t i e n t a n d r e m a i n d e r o f t h e d i v i s i o n i n t d i v R e s u l t ; / / t h e r e s u l t o f t h e d i v i s i o n , o d d o r e v e n c o n s t i n t t w o = 2 ; / / d i v i d e n u m b y t h i s t o s e e i f i t i s o d d c o n s t i n t o d d = 1 ; c o n s t i n t e v e n = 0 ; d i v i d e N u m = d i v ( n u m , t w o ) ; i f ( d i v i d e N u m . r e m = = 0 ) { d i v R e s u l t = e v e n ; ) e l s e { d i v R e s u l t = o d d ; • . , } r e t u r n d i v R e s u l t ; } / / O d d v o i d C a l c D e n s i t i e s () { / / / / C a l c u l a t e s t h e d e n s i t i e s o f M a z a e l l a , F u c u s a n d P e l v e t i o p s i s , / / a s w e l l a s t h e d e n s i t y o f b a r e r o c k , a f t e r e a c h i t e r a t i o n o f / / t h e m o d e l . / / i n t r , c ; i n t s t a t e ; / / a c o u n t e r f o r i n i t i a l i z a t i o n f o r . . n e x t l o o p f o r ( s t a t e = E M P T Y ; s t a t e <= M ; s t a t e + + ) { d e n s i t y [ s t a t e ] = 0 ; } f o r ( r = 1 ; r <= l a t t i c e C ; r++) { f o r ( c = 1 ; c <= l a t t i c e R ; C++) { s w i t c h ( c u r r L a t t i c e [ r ] [ c ] ) { c a s e E M P T Y : d e n s i t y [ E M P T Y ] + + ; P l o t C e l l ( r , c , E M P T Y ) ; b r e a k ; c a s e F : d e n s i t y [ F ] + + ; P l o t C e l l ( r , c , F ) ; b r e a k ; c a s e M : d e n s i t y [ M ] + + ; P l o t C e l l ( r , c , M ) ; b r e a k ; d e f a u l t : b r e a k ; } }' } } / / C a l c D e n s i t i e s v o i d C o p y L a t t i c e ( ) { // / / C o p i e s t h e c u r r L a t t i c e i n t o a n o t h e r a r r a y : p a s t L a t t i c e t o e n a b l e / / s i m u l t a n e o u s u p d a t e s i n t h e m o d e l . // i n t r , c ; f o r ( r = 1 ; r <= l a t t i c e C ; r++) { f o r ( c = 1 ; c <= l a t t i c e R ; C++) { p a s t L a t t i c e [ r ] [ c ] = c u r r L a t t i c e [ r ] [ c ] ; } } ) / / C o p y L a t t i c e v o i d D o O n e l t e r a t i o n ( ) { / / / / D o e s o n e i t e r a t i o n o f t h e m o d e l / / i n t r , c ; h a m m i n g D i s t = 0 ; f o r ( r = 1 ; r <= l a t t i c e C ; r++) { f o r ( c = 1 ; c <= l a t t i c e R ; C++) { C a l c u l a t e C e l l ( r , c ) ; ) ) ) / / D o O n e l t e r a t i o n v o i d C a l c u l a t e C e l l ( i n t r , i n t c ) { / / / / C a l c u l a t e s s i m u l t a n e o u s l y t h e s t a t e o f e v e r y c e l l i n t h e / / L a t t i c e b a s e d i t s c u r r e n t s t a t e a n d t h e s t a t e o f t h e c e l l s a r o u n d i t . II s w i t c h ( p a s t L a t t i c e [ r ] [ c ] ) { c a s e E M P T Y : B i r t h R u l e s ( r , c ) ; b r e a k ; c a s e F : F u c R u l e s ( F , r , c ) ; b r e a k ; c a s e M : M a z R u l e s ( r , c ) ; b r e a k ; d e f a u l t : b r e a k ; ) ) / / C a l c u l a t e C e l l v o i d B i r t h R u l e s ( i n t r , i n t c ) { / / / / D e t e r m i n e s w h e t h e r t h e E M P T Y c e l l w i l l c h a n g e s t a t e a n d i f s o , w h a t / / s t a t e i t w i l l c h a n g e i n t o . / / r i s t h e c u r r e n t r o w o f t h e L a t t i c e , c i s t h e c u r r e n t c o l u m n . / / i n t n u m N e i [ 3 ] ; / / t h e n u m b e r o f n e i g h b o u r s o f e a c h s t a t e t y p e f l o a t r n u m ; ' / / a r a n d o m n u m b e r f r o m 0 . 0 t o 1 . 0 i n t M b i r t h ; / / f l a g s t o d e t e r m i n e w h e t h e r o r n o t M o r F c a n i n t F b i r t h ; M b i r t h = F A L S E ; F b i r t h = F A L S E ; r n u m = R a n d N u m ( ) ; i f ( r n u m <= M A Z _ B I R T H _ P R O B ) { M b i r t h = T R U E ; } r n u m = R a n d N u m ( ) ; i f ( r n u m <= F U C _ B I R T H _ P R O B ) { F b i r t h = T R U E ; } . . . b o r n i f ( ( M b i r t h == T R U E ) && ( F b i r t h == T R U E ) ) { r n u m = R a n d N u m ( ) ; i f ( r n u m > 4 . 0 ) { c u r r L a t t i c e [ r ] [ c ] = M ; } e l s e { c u r r L a t t i c e [ r ] [ c ] = F ; } } e l s e i f ( M b i r t h == T R U E ) { c u r r L a t t i c e [ r ] [ c ] = M ; ) e l s e i f ( F b i r t h == T R U E ) { c u r r L a t t i c e [ r ] [ c ] = F ; } e l s e { ) } / / B i r t h R u l e s v o i d F u c R u l e s ( i n t L H s t a g e , i n t r , i n t c ) { / / / / D e t e r m i n e s w h e t h e r t h e F u c u s c e l l w i l l c h a n g e s t a t e a n d i f s o , w h a t / / s t a t e i t w i l l c h a n g e i n t o . ( i . e . G r o w t h , R e p r o d u c t i o n , o r D e a t h ) / / L H s t a g e i s t h e l i f e h i s t o r y s t a g e o f F u c u s i n t h e c e l l ( r , c ) . / / r i s t h e c u r r e n t r o w o f t h e L a t t i c e , c i s t h e c u r r e n t c o l u m n . // i n t n u m N e i - [ 3 ] ; / / t h e n u m b e r o f n e i g h b o u r s o f e a c h s t a t e t y p e f l o a t r n u m ; / / a r a n d o m n u m b e r f r o m 0 . 0 t o 1 . 0 r n u m = R a n d N u m ( ) ; i f ( r n u m <= F U C _ D E A T H _ P R O B ) { c u r r L a t t i c e [ r ] [ c ] = E M P T Y ; h a m m i n g D i s t + + ; } } / / F u c R u l e s v o i d M a z R u l e s ( i n t r , i n t c ) { / / / / D e t e r m i n e s w h e t h e r t h e c u r r e n t c e l l w i t h t h e s t a t e o f M w i l l s t a y a s / / o r b e c o m e E M P T Y , b a s e d o n t h e s t a t e s o f t h e s u r r o u n d i n g c e l l s . / / r i s t h e c u r r e n t r o w o f t h e L a t t i c e , c i s t h e c u r r e n t c o l u m n . // i n t n u m N e i [ 3 ] ; / / t h e n u m b e r o f n e i g h b o u r s o f e a c h s t a t e t y p e f l o a t r n u m ; / / a r a n d o m n u m b e r f r o m 0 . 0 t o 1 . 0 r n u m = R a n d N u m ( ) ; i f ( r n u m <= M A Z _ D E A T H _ P R O B ) { c u r r L a t t i c e [ r ] [ c ] = E M P T Y ; h a m m i n g D i s t + + ; } } / / M a z R u l e s v o i d G e t N e i g h b o u r s ( i n t r , i n t c , i n t n u m N e i [ ] ) { / / / / D e t e r m i n e s t h e n u m b e r o f n e i g h b o u r s o f e a c h s t a t e i n t h e v o n N e u m a n n / / n e i g h b o u r h o o d a r o u n d t h e c e l l w i t h p o s i t i o n r ( r o w # ) , c ( c o l u m n #) // i n t n r ; / / t h e r o w o f t h e v o n N e u m a n n e i g h b o u r h o o d i n t . n c ; / / t h e c o l u m n o f t h e v o n N e u m a n " n e i g h b o u r h o o d i n t i ; / / i n i t i a l i z a t i o n f o r . . n e x t c o u n t e r f o r ( i = E M P T Y ; i <= M„- i + + ) { / / i n i t i a l i z e n u m N e i t o 0 n u m N e i [ i ] = 0 ; } f o r ( n r = - 1 ; n r <= 1 ; n r + + ) { f o r ( n c = - 1 ; n c <= 1 ; nc++) { i f ( ( n r == 0) && ( n c ==0) )' { } e l s e { s w i t c h ( p a s t L a t t i c e [ r + n r ] [ c + n c ] ) { n u m N e i [ F ] + + ; b r e a k ; n u m N e i [ M ] + + ; b r e a k ; c a s e F : c a s e M : d e f a u l t : b r e a k ; } } / / G e t N e i g h b o u r s / / / / R a n d o m N u m b e r G e n e r a t i n g F u n c t i o n s : / / v o i d G e n e r a t e R a n d N u m s (') - { V / / / C r e a t e s a n a r r a y o f 1 0 0 0 r a n d o m n u m b e r s / / c o n s t i n t l e n = 1 0 0 0 ; s t r u c t d o s t i m e _ t t ; f l o a t s ' e e d l , s e e d 2 ; / / t h e n u m b e r o f r a n d o m n u m b e r s t o g e n e r a t e / / t h e c u r r e n t s y s t e m t i m e / / t h e s e e d s f o r t h e r a n d o m n u m b e r g e n e r a t o r _ d o s _ g e t t i m e ( & t ) ; s e e d l = ( f l o a t ) ( t . h s e c o n d + t . s e c o n d + t . h o u r ) ; s e e d 2 = ( f l o a t ) ( t . h s e c o n d + t . s e c o n d + t . m i n u t e ) r m a r i n ( s e e d l , s e e d 2 ) ; / / i n i t i a l i z e r a n d o m n u m b e r g e n e r a t o r r a n m a r ( r a n d o m N u m b e r s , l e n ) ; } / / G e n e r a t e R a n d N u m s / / g e n e r a t e a r a n d o m n u m b e r f l o a t R a n d N u m ( ) { / / / / R e t u r n s a r a n d o m n u m b e r b e t w e e n 0 . 0 a n d 1 . 0 / / c o n s t i n t M A X R A N D N U M S = 1 0 0 0 ; r a n d N u m C o u n t + + ; i f ( r a n d N u m C o u n t >= M A X R A N D N U M S ) { G e n e r a t e R a n d N u m s ( ) ; r a n d N u m C o u n t = 1 ; } r e t u r n r a n d o m N u m b e r s [ r a n d N u m C o u n t ] ; } / / R a n d N u m s t a t i c v o i d r m a r i n ( i n t i j , i n t k l ) { / * C T h i s i s t h e i n i t i a l i z a t i o n r o u t i n e f o r t h e r a n d o m n u m b e r g e n e r a t o r R A N M A R ( ) C N O T E : T h e s e e d v a r i a b l e s c a n h a v e v a l u e s b e t w e e n : 0 <= I J <= 3 1 3 2 8 C 0 <= K L <= 3 0 0 8 1 C T h e r a n d o m n u m b e r s e q u e n c e s c r e a t e d b y t h e s e t w o s e e d s a r e o f s u f f i c i e n t C l e n g t h t o c o m p l e t e a n e n t i r e c a l c u l a t i o n w i t h . F o r e x a m p l e , i f s v e r a l C d i f f e r e n t g r o u p s a r e w o r k i n g o n d i f f e r e n t p a r t s o f t h e s a m e c a l c u l a t i o n , C e a c h g r o u p c o u l d b e a s s i g n e d i t s o w n I J s e e d . T h i s w o u l d l e a v e e a c h g r o u p C w i t h 3 0 0 0 0 c h o i c e s f o r t h e s e c o n d s e e d . T h a t i s t o s a y , t h i s r a n d o m C n u m b e r g e n e r a t o r c a n c r e a t e 9 0 0 m i l l i o n d i f f e r e n t s u b s e q u e n c e s - - w i t h C e a c h s u b s e q u e n c e h a v i n g a l e n g t h o f a p p r o x i m a t e l y 1 0 ^ 3 0 . C C U s e I J = 1 8 0 2 & K L = 9 3 7 3 t o t e s t t h e r a n d o m n u m b e r g e n e r a t o r . T h e C s u b r o u t i n e R A N M A R s h o u l d b e u s e d t o g e n e r a t e 2 0 0 0 0 r a n d o m n u m b e r s . C T h e n d i s p l a y ' t h e n e x t s i x r a n d o m n u m b e r s g e n e r a t e d m u l t i p l i e d b y 4 0 9 6 * 4 0 9 6 C I f t h e r a n d o m n u m b e r g e n e r a t o r i s w o r k i n g p r o p e r l y , t h e r a n d o m n u m b e r s 137 C s h o u l d b e : C C 6 5 3 3 8 9 2 . 0 6 1 7 2 2 3 2 . 0 1 4 2 2 0 2 2 2 . 0 8 3 5 4 4 9 8 . 0 7 2 7 5 0 6 7 . 0 1 0 6 3 3 1 8 0 . 0 i n t i , j , k , 1 , i i , j j , m ; f l o a t s , t ; i f ( i j < 0 | | i j > 3 1 3 2 8 | | k l < 0 | | k l > 3 0 0 8 1 ) { p u t s ( " T h e f i r s t r a n d o m n u m b e r s e e d m u s t h a v e a v a l u e b e t w e e n 0 a n d 3 1 3 2 8 . " ) ; p u t s ( " T h e s e c o n d s e e d m u s t h a v e a v a l u e b e t w e e n 0 a n d 3 0 0 8 1 . " ) ; e x i t ( l ) ; i = ( i j / 1 7 7 ) % 1 7 7 + 2 ; j = i j % 1 7 7 + 2 ; k = ( k l / 1 6 9 ) % 1 7 8 + 1 ; 1 = k l % 1 6 9 ; f o r ( i i = l ; i i < = 9 7 ; i i + + ) { s' = 0 . 0 ; t = 0 . 5 ; f o r ( j j = l ; j j < = 2 4 ; j j + + ) { m = ( ( ( i * j ) % 1 7 9 ) * k ) % 1 7 9 ; i = j ; j = k ; k = m ; 1 = ( 5 3 * 1 + 1) % 1 6 9 ; i f ( ( l * m ) % 6 4 >= 3 2 ) s += t ; t *= 0 . 5 ; c = 3 6 2 4 3 6 . 0 / 1 6 7 7 7 2 1 6 . 0 ; c d = 7 6 5 4 3 2 1 . 0 / 1 6 7 7 7 2 1 6 . 0 ; c m = 1 6 7 7 7 2 1 3 . 0 / 1 6 7 7 7 2 1 6 . 0 ; i 9 7 = 9 7 ; j 97 = 3 3 ; t e s t = T R U E ; v o i d r a n m a r ( f l o a t r v e c [ ] , i n t l e n ) { / * l e n r a n d o m n u m b e r s a r e p l a c e d i n r v e c [ l . . l e n ] * / /* C T h i s i s t h e r a n d o m n u m b e r g e n e r a t o r p r o p o s e d b y G e o r g e M a r s a g l i a i n C F l o r i d a S t a t e U n i v e r s i t y R e p o r t : F S U - S C R I - 8 7 - 5 0 C I t w a s s l i g h t l y m o d i f i e d b y F . J a m e s t o p r o d u c e a n a r r a y o f p s e u d o r a n d o m C n u m b e r s . */ i n t i v e c ; f l o a t u n i ; i f ( t e s t = = F A L S E ) { p u t s ( " C a l l t h e i n i t r o u t i n e r m a r i n ( ) b e f o r e c a l l i n g r a n m a r ( ) . " ) ; e x i t (2 ) ; f o r ( i v e c = l ; i v e c < = l e n ; i v e c + + ) { u n i = u [ i 9 7 ] - u [ j 9 7 ] ; i f ( u n i < 0 . 0 ) u n i += 1 . 0 ; u [ i 9 7 ] = u n i ; i 9 7 — ; u [ i i ] = s ; i f ( i97==0) i 9 7 J 9 7 — ; i f (j97==0) j 97 9 7 ; 9 7 ; 138 c - = c d ; i f ( c < 0 . 0 ) c += c m ; u n i - = c ; i f ( u n i < 0 . 0 ) u n i += 1 . 0 ; r v e c [ i v e c ] = u n i ; // // // M a i n F u n c t i o n : v o i d m a i n ( i n t a r g c , c h a r * a r g v [ ] ) { / / / / T h e m a i n h a n d l i n g l o o p o f t h e m o d e l . / / a r g v [ l ] h o l d s t h e t r e a t m e n t - t y p e f o r t h e m o d e l : / / i = r e m o v e m a z z a e l l a / / f = r e m o v e f u c u s / / c = m a k e a 2 0 x 2 0 c l e a r i n g / / n = n o t r e a t m e n t // c o n s t i n t N O _ T R E A T M E N T = 0 ; c o n s t i n t M A K E _ C L E A R I N G = 1 ; c o n s t i n t R E M O V E _ M A Z = 2 ; c o n s t i n t R E M O V E _ F U C = 3 ; c o n s t i n t L O A D _ F R O M _ F I L E = 1 ; c o n s t i n t R A N D O M = 0 ; i n t r n u m ; i f ( a r g c < 2 ) { / / n o a r g u m e n t s g i v e n , t h e n g e t i n p u t f r o m u s e r G e t l n i t i a l C o n d i t i o n s ( ) ; } e l s e i f ( a r g c > 2) { p r i n t f ( " \ n \ n E R R 0 R : t o o m a n y c o m m a n d l i n e a r g u m e n t s ! \ n " } ; e x i t ( 1 ) ; } e l s e { s w i t c h ( * a r g v [ l ] ) { c a s e ' i ' : l a t t i c e T y p e = L O A D _ F R O M _ F I L E ; t r e a t m e n t T y p e = R E M O V E _ M A Z ; l a t t i c e R = 2 0 ; l a t t i c e C = 2 0 ; r u n s = 1 0 0 ; b r e a k ; c a s e ' £ ' : l a t t i c e T y p e = L O A D _ F R O M _ F I L E ; t r e a t m e n t T y p e = R E M O V E _ F U C ; l a t t i c e R = 2 0 ; l a t t i c e C = 2 0 ; r u n s = 1 0 0 ; b r e a k ; c a s e ' c ' : l a t t i c e T y p e = R A N D O M ; t r e a t m e n t T y p e = M A K E _ C L E A R I N G ; l a t t i c e R = 5 0 ; l a t t i c e C = 5 0 ; r u n s = 1 0 0 ; b r e a k ; c a s e ' n ' : l a t t i c e T y p e = L O A D _ F R O M _ F I L E ; t r e a t m e n t T y p e = N O _ T R E A T M E N T ; l a t t i c e R = 2 0 ; l a t t i c e C = 2 0 ; r u n s = 1 0 0 ; b r e a k ; d e f a u l t : b r e a k ; } } S e t U p G r a p h i c s ( ) ; S e t U p R e s u l t s ( ) ; r a n d N u m C o u n t = 1; 139 G e n e r a t e R a n d N u m s ( ) ; r n u m = 9 9 * ( ( i n t ) R a n d N u m ( ) ) + 1 ; f o r ( c u r r R u n = 1 ; c u r r R u n <= r u n s ; c u r r R u n + + ) { S e t U p L a t t i c e ( ) ; c u r r l t e r a t i o n = 0 ; D o T r e a t m e n t ( ) ; C a l c D e n s i t i e s ( ) ; S h o w R e s u l t s ( ) ; S a v e l t e r a t i o n ( ) ; • • f o r ( c u r r l t e r a t i o n = 1 ; c u r r l t e r a t i o n <= i t e r a t i o n s ; c u r r I t e r a t i o n + + ) { D o T r e a t m e n t ( ) ; C o p y L a t t i c e ( ) ; D o O n e l t e r a t i o n ( ) ; C a l c D e n s i t i e s () ; S h o w R e s u l t s ( ) ; S a v e l t e r a t i o n ( ) ; i f ( c u r r R u n == r n u m ) { S a v e l t e r a t i o n L a t t i c e ( ) ; } } / / S a v e R e s u l t s ( ) ; D i s p l a y G r a p h i c s ( ) ; ) C l o s e R e s u l t s ( r n u m ) ; S h u t O f f G r a p h i c s ( ) ; } / / M a i n 

Cite

Citation Scheme:

        

Citations by CSL (citeproc-js)

Usage Statistics

Share

Embed

Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                        
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            src="{[{embed.src}]}"
                            data-item="{[{embed.item}]}"
                            data-collection="{[{embed.collection}]}"
                            data-metadata="{[{embed.showMetadata}]}"
                            data-width="{[{embed.width}]}"
                            async >
                            </script>
                            </div>
                        
                    
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:
https://iiif.library.ubc.ca/presentation/dsp.831.1-0087919/manifest

Comment

Related Items