-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainAgents.jl
54 lines (42 loc) · 1.29 KB
/
mainAgents.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""
A demographic-ABM simulation of the UK using Agents.jl package
"""
include("src/agentsjlspec.jl")
using Agents
const simPars, dataPars, pars = load_parameters()
# significant parameters
simPars.seed = 0; ParamTypes.seed!(simPars)
simPars.verbose = false
simPars.checkassumption = false
simPars.sleeptime = 0
pars.poppars.initialPop = 5000
const data = load_demography_data(dataPars)
space = DemographicMap("The United Kingdom")
model = DemographicABM(space,pars,simPars,data)
declare_inhabited_towns!(model)
declare_pyramid_population!(model) # pyramid population
@info "population size " * string(nagents(model))
Initialize.init!(model,AgentsModelInit();verify=false)
# Execute ...
debug_setup(simPars)
const pf = AlivePopulation()
# TODO move to Models?
function agent_steps!(person,model)
age_transition!(person, model, pf)
divorce!(person, model, pf)
work_transition!(person, model, pf)
social_transition!(person, model, pf)
nothing
end
function model_steps!(model)
model.t += simPars.dt
dodeaths!(model,pf)
do_assign_guardians!(model,pf)
dobirths!(model,FullPopulation())
domarriages!(model,pf)
nothing
end
#const adata = []
#const mdata = [currenttime]
@time run!(model,agent_steps!,model_steps!,12*100) #;adata,mdata) # run 10 year
@info currenttime(model)