|
34 | 34 | auto_assign!(complete_topology(3, tid=:custom), container) |
35 | 35 |
|
36 | 36 | activate(container) do |
37 | | - wait(send_message(c, StartCoordinatedDistributedOptimization(create_admm_start_with_target([2.0, 2.0, 3.0])), address(ca))) |
| 37 | + wait(send_message(c, StartCoordinatedDistributedOptimization(create_admm_start(create_admm_sharing_data([2.0, 2.0, 3.0]))), address(ca))) |
38 | 38 | wait(coord_role.task) |
39 | 39 | end |
40 | 40 |
|
|
70 | 70 | auto_assign!(complete_topology(3, tid=:custom), container) |
71 | 71 |
|
72 | 72 | activate(container) do |
73 | | - wait(send_message(c, StartCoordinatedDistributedOptimization(create_admm_start_with_target([0.2, 1, -2])), address(ca))) |
| 73 | + wait(send_message(c, StartCoordinatedDistributedOptimization(create_admm_start(create_admm_sharing_data([0.2, 1, -2]))), address(ca))) |
74 | 74 | wait(coord_role.task) |
75 | 75 | end |
76 | 76 |
|
@@ -106,13 +106,122 @@ end |
106 | 106 | auto_assign!(complete_topology(3, tid=:custom), container) |
107 | 107 |
|
108 | 108 | activate(container) do |
109 | | - wait(send_message(c, StartCoordinatedDistributedOptimization(create_admm_start_with_target([1.2, 1, -4])), address(ca))) |
| 109 | + wait(send_message(c, StartCoordinatedDistributedOptimization(create_admm_start(create_admm_sharing_data([1.2, 1, -4]))), address(ca))) |
110 | 110 | wait(coord_role.task) |
111 | 111 | end |
112 | 112 |
|
113 | | - @test isapprox(flex_actor.x, [0.1338046305205991, 0.6710353497283177, -1.3420877350612257], atol=1e-3) |
114 | | - @test isapprox(flex_actor2.x, [0.13380191440490008, 0.6710343387311162, -1.3420863674684713], atol=1e-3) |
115 | | - @test isapprox(flex_actor3.x, [1.1249597637572557, -1.079012246032314e-6, -1.1249611366933858], atol=1e-3) |
| 113 | + @test isapprox(flex_actor.x, [0.1551348309982447, 0.7764857848417002, -1.5529580879935843], atol=1e-3) |
| 114 | + @test isapprox(flex_actor2.x, [0.1551322355095896, 0.7764795912324005, -1.5529455908199763], atol=1e-3) |
| 115 | + @test isapprox(flex_actor3.x, [0.8928358745473691, -1.2344094570466974e-6, -0.8928393030645658], atol=1e-3) |
| 116 | + @test handle.got_it |
| 117 | + @test handle2.got_it |
| 118 | + @test handle3.got_it |
| 119 | +end |
| 120 | + |
| 121 | +@testset "TestFlexADMMAWithMang2" begin |
| 122 | + container = create_tcp_container("127.0.0.1", 5555) |
| 123 | + |
| 124 | + flex_actor = create_admm_flex_actor_one_to_many(10, [0.1, 0.5, -1]) |
| 125 | + flex_actor2 = create_admm_flex_actor_one_to_many(15, [0.1, 0.5, -1]) |
| 126 | + flex_actor3 = create_admm_flex_actor_one_to_many(10, [-1.0, 0.0, 1.0]) |
| 127 | + coordinator = create_sharing_target_distance_admm_coordinator() |
| 128 | + |
| 129 | + dor = DistributedOptimizationRole(flex_actor, tid=:custom) |
| 130 | + dor2 = DistributedOptimizationRole(flex_actor2, tid=:custom) |
| 131 | + dor3 = DistributedOptimizationRole(flex_actor3, tid=:custom) |
| 132 | + coord_role = CoordinatorRole(coordinator, tid=:custom, include_self=true) |
| 133 | + |
| 134 | + handle = HandleOptimizationResultRole() |
| 135 | + handle2 = HandleOptimizationResultRole() |
| 136 | + handle3 = HandleOptimizationResultRole() |
| 137 | + |
| 138 | + add_agent_composed_of(container, dor, handle) |
| 139 | + c = add_agent_composed_of(container, dor2, handle2) |
| 140 | + ca = add_agent_composed_of(container, coord_role, dor3, handle3) |
| 141 | + |
| 142 | + auto_assign!(complete_topology(3, tid=:custom), container) |
| 143 | + |
| 144 | + activate(container) do |
| 145 | + wait(send_message(c, StartCoordinatedDistributedOptimization(create_admm_start(create_admm_sharing_data([-4, 0, 6]))), address(ca))) |
| 146 | + wait(coord_role.task) |
| 147 | + end |
| 148 | + |
| 149 | + @test isapprox(flex_actor.x, [0, 0, 0], atol=1e-3) |
| 150 | + @test isapprox(flex_actor2.x, [0, 0, 0], atol=1e-3) |
| 151 | + @test isapprox(flex_actor3.x, [-5.6179147130732225, 0, 5.617914767964074], atol=1e-3) |
| 152 | + @test handle.got_it |
| 153 | + @test handle2.got_it |
| 154 | + @test handle3.got_it |
| 155 | +end |
| 156 | + |
| 157 | + |
| 158 | +@testset "TestFlexADMMAWithMangoPriosThird" begin |
| 159 | + container = create_tcp_container("127.0.0.1", 5555) |
| 160 | + |
| 161 | + flex_actor = create_admm_flex_actor_one_to_many(10, [0.1, 0.5, -1]) |
| 162 | + flex_actor2 = create_admm_flex_actor_one_to_many(15, [0.1, 0.5, -1]) |
| 163 | + flex_actor3 = create_admm_flex_actor_one_to_many(10, [-1.0, 0.0, 1.0]) |
| 164 | + coordinator = create_sharing_target_distance_admm_coordinator() |
| 165 | + |
| 166 | + dor = DistributedOptimizationRole(flex_actor, tid=:custom) |
| 167 | + dor2 = DistributedOptimizationRole(flex_actor2, tid=:custom) |
| 168 | + dor3 = DistributedOptimizationRole(flex_actor3, tid=:custom) |
| 169 | + coord_role = CoordinatorRole(coordinator, tid=:custom, include_self=true) |
| 170 | + |
| 171 | + handle = HandleOptimizationResultRole() |
| 172 | + handle2 = HandleOptimizationResultRole() |
| 173 | + handle3 = HandleOptimizationResultRole() |
| 174 | + |
| 175 | + add_agent_composed_of(container, dor, handle) |
| 176 | + c = add_agent_composed_of(container, dor2, handle2) |
| 177 | + ca = add_agent_composed_of(container, coord_role, dor3, handle3) |
| 178 | + |
| 179 | + auto_assign!(complete_topology(3, tid=:custom), container) |
| 180 | + |
| 181 | + activate(container) do |
| 182 | + wait(send_message(c, StartCoordinatedDistributedOptimization(create_admm_start(create_admm_sharing_data([-4, 0, 6], [1,1,5]))), address(ca))) |
| 183 | + wait(coord_role.task) |
| 184 | + end |
| 185 | + |
| 186 | + @test isapprox(flex_actor.x, [0.00018920502370025307, -6.385117748282918e-5, 0.0001192856645796826], atol=1e-3) |
| 187 | + @test isapprox(flex_actor2.x, [0.00018947342781542052, -6.398798323709664e-5, 0.00011955174808086514], atol=1e-3) |
| 188 | + @test isapprox(flex_actor3.x, [-6.024383392342817, -8.105452791414886e-7, 6.02438348197089], atol=1e-3) |
| 189 | + @test handle.got_it |
| 190 | + @test handle2.got_it |
| 191 | + @test handle3.got_it |
| 192 | +end |
| 193 | + |
| 194 | +@testset "TestFlexADMMAWithMangoPriosFirst" begin |
| 195 | + container = create_tcp_container("127.0.0.1", 5555) |
| 196 | + |
| 197 | + flex_actor = create_admm_flex_actor_one_to_many(10, [0.1, 0.5, -1]) |
| 198 | + flex_actor2 = create_admm_flex_actor_one_to_many(15, [0.1, 0.5, -1]) |
| 199 | + flex_actor3 = create_admm_flex_actor_one_to_many(10, [-1.0, 0.0, 1.0]) |
| 200 | + coordinator = create_sharing_target_distance_admm_coordinator() |
| 201 | + |
| 202 | + dor = DistributedOptimizationRole(flex_actor, tid=:custom) |
| 203 | + dor2 = DistributedOptimizationRole(flex_actor2, tid=:custom) |
| 204 | + dor3 = DistributedOptimizationRole(flex_actor3, tid=:custom) |
| 205 | + coord_role = CoordinatorRole(coordinator, tid=:custom, include_self=true) |
| 206 | + |
| 207 | + handle = HandleOptimizationResultRole() |
| 208 | + handle2 = HandleOptimizationResultRole() |
| 209 | + handle3 = HandleOptimizationResultRole() |
| 210 | + |
| 211 | + add_agent_composed_of(container, dor, handle) |
| 212 | + c = add_agent_composed_of(container, dor2, handle2) |
| 213 | + ca = add_agent_composed_of(container, coord_role, dor3, handle3) |
| 214 | + |
| 215 | + auto_assign!(complete_topology(3, tid=:custom), container) |
| 216 | + |
| 217 | + activate(container) do |
| 218 | + wait(send_message(c, StartCoordinatedDistributedOptimization(create_admm_start(create_admm_sharing_data([-4, 0, 6], [5,1,1]))), address(ca))) |
| 219 | + wait(coord_role.task) |
| 220 | + end |
| 221 | + |
| 222 | + @test isapprox(flex_actor.x, [0.00018920502370025307, -6.385117748282918e-5, 0.0001192856645796826], atol=1e-3) |
| 223 | + @test isapprox(flex_actor2.x, [0.00018947342781542052, -6.398798323709664e-5, 0.00011955174808086514], atol=1e-3) |
| 224 | + @test isapprox(flex_actor3.x, [-3.9830282351073403, -7.203077063324391e-7, 3.98302823714599], atol=1e-3) |
116 | 225 | @test handle.got_it |
117 | 226 | @test handle2.got_it |
118 | 227 | @test handle3.got_it |
|
0 commit comments