diff --git a/Project.toml b/Project.toml index 82066bd857..f244e0561c 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Agents" uuid = "46ada45e-f475-11e8-01d0-f70cc89e6671" authors = ["George Datseris", "Tim DuBois", "Aayush Sabharwal", "Ali Vahdati", "Adriano Meligrana"] -version = "6.1.4" +version = "6.1.5" [deps] CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" @@ -10,8 +10,8 @@ DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" -DynamicSumTypes = "5fcdbb90-de43-509e-b9a6-c4d43f29cf26" Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6" +DynamicSumTypes = "5fcdbb90-de43-509e-b9a6-c4d43f29cf26" Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" LazyArtifacts = "4af54fe1-eca0-43a8-85a7-787d91b784e3" @@ -47,8 +47,8 @@ DataFrames = "0.21, 0.22, 1" DataStructures = "0.18" Distributed = "1" Distributions = "0.25" -DynamicSumTypes = "3" Downloads = "1" +DynamicSumTypes = "3" GraphMakie = "0.5" Graphs = "1.4" JLD2 = "0.4" diff --git a/src/core/model_event_queue.jl b/src/core/model_event_queue.jl index 1a4c2214c8..fd79785609 100644 --- a/src/core/model_event_queue.jl +++ b/src/core/model_event_queue.jl @@ -256,9 +256,11 @@ function add_event!(agent, model) # TODO: Study type stability of this function propensities_type[i] = p end # Then, select an event based on propensities - event_idx = events_type[sample_propensity(abmrng(model), propensities_type)] # The time to the event is generated from the selected event + # The time to the event is generated from the selected event + prop_idx = sample_propensity(abmrng(model), propensities_type) + event_idx = events_type[prop_idx] selected_event = events[event_idx] - selected_prop = propensities_type[event_idx] + selected_prop = propensities_type[prop_idx] t = selected_event.timing(agent, model, selected_prop) # we then propagate to the direct function add_event!(agent, event_idx, t, model)