15490289 at sun.ac.za (Claassen, M, Mnr )
2014-08-04 00:31:52 UTC
Hello All,
I have browsed through several threads on the website but could not solve my problem:
I have three types of agents in my system:
1. Product Agent (Agent A)
2. Task Agent (Agent B)
3. Operational Agent (Agent C)
I use the Contract Net Protocol for communication by implementing new instances of ContractNetInitiator & ContractNetResponder classes withing behaviours.
The function of my Program:
Agent A negotiates with a Agent B for a service. If the Agent A accepts the service, then Agent B needs to negotiate with Agent C to perform a service. Once Agent C has completed the service/action, it must inform Agent B. Once Agent B has received the inform, it must then and only then send an inform to Agent A.
The problem:
I put add(ContractNetInitiator_AgentB_To_AgentC(.....)) in the handleAcceptProposal() function of the ContractNetResponder_AgentB_To_AgentA of AgentB (before it creates a reply (inform) to Agent A).
I understand perfectly that behaviours are scheduled and that each agent runs in its own thread.
Flow Diagram of what occurs:
Agent A: Agent B Agent C
ContractNetInitiator_AgentA_To_AgentB ContractNetResponder_AgentB_To_AgentA ContractNetResponder_AgentC_To_AgentB
prepareCfp() handleCfp() handleCfp()
handleAllResponses() handleAcceptProposal() handleAcceptProposal()
add(ContractNetInitiator_AgentB_To_AgentC())
handleInform()
handleRejectProposal() handleRejectProposal()
handleFailure()
ContractNetInitiator_AgentB_To_AgentC
prepareCfp()
handleAllResponses()
handleInform()
handleFailure()
Here is the (obvious) results of the messages (I have added a picture at end in case this text version come out unexpectedly)
Agent A --[CFP]--> AgentB AgentC
AgentA <--[PROPOSE]-- AgentB AgentC
AgentA --[ACCEPT-PROPOSAL]--> AgentB AgentC
AgentA <--[INFORM]-- AgentB AgentC
AgentA AgentB --[CFP]--> AgentC
AgentA AgentB <--[PROPOSE]-- AgentC
AgentA AgentB --[ACCEPT-PROPOSAL]--> AgentC
AgentA AgentB <--[INFORM]-- AgentC
I understand perfectly why this is so ....because behaviours are scheduled and Agents run in a single thread.
What I am trying to do is that Agent B must only send an inform back to Agent A once Agent C has completed its task and sent an inform back to Agent B:
Agent A --[CFP]--> AgentB AgentC
AgentA <--[PROPOSE]-- AgentB AgentC
AgentA --[ACCEPT-PROPOSAL]--> AgentB AgentC
AgentA AgentB --[CFP]--> AgentC
AgentA AgentB <--[PROPOSE]-- AgentC
AgentA AgentB --[ACCEPT-PROPOSAL]--> AgentC
AgentA AgentB <--[INFORM]-- AgentC
AgentA <--[INFORM]-- AgentB AgentC
I have tried a few things without success.
Hope my email was not too vague.
Any help from the experts would be appreciated.
Kind Regards,
Marius
[cid:image001.jpg at 01CFAF8C.3E35F700]
Best Regards,
Marius Claassen
Cell: +27 83 292 8935
M.Eng (Mechatronics)
Design & Mechatronics Division
Mechatronics, Automation and Design Research Group
Department of Mechanical and Mechatronic Engineering
Stellenbosch University, South Africa
http://engineer.sun.ac.za<http://www.sun.ac.za/>
[Description: 1][Description: 2]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jade.tilab.com/pipermail/jade-develop/attachments/20140804/c0842186/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 40262 bytes
Desc: image001.jpg
URL: <Loading Image...>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 24217 bytes
Desc: image002.png
URL: <Loading Image...>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.gif
Type: image/gif
Size: 2771 bytes
Desc: image003.gif
URL: <Loading Image...>
I have browsed through several threads on the website but could not solve my problem:
I have three types of agents in my system:
1. Product Agent (Agent A)
2. Task Agent (Agent B)
3. Operational Agent (Agent C)
I use the Contract Net Protocol for communication by implementing new instances of ContractNetInitiator & ContractNetResponder classes withing behaviours.
The function of my Program:
Agent A negotiates with a Agent B for a service. If the Agent A accepts the service, then Agent B needs to negotiate with Agent C to perform a service. Once Agent C has completed the service/action, it must inform Agent B. Once Agent B has received the inform, it must then and only then send an inform to Agent A.
The problem:
I put add(ContractNetInitiator_AgentB_To_AgentC(.....)) in the handleAcceptProposal() function of the ContractNetResponder_AgentB_To_AgentA of AgentB (before it creates a reply (inform) to Agent A).
I understand perfectly that behaviours are scheduled and that each agent runs in its own thread.
Flow Diagram of what occurs:
Agent A: Agent B Agent C
ContractNetInitiator_AgentA_To_AgentB ContractNetResponder_AgentB_To_AgentA ContractNetResponder_AgentC_To_AgentB
prepareCfp() handleCfp() handleCfp()
handleAllResponses() handleAcceptProposal() handleAcceptProposal()
add(ContractNetInitiator_AgentB_To_AgentC())
handleInform()
handleRejectProposal() handleRejectProposal()
handleFailure()
ContractNetInitiator_AgentB_To_AgentC
prepareCfp()
handleAllResponses()
handleInform()
handleFailure()
Here is the (obvious) results of the messages (I have added a picture at end in case this text version come out unexpectedly)
Agent A --[CFP]--> AgentB AgentC
AgentA <--[PROPOSE]-- AgentB AgentC
AgentA --[ACCEPT-PROPOSAL]--> AgentB AgentC
AgentA <--[INFORM]-- AgentB AgentC
AgentA AgentB --[CFP]--> AgentC
AgentA AgentB <--[PROPOSE]-- AgentC
AgentA AgentB --[ACCEPT-PROPOSAL]--> AgentC
AgentA AgentB <--[INFORM]-- AgentC
I understand perfectly why this is so ....because behaviours are scheduled and Agents run in a single thread.
What I am trying to do is that Agent B must only send an inform back to Agent A once Agent C has completed its task and sent an inform back to Agent B:
Agent A --[CFP]--> AgentB AgentC
AgentA <--[PROPOSE]-- AgentB AgentC
AgentA --[ACCEPT-PROPOSAL]--> AgentB AgentC
AgentA AgentB --[CFP]--> AgentC
AgentA AgentB <--[PROPOSE]-- AgentC
AgentA AgentB --[ACCEPT-PROPOSAL]--> AgentC
AgentA AgentB <--[INFORM]-- AgentC
AgentA <--[INFORM]-- AgentB AgentC
I have tried a few things without success.
Hope my email was not too vague.
Any help from the experts would be appreciated.
Kind Regards,
Marius
[cid:image001.jpg at 01CFAF8C.3E35F700]
Best Regards,
Marius Claassen
Cell: +27 83 292 8935
M.Eng (Mechatronics)
Design & Mechatronics Division
Mechatronics, Automation and Design Research Group
Department of Mechanical and Mechatronic Engineering
Stellenbosch University, South Africa
http://engineer.sun.ac.za<http://www.sun.ac.za/>
[Description: 1][Description: 2]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jade.tilab.com/pipermail/jade-develop/attachments/20140804/c0842186/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 40262 bytes
Desc: image001.jpg
URL: <Loading Image...>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 24217 bytes
Desc: image002.png
URL: <Loading Image...>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.gif
Type: image/gif
Size: 2771 bytes
Desc: image003.gif
URL: <Loading Image...>