Research Article
Modeling and Simulation of Complex Network Attributes on Coordinating Large Multiagent System
Algorithm 1
General process of agents’ communication decision.
(1) ApplicableTasks = , OwnTasks = , Holds = , Tokens = ; | (2) while (true) do | (3) for ( agent , ApplicableTasks) do | (4) if (Applicable()) then | (5) ApplicableTasks.append(); | (6) Tokens.append(CreateTokens()); | (7) end if | (8) Tokens.append(recvTokens()); | (9) end for | (10) for ( Tokens) do | (11) if ( is TaskTokens()) then | (12) if (GetCap() > .threshold) then | (13) if ( OwnTasks) then | (14) OwnTasks.append(); | (15) end if | (16) else | (17) SendToNeighbour(); | (18) end if | (19) else if ( is ResourceTokens()) then | (20) .threshold += ; | (21) if (GetNeed() > .threshold) then | (22) if ( Holds) then | (23) Holds.append(); | (24) end if | (25) else | (26) .threshold −= ; | (27) SendToNeighbour(Tokens); | (28) end if | (29) end if | (30) CheckExecution(OwnTasks, Holds); | (31) end for | (32) for ( OwnTasks) do | (33) if ( is complete) then | (34) OwnTask.remove(); | (35) for ( ChkUnneed(OwnTask, Holds)) do | (36) Hold.remove(); | (37) SendToNeighbour(CreateTokens()); | (38) end for | (39) end if | (40) end for | (41) end while |
|