Benjamin Lehman, ©2011
View Slide
Benjamin Lehman, ©2011Prepare yourselfagainstZombie epidemic
AgentBasedModel
MapNational Geographics, ©2011
map = Map.new(4, 4)
point = Point.newpoint_north = Point.newpoint.neighborhood[:north] = point_northpoint_north.neighborhood[:south] = point# ...
John DellAngelo, ©2013Agent
agent = Agent.new(age, start_point, stm)
agent.perceive# => {}
agent.act# => :walkagent.walk(:east)
agent.age# => 1
agent.commit# => ## @name=:susceptible, ...
State
state = State.new(:susceptible)state.define_possible_actions(->(agent) {[:walk, :stay, :fight].sample})
state.decide_action_for(agent)# => :walk
infected = State.new(:susceptible)state.add_transition(infected,->(state, agent) {true})
state.trigger_transition(agent)# => ## @name=:infected, ...
StateTransitionMachine
stm = StateTransitionMachine.new# create states:# - susceptible# - infected# - zombie# - dead# create transitions# set default initial state
SimulationLoop
steps = 100agents = create_the_agentssteps.times doagents.each do |agent|agent.act; agent.ageendagents.each { |agent| agent.commit }remove_the_deads(agents)end
Validation&Calibration
# validation# ==# functional test
# Calibration# f(x, y, z, ?) = a
Simulate&Prepare yourself
Live Demo
Outro
?toch_tochtoch/zombie_epidemic