|
|
@@ -185,8 +185,8 @@ function build_standalone_agents(top_model::CoupledDEVS; routing_tables=Dict{Int
|
|
|
path_to_id = Dict{String, Int}()
|
|
|
current_id = Ref(1)
|
|
|
|
|
|
- instantiate_tree!(top_model, string(top_model.name), path_to_id, agent_list, current_id, routing_tables)
|
|
|
-# @timeit Builder "Instantiate Tree" instantiate_tree!(top_model, string(top_model.name), path_to_id, agent_list, current_id, routing_tables)
|
|
|
+# instantiate_tree!(top_model, string(top_model.name), path_to_id, agent_list, current_id, routing_tables)
|
|
|
+ @timeit Builder "Instantiate Tree" instantiate_tree!(top_model, string(top_model.name), path_to_id, agent_list, current_id, routing_tables)
|
|
|
|
|
|
return agent_list, path_to_id
|
|
|
end
|
|
|
@@ -314,17 +314,17 @@ function build_routing_tables(couplings::Dict, agent_list)
|
|
|
end
|
|
|
|
|
|
function compile_devs(top_model::CoupledDEVS; logging::Union{Nothing, String}=nothing)
|
|
|
-# @timeit Builder "Compile DEVS" begin
|
|
|
- dummy_agents, path_to_id = build_standalone_agents(top_model)
|
|
|
-# @timeit Builder "Build Dummy Agents" dummy_agents, path_to_id = build_standalone_agents(top_model)
|
|
|
+ @timeit Builder "Compile DEVS" begin
|
|
|
+# dummy_agents, path_to_id = build_standalone_agents(top_model)
|
|
|
+ @timeit Builder "Build Dummy Agents" dummy_agents, path_to_id = build_standalone_agents(top_model)
|
|
|
|
|
|
# Resolve direct couplings using raw data (NO EventQueueABM creation!)$
|
|
|
- couplings = resolve_direct_couplings(top_model, path_to_id, dummy_agents)
|
|
|
- routing_tables = build_routing_tables(couplings, dummy_agents)
|
|
|
- final_agents, final_paths = build_standalone_agents(top_model; routing_tables=routing_tables)
|
|
|
-# @timeit Builder "Resolve Couplings" couplings = resolve_direct_couplings(top_model, path_to_id, dummy_agents)
|
|
|
-# @timeit Builder "Build Routing Tables" routing_tables = build_routing_tables(couplings, dummy_agents)
|
|
|
-# @timeit Builder "Build Final Agents" final_agents, final_paths = build_standalone_agents(top_model; routing_tables=routing_tables)
|
|
|
+# couplings = resolve_direct_couplings(top_model, path_to_id, dummy_agents)
|
|
|
+# routing_tables = build_routing_tables(couplings, dummy_agents)
|
|
|
+# final_agents, final_paths = build_standalone_agents(top_model; routing_tables=routing_tables)
|
|
|
+ @timeit Builder "Resolve Couplings" couplings = resolve_direct_couplings(top_model, path_to_id, dummy_agents)
|
|
|
+ @timeit Builder "Build Routing Tables" routing_tables = build_routing_tables(couplings, dummy_agents)
|
|
|
+ @timeit Builder "Build Final Agents" final_agents, final_paths = build_standalone_agents(top_model; routing_tables=routing_tables)
|
|
|
|
|
|
unique_types = unique(typeof(a) for a in final_agents)
|
|
|
AgentUnion = Union{unique_types...}
|
|
|
@@ -334,17 +334,17 @@ function compile_devs(top_model::CoupledDEVS; logging::Union{Nothing, String}=no
|
|
|
logging = logging,
|
|
|
path_to_id = final_paths
|
|
|
)
|
|
|
- final_model = EventQueueABM(AgentUnion, (UniversalEvent, ); properties = final_props, autogenerate_after_action = false)
|
|
|
-# @timeit Builder "Build Model" final_model = EventQueueABM(AgentUnion, (UniversalEvent, ); properties = final_props)
|
|
|
+# final_model = EventQueueABM(AgentUnion, (UniversalEvent, ); properties = final_props, autogenerate_after_action = false)
|
|
|
+ @timeit Builder "Build Model" final_model = EventQueueABM(AgentUnion, (UniversalEvent, ); properties = final_props)
|
|
|
|
|
|
typed_agents = Vector{AgentUnion}(final_agents)
|
|
|
for agent in typed_agents
|
|
|
- add_agent!(agent, final_model)
|
|
|
-# @timeit Builder "Agents.jl Add Agent" add_agent!(agent, final_model)
|
|
|
+# add_agent!(agent, final_model)
|
|
|
+ @timeit Builder "Agents.jl Add Agent" add_agent!(agent, final_model)
|
|
|
end
|
|
|
-# end
|
|
|
-# show(Builder)
|
|
|
-# println()
|
|
|
-# reset_timer!(Builder)
|
|
|
+ end
|
|
|
+ show(Builder)
|
|
|
+ println()
|
|
|
+ reset_timer!(Builder)
|
|
|
return final_model
|
|
|
end
|