Class ContractNetProtocol
java.lang.Object
dev.agenor.runtime.dialogue.protocol.ContractNetProtocol
- All Implemented Interfaces:
Protocol
Contract Net Protocol for task delegation and negotiation.
Flow:
Initiator Participants
| |
|-------- CFP --------------->| (broadcast)
| |
|<------- PROPOSE/REFUSE -----|
|<------- PROPOSE/REFUSE -----|
| |
|-------- AGREE ------------->| (to winner)
|-------- REFUSE ------------>| (to others)
| |
|<------- INFORM/FAILURE -----|
| |
- Since:
- 0.5.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallowedPerformatives(ProtocolState state, boolean isInitiator) Gets the set of allowed performatives in a given state.getId()nextState(ProtocolState current, Performative received, boolean isInitiator) Computes the next state given a performative.booleansenderPerforms(Performative performative) Contract Net reverses the direction ofAGREE.
-
Field Details
-
ID
- See Also:
-
-
Constructor Details
-
ContractNetProtocol
public ContractNetProtocol()
-
-
Method Details
-
getId
-
getDisplayName
- Specified by:
getDisplayNamein interfaceProtocol- Returns:
- human-readable name for display
-
getInitialState
- Specified by:
getInitialStatein interfaceProtocol- Returns:
- the initial state when a conversation starts
-
nextState
Description copied from interface:ProtocolComputes the next state given a performative. -
senderPerforms
Contract Net reverses the direction ofAGREE.The initiator sends
CFPand laterAGREEto accept one proposal; the party that takes on the work is the participant in both cases. OnlyPROPOSE— a participant offering to do it — binds its own sender.- Specified by:
senderPerformsin interfaceProtocol- Parameters:
performative- the performative that creates the commitment- Returns:
truewhen the sender performs,falsewhen the receiver does
-
allowedPerformatives
Description copied from interface:ProtocolGets the set of allowed performatives in a given state.- Specified by:
allowedPerformativesin interfaceProtocol- Parameters:
state- the current stateisInitiator- true if this agent initiated the protocol- Returns:
- set of valid performatives
-