The IBM model

Download Model
Download the .scn, .sel and .lse files by clicking on the following link:

Model Code Exploration
In the following sections we will examine all of the model files for this model. Note that instead of downloading the zip file above, you could just copy the text in the boxes below into a text editor and save it with the appropriate name (Section title). Opening the resulting .scn file in the SELES simulator would run this model.

Consume.scn
Seles Scenario Model.sel SimPriority Low Priority

Model.sel
Seles Model Time Units: Step kiloStep 1000 1000 Landscape Events: Producer.lse DEBUG Consumer.lse DEBUG Spatial Variables: LSState[3] Legends: LSStateTypes = {0:Uncolonised, 1:Producer, 2:Consumer} Global Variables: pInitialProducer = 0.01 pInitialConsumer = 0.01 pSpreadProducer = 0.1 pSpreadConsumer = 0.2 pDeathProducer = 0.01 pDeathConsumer = 0.05 Output Frequency: 1

consumer.lse
// Process based definition for consumber behaviour in producer/consumer model LSAGENT: Consumer DEFINITIONS LAYER: LSState GLOBAL CONSTANT: Uncolonised, Producer, Consumer GLOBAL VARIABLE: pInitialConsumer, pSpreadConsumer, pDeathConsumer //, SpreadRateConsumer AGENT VARIABLE: isSedentary ENDDEF // Just immigrate once IMMIGRATIONTIME = 0 NUMAGENTS = NUMCELLS * pInitialConsumer // Initialize in an empty cell PROBINIT PROBINIT = LSState EQ Uncolonised LSState = Consumer isSedentary = TRUE ENDPI TRANSITIONS // Decide if this cell survives Dies = UNIFORM(0,1) < pDeathConsumer // If the consumer is dying IF Dies LSState = Uncolonised ENDFN TRANSITIONS = !Dies ENDTR POPULATIONTIME = 1 MOVELOCATION d = IF isSedentary THEN 0 ELSE 1 REGION CENTRED(d, d, WRAPPED) ENDML MOVEPROB // Parent stays in place and offspring must move to producer neighbour MOVEPROB = IF isSedentary THEN 1 ELSE LSState EQ Producer isSedentary = TRUE LSState = Consumer ENDMP NUMOFFSPRING n = 0 OVER REGION CENTRED(1,1,WRAPPED) DECISION LSState EQ Uncolonised n = n + (UNIFORM(0,1) < pSpreadConsumer) ENDFN NUMOFFSPRING = n  isSedentary = FALSE ENDNO

producer.lse
// Agent based definiton of producer behaviour in producer/consumer model LSAGENT: Producer DEFINITIONS LAYER: LSState GLOBAL CONSTANT: Uncolonised, Producer, Consumer GLOBAL VARIABLE: pInitialProducer, pSpreadProducer, pDeathProducer AGENT VARIABLE: isSedentary ENDDEF // Just immigrate once IMMIGRATIONTIME = 0 NUMAGENTS = NUMCELLS * pInitialProducer // Initialize in an empty cell PROBINIT PROBINIT = LSState EQ Uncolonised LSState = Producer isSedentary = TRUE ENDPI TRANSITIONS // Decide if this cell survives Dies = (UNIFORM(0,1) < pDeathProducer) OR (LSState NEQ Producer) // If the producer is dying IF Dies LSState = Uncolonised ENDFN TRANSITIONS = (!Dies) ENDTR POPULATIONTIME = 1 MOVELOCATION d = IF isSedentary THEN 0 ELSE 1 REGION CENTRED(d, d, WRAPPED) ENDML MOVEPROB // Parent stays in place and offspring must move to unoccupied neighbour MOVEPROB = IF isSedentary THEN 1 ELSE LSState EQ Uncolonised isSedentary = TRUE LSState = Producer ENDMP NUMOFFSPRING n = 0 OVER REGION CENTRED(1,1,WRAPPED) DECISION LSState EQ Uncolonised n = n + (UNIFORM(0,1) < pSpreadProducer) ENDFN NUMOFFSPRING = n  isSedentary = FALSE ENDNO

Suggested Experiments
To explore this cellular automata model further, try the following: