36
A case study with Malaria Anopheles reproduction modeling using an Individual Based Model (IBM) framework soundtrack: http://www.youtube.com/watch?v=vgB1XYVxk6k

A case study with Malaria Anopheles reproduction modeling using an Individual Based Model (IBM) framework soundtrack:

Embed Size (px)

Citation preview

A case study with Malaria Anopheles reproduction modeling

using an Individual Based Model (IBM) framework

soundtrack: http://www.youtube.com/watch?v=vgB1XYVxk6k

2

Epischisto.org

• History• Projects

Definition of a Cellular Automaton

Cellular automaton A is a set of four objectsA = <G, Z, N, f>, where

• G – set of cells• Z – set of possible cells states• N – set, which describes cells neighborhood• f – transition function, rules of the automaton:

– Z|N|+1Z (for automaton, which has cells “with memory”)– Z|N|Z (for automaton, which has “memoryless” cells)

Cellular automata - generic models for complex systems

Definition of a Fuzzy Set Neighborhood of cell Ci,j is global SCA

Gi,j := {(Ck,l, ΥC i ,j, C k ,l) |for all Ck,l Є C, 0 ≤ Υ Ci,j, Ck,l

≤ 1}

C is a set of all cells in the CA.

ΥC i ,j, C k ,l represents an interaction

coefficient that controls all possible interactions between a cell Ci,j and its global neighborhood Gi,j.

A function of inter-cell distance and cell population density.

Two-Dimensional Grids

Cells that have a common edge with the involved are named as “main neighbors” of the cell (are showed with hatching)

The set of actual neighbors of the cell a, which can be found according to N, is denoted as N(a)

Definition of the Rings

Formally, if R(a, i) is a set of cells of i-th ring of cell a, then if N describes cells neighborhood as the set of its nearest neighbors, following formula will take place

Rings for Grid of …

Different rings are showed with hatching or color

Definition of the Metrics

Distance function D(a, b) for retrieving remoteness between cells a and b can be denoted as follows

It is proved that this function satisfies to all metrics properties

The notion of ring may be generalized for multi-dimensional grids and the distance function, given by last formula, will remain the same

9

Difference Between ABM & CA

• Cellular automata (CAs) are always homogeneous and uniformly densely populated on the grid (all cells are identical), whereas in ABM the agents are heterogeneous and do not necessarily occupy all spaces within the grid.

• CAs frequently won’t interact with agents outside their immediate ‘neighborhood’

10

Agent Based Modeling

• Computer simulation that represents individual actors in a dynamic social system.

• ‘Agents’ represent heterogeneous individuals who interact with each other and/or their environment based on set rules.

• From these interactions, macro-scale behaviors may emerge.

11

Agents

Agents have:· Internal data representations

(memory or state)· Means for modifying their internal

data representations (perceptions)· Means for modifying their

environment (behaviors)

Copyright © 2000 by Swarm Development Group

12

-2 1 11 -2 1

-1 1 -2

CA Diffusion Model with ‘Seeds’

Influence Level = -2

Indifference Point = 0SUM (Surrounding Squares) = 2(-2 ) + 5(1) –1 = 0

Therefore: cell remains negative

Excel-Example

13

Netlogo http://ccl.northwestern.edu/netlogo/

This particular cellular automaton is called the Parity Model. There is only one rule, which all the cells follow. The rule is that each cell looks at its four neighbours (the ones immediately to its left, right, above and below) and if an odd number of them (that is, 1 or 3) of them are 'on', it switches itself 'on'. If there are an even number 'on' (2 or 4), it switches itself off.

by Nigel Gilbert (Submitted: 9/15/2002 )

14

Ascapewww.brook.edu/dybdocroot/es/dynamics/models/ascape

In Ascape, agent objects exist within scapes; collections of agents such as arrays and lattices. These scapes are themselves agents, so that typical Ascape models are made up of "collections of collections" of agents. Ascape manages graphical views and collection of statistics for scapes and provides mechanisms for controlling and altering parameters for scape models.

15

Starlogo/Sugarscape http://education.mit.edu/starlogo/

StarLogo is a programmable modeling environment for exploring the workings of decentralized systems -- systems that are organized without an organizer, coordinated without a coordinator. With StarLogo, you can model (and gain insights into) many real-life phenomena, such as bird flocks, traffic jams, ant colonies, and market economies.

www.brook.edu/SUGARSCAPE

16

RePast/SugarscapeThe name RePast is an acronym for REcursive Porous Agent Simulation Toolkit. Our goal with RePast is to move beyond the representation of agents as discrete, self-contained entities in favor of a view of social actors as permeable, interleaved and mutually defining, with cascading and recombinant motives. We intend to support the modeling of belief systems, agents, organizations and institutions as recursive social constructions.

17

SWARM www.swarm.org/Swarm is a software package for multi-agent simulation of complex systems, originally developed at the Santa Fe Institute. Swarm is intended to be a useful tool for researchers in a variety of disciplines. The basic architecture of Swarm is the simulation of collections of concurrently interacting agents: with this architecture, we can implement a large variety of agent based models.

18

AgentSheets http://agentsheets.com/

AgentSheets is an authoring tool that allows non-programmers to create agents with behaviors and missions, teach agents to react to information and process it in personalized ways, and combine agents to create sophisticated interactive simulations and models. Our customers use AgentSheets to create interactive games, virtual worlds, training simulations, information gathering and personalizing agents, and other interactive content.

19

Why Python?http://www.levenez.com/lang/Timeline of General Purpose Programming

Languages…

2012 programming languages in progress…

20

Python…• Simple

– Python is a simple and minimalistic language in nature– Reading a good python program should be like reading English– Its Pseudo-code nature allows one to concentrate on the problem rather

than the language

• Easy to Learn• Free & Open source

– Freely distributed and Open source– Maintained by the Python community

• High Level Language –memory management• Portable – *runs on anything c code will

• PyCUDA - parallel programming using CUDA

http://www.python.org/

21

What is Parallel Programming?

SingleData Stream

MultipleData Stream

SingleInstructionStream

SISDuniprocessors

SIMDProcessor arrays

MultipleInstructionStream

MISDSystolic arrays

MIMDMultiprocessors

multicomputers

https://computing.llnl.gov/tutorials/parallel_comp/

22

A Framework for Megascale Agent Based Model Simulations on GPUhttp://jasss.soc.surrey.ac.uk/11/4/10.htmlJournal of Artificial Societies and Social Simulation vol. 11, no. 4 10

23

Installing Python, Packages, CUDA• NVIDIA hardware• Python

– packages• CUDA• Windows X Linux? Bill Gates!!!!

http://200.17.137.109:8081/xiscanoe/projeto/ibm-ca-project-mosimbio/python-for-scientific-computing

Malaria Vector - Life Cycle

[http://www.ocvcd.org]

Egg•2-3 days•2-3 weeks in colder climates

Larvae (four stages)•Min 4 days (1 day/stage)•7-14 days in four stages•9 days - typical

Pupa•2-4 weeks•“several weeks”

Young•5 minutes (0,003 day)

Adult•7-30 days

• Eckhooff Malaria Journal 2011, 10:303• S.J. de Almeida et al. Environmental Modeling & Software 25(2010), 1490-1507• Silver, John B. Mosquito Ecology – Field Sampling Methods. Springer, 3rd Edition, 2008.

Malaria Vector – life periods

26

Mosquito – individual as an object in Python• A python object

http://docs.python.org/reference/datamodel.html“Objects are Python’s abstraction for data. All data in a Python program is represented by objects or

by relations between objects. (In a sense, and in conformance to Von Neumann’s model of a “stored program computer,” code is also represented by objects.)”

• class mosquito: def __init__(self, sex, eggstate, stage, state, energy, fertility, positionX, positionY):

self.sex = sex #sex of the mosquito self.eggs = eggstate #level of development of eggs self.stage = stage #stage of life of the mosquito self.state = state #state of a mosquito self.energy = energy #energy level of the mosquito self.fertility = fertility #fertility of the mosquito self.positionX = positionX #coordinate X at the world self.positionY = positionY #coordinate Y at the world

27

Mosquito – IBM ParametersINDIVIDUAL• states_of_a_mosquito = 5 #Mosquito Status: 0- mating, 1- feeding, 2- digesting, 3- ovoposition

(females), 4- hatching (females)• stages_of_life_cycle = 5 #Mosquito Stage: 0- egg, 1- larva, 2- pupa, 3- young, 4- adult• energy_level_of_a_mosquito = 4 #Energy level: 0- no energy (dead), 1- low, 2- medium, 2- high, 3- full• sex_of_a_mosquito = 2 #Sex: 0- male, 1- female• fertility_of_a_mosquito = 2 #fertility: 0- sterile, 1- fertile• development_of_eggs_of_a_mosquito = 4 #Eggs: 0-no eggs (males), 1- incomplete, 2- in process, 3- complete• size_of_mosquito_population = 3500000 #total mosquitoes in the world

ENVIRONMENT• #states_of_a_human = 4 #SEIR: 0-susceptible, 1-exposed, 2-infected, 3-recovered• human_population = (500) #total humans in the world• time_to_simulate = 43200 # 1440 minutes in a day, 43200 minutes in a month, 518400 minutes in a

year...• n-dimensional world x,y,...

– tam_world_y = tam_world_y = 10• states_of_a_cell = 2 #water: 0-no water, 1-water• max_human_population_per_cell = (5) #max amount of humans in a cell of the world• max_animal_population_per_cell = (4) #max amount of animals in a cell of the world

28

Mosquito – IBM Parameters (cont.)• Days_between_feeds = 3 • Female_eggs_per_female_oviposition = 100 • Adult_life_expectancy = 10• Duration_of_immature = 4 • Temperature_of_cell = [12..34]

29

Mosquito – Functionalities • def grow_up(self) #birth … death• def feed(self) #adult state• def digest(self) #adult state• def mate(self) #adult state• def lay_eggs(self) #female no sterile state• def hatch(self) #eggs state

30

Computation of the individuals

N-dimensionalparameters of a cell

Cell of the world

Composition of the N-dimensional matrices of parameters

waterhuman

.

.

.animals

31

Works…

------------------- The World of the Mosquitoes ------------------- dimensional parameters: water, human, animal, indoor/outdoor [array([[1, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 1, 0, 1, 1, 0, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 0, 1, 0], [1, 1, 1, 1, 0, 0, 1, 1, 0, 0], [1, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 0, 1, 1, 1, 1], [1, 1, 0, 0, 1, 0, 0, 1, 1, 0], [0, 0, 1, 0, 1, 1, 1, 0, 0, 1], [0, 1, 1, 0, 0, 1, 0, 1, 1, 1], [0, 0, 1, 1, 0, 1, 0, 0, 1, 1]]), array([[3, 1, 2, 2, 4, 1, 4, 3, 3, 4], [3, 0, 4, 0, 1, 0, 0, 3, 4, 4], [0, 2, 2, 2, 4, 0, 0, 2, 1, 0], [0, 2, 0, 1, 2, 1, 1, 3, 4, 0], [3, 3, 4, 3, 4, 4, 2, 0, 4, 1], [4, 0, 0, 2, 3, 2, 0, 1, 2, 0], [2, 2, 0, 4, 3, 1, 2, 1, 1, 0], [3, 4, 1, 2, 4, 4, 1, 4, 4, 1], [3, 3, 4, 1, 4, 2, 2, 4, 4, 3], [3, 4, 0, 4, 1, 4, 0, 4, 0, 2]]), array([[1, 2, 2, 0, 2, 3, 0, 3, 0, 3],

2999961 : Hola! Yo soy un(a) mosquito joven y soy varon y fertile y estoy en la cell ( 6 , 3 ) del mundo de Jones!2999962 : Hola! Yo soy un(a) pupa y soy hembra y sterile y estoy en la cell ( 2 , 5 ) del mundo de Jones!2999963 : Hola! Yo soy un(a) egg y fertile y estoy en la cell ( 2 , 6 ) del mundo de Jones!2999964 : Hola! Yo soy un(a) egg y sterile y estoy en la cell ( 8 , 7 ) del mundo de Jones!2999965 : Hola! Yo soy un(a) mosquito adulto y soy hembra y fertile y estoy a poner ovos en la cell ( 9 , 9 ) del mundo de Jones!

32

Simulations

• Reproduction cycle:– Water and no water– Indoor and outdoor– Fertile and no fertile– Temperature varying– ??????? To talk to THEentomologist…

33

Comparing results…

WATER RESOURCES RESEARCH, VOL. 44, W12445, doi:10.1029/2008WR006917, 2008Hydrology of malaria: Model development and application to a Sahelian village

34

Some resultsComparing mosquito quantity (temperature varying in 0,5) simulated WithWATER RESOURCESRESEARCH, VOL. 44, W12445, doi:10.1029/2008WR006917, 2008

Do we need real experiment…?

35

GPU vs CPU running IBM´s simple problems

SpeedUp =

Exec time CPU--------------------- Exec time GPU

GPU 2Processors2.12 faster than CPU!In a SONY VAIO CORE i5NVIDIA GEFORCE

SpeedUp superlinear!! Pero…

0

0.5

1

1.5

2

2.5

3

20000 70000 120000 170000 220000 270000 320000 370000 420000 470000

Particle #

Sp

ee

du

p

Baseline 1CPU

OpenMP 1CPU

OpenMP 2CPU

36

Considerations

• CUDA is simple, cheap and easy! 2 months• Python is simple, free, easy 2 months• Environment configuration is complex • Mosquito behavior is more complex!