RockyMountain 2015: Prepare yourself against Zombie epidemic

RockyMountain 2015: Prepare yourself against Zombie epidemic

The news is everywhere: some weird disease makes the dead walking. We do not know yet if it is highly contagious. What should we do? What we do everyday: writing code. We can develop an agent based model, simulate the disease, and hopefully find the best strategy to survive. We can code, we'll be prepared ... or not.

code: https://github.com/toch/zombie_epidemic

3f8fcddf7ab5d1bd90b0a0a9adfd6527?s=128

Christophe Philemotte

September 24, 2015
Tweet

Transcript

  1. None
  2. Christophe toch _toch

  3. Benjamin Lehman, ©2011

  4. Benjamin Lehman, ©2011 Prepare yourself against Zombie epidemic

  5. Agent Based Model

  6. None
  7. None
  8. None
  9. None
  10. None
  11. Agent Based Model

  12. Map National Geographics, ©2011

  13. map = Map.new(4, 4)

  14. point = Point.new point_north = Point.new point.neighborhood[:north] = point_north point_north.neighborhood[:south]

    = point # ...
  15. John DellAngelo, ©2013 Agent

  16. agent = Agent.new(age, start_point, stm)

  17. agent.perceive # => {}

  18. agent.act # => :walk agent.walk(:east)

  19. agent.age # => 1

  20. agent.commit # => #<ZombieEpidemic::State:... # @name=:susceptible, ...

  21. State

  22. state = State.new(:susceptible) state.define_possible_actions( ->(agent) { [:walk, :stay, :fight].sample }

    )
  23. state.decide_action_for(agent) # => :walk

  24. infected = State.new(:susceptible) state.add_transition( infected, ->(state, agent) { true }

    )
  25. state.trigger_transition(agent) # => #<ZombieEpidemic::State:... # @name=:infected, ...

  26. State Transition Machine

  27. stm = StateTransitionMachine.new # create states: # - susceptible #

    - infected # - zombie # - dead # create transitions # set default initial state
  28. Simulation Loop

  29. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  30. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  31. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  32. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  33. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  34. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  35. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  36. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  37. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  38. None
  39. Validation & Calibration

  40. # validation == integration test # # check: # -

    obvious case # - against theoretical model # - against real data
  41. # not everything known # so calibration: # # varying

    a few parameters # to get what you want
  42. Simulate & Prepare yourself

  43. None
  44. Outro

  45. ? toch _toch toch/zombie_epidemic