@@ -2,6 +2,65 @@ using Mango
22using DistributedOptimization
33using Test
44
5+ @testset " TestFlexADMMWithMangoCarrier" begin
6+ container = create_tcp_container (" 127.0.0.1" , 5555 )
7+
8+ m = 2
9+ l = zeros (m)
10+ u = [6.0 , 4.0 ]
11+ C = [ 1.0 1.0 ;
12+ - 2 / 3 1.0 ;
13+ - 2 / 3 1.0 ]
14+ d = [10.0 ; 0.0 ; 0.0 ]
15+
16+ flex_actor = ADMMFlexActor (l, u, C, d)
17+ flex_actor2 = ADMMFlexActor (l, [3.0 ,2.0 ], C, [20.0 ;0.0 ;0.0 ])
18+ dor = DistributedOptimizationRole (flex_actor)
19+ dor2 = DistributedOptimizationRole (flex_actor2)
20+
21+ coordinator = ADMMFlexCoordinator ()
22+ coord_role = CoordinatorRole (coordinator)
23+
24+ add_agent_composed_of (container, dor)
25+ add_agent_composed_of (container, dor2)
26+ ca = add_agent_composed_of (container, coord_role)
27+
28+ auto_assign! (complete_topology (3 ), container)
29+
30+ activate (container) do
31+ send_message (container, StartCoordinatedDistributedOptimization ([1.0 , 2.0 ]), address (ca))
32+ end
33+
34+ @test flex_actor. x == [0.8076923071828561 , 0.5384616848406112 ]
35+ @test flex_actor2. x == [0.8076923071828561 , 0.5384616848406112 ]
36+ end
37+
38+
39+
40+ @testset " TestFlexADMMWithMangoCarrierConvCreate" begin
41+ container = create_tcp_container (" 127.0.0.1" , 5555 )
42+
43+ flex_actor = create_admm_flex_actor_one_to_many (10 , [0.6 , 0.4 ])
44+ flex_actor2 = create_admm_flex_actor_one_to_many (10 , [0.6 , 0.4 ])
45+ coordinator = ADMMFlexCoordinator ()
46+
47+ dor = DistributedOptimizationRole (flex_actor, tid= :custom )
48+ dor2 = DistributedOptimizationRole (flex_actor2, tid= :custom )
49+ coord_role = CoordinatorRole (coordinator, tid= :custom )
50+
51+ add_agent_composed_of (container, dor)
52+ add_agent_composed_of (container, dor2)
53+ ca = add_agent_composed_of (container, coord_role)
54+
55+ auto_assign! (complete_topology (3 , tid= :custom ), container)
56+
57+ activate (container) do
58+ send_message (container, StartCoordinatedDistributedOptimization ([1.0 , 2.0 ]), address (ca))
59+ end
60+
61+ @test result (flex_actor) == flex_actor. x == [0.807682990194497 , 0.5384948521038107 ]
62+ @test result (flex_actor2) == flex_actor2. x == [0.807682990194497 , 0.5384948521038107 ]
63+ end
564
665@role struct HandleOptimizationResultRole
766 got_it:: Bool = false
1776 flex_actor = create_admm_flex_actor_one_to_many (10 , [0.6 , 0.4 ])
1877 flex_actor2 = create_admm_flex_actor_one_to_many (10 , [0.6 , 0.4 ])
1978 flex_actor3 = create_admm_flex_actor_one_to_many (10 , [0.6 , 0.4 ])
20- coordinator = ADMMFlexCoordinator (T = [ 1.0 , 2.0 ] )
79+ coordinator = ADMMFlexCoordinator ()
2180
2281 dor = DistributedOptimizationRole (flex_actor, tid= :custom )
2382 dor2 = DistributedOptimizationRole (flex_actor2, tid= :custom )
3594 auto_assign! (complete_topology (3 , tid= :custom ), container)
3695
3796 activate (container) do
38- wait (send_message (c, StartCoordinatedDistributedOptimization (), address (ca)))
97+ wait (send_message (c, StartCoordinatedDistributedOptimization ([ 1.0 , 2.0 ] ), address (ca)))
3998 wait (coord_role. task)
4099 end
41100
0 commit comments