Skip to content

Commit 7635bcd

Browse files
committed
Adding simple averaging consensus.
1 parent 9bbca94 commit 7635bcd

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

src/DistributedResourceOptimization.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ include("algorithm/admm/flex_actor.jl")
1212
include("algorithm/admm/consensus_admm.jl")
1313
include("algorithm/admm/sharing_admm.jl")
1414

15+
include("algorithm/consensus/averaging.jl")
16+
include("algorithm/consensus/economic_dispatch.jl")
17+
1518
include("carrier/mango.jl")
1619
include("carrier/simple.jl")
1720

src/carrier/core.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export Carrier, send_to_other, reply_to_other, send_awaitable, schedule_using, others
1+
export Carrier, send_to_other, reply_to_other, send_awaitable, schedule_using, others, get_address
22

33
mutable struct EventWithValue
44
event::Base.Event
@@ -124,4 +124,8 @@ Returns a collection of participants in the given `carrier` excluding the partic
124124
"""
125125
function others(carrier::Carrier, participant_id::String)
126126
throw("NotImplemented")
127+
end
128+
129+
function get_address(carrier::Carrier)
130+
throw("NotImplemented")
127131
end

src/carrier/mango.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,8 @@ function others(carrier::MangoCarrier, participant_id::String)
144144
else
145145
return topology_neighbors(carrier.parent, tid=carrier.parent.tid)
146146
end
147+
end
148+
149+
function get_address(carrier::MangoCarrier)
150+
return address(carrier.parent)
147151
end

src/carrier/simple.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ function others(carrier::SimpleCarrier, id::String)
100100
return setdiff!(collect(range(1, length(carrier.container.actors))), [cid(carrier)])
101101
end
102102

103+
function get_address(carrier::SimpleCarrier)
104+
return cid(carrier)
105+
end
106+
103107
"""
104108
start_distributed_optimization(actors::Vector{<:DistributedAlgorithm}, start_message::Any)
105109

0 commit comments

Comments
 (0)