Skip to content

Commit

Permalink
Use a faster ordering for heap in EventQueueABM (#1067)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tortar authored Aug 12, 2024
1 parent 5d92e5c commit e3a79f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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.3"
version = "6.1.4"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
5 changes: 4 additions & 1 deletion src/core/model_event_queue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ function EventQueueABM(
events = SizedVector{length(events), Union{typeof.(events)...}}(events...)

# the queue stores pairs of (agent ID, event index) mapping them to their trigger time
queue = BinaryHeap(Base.By(last), Pair{Tuple{Int, Int}, Float64}[])
queue = BinaryHeap(
Base.By(last, DataStructures.FasterForward()),
Pair{Tuple{Int, Int}, Float64}[]
)

agent_types = is_sumtype(A) ? values(allvariants(A)) : union_types(A)

Expand Down

0 comments on commit e3a79f2

Please sign in to comment.