Class ContractNetAdapter
java.lang.Object
com.tnsai.coordination.negotiation.adapter.ContractNetAdapter
- All Implemented Interfaces:
NegotiationProtocol
Adapter that wraps the existing
MultiRoundContractNet as a NegotiationProtocol.
Uses the first party as the manager and the rest as contractors.
- Since:
- 0.0.2
-
Constructor Summary
ConstructorsConstructorDescriptionDefault adapter with no proposal source.ContractNetAdapter(MultiRoundContractNet.ProposalRequester proposalRequester) Adapter wired to a real proposal source. -
Method Summary
Modifier and TypeMethodDescriptioncom.tnsai.annotations.Coordination.NegotiationTypegetType()Returns the negotiation type this protocol handles.negotiate(List<com.tnsai.agents.Agent> parties, NegotiationConfig config) Executes the negotiation between the given parties.
-
Constructor Details
-
ContractNetAdapter
public ContractNetAdapter()Default adapter with no proposal source.NegotiationExecutorregisters this so the CONTRACT_NET type resolves, butnegotiate(java.util.List<com.tnsai.agents.Agent>, com.tnsai.coordination.negotiation.NegotiationConfig)fails fast with a reason naming the missing input — contract-net cannot contact contractors on its own (TAN-5893). Wire a real source viaContractNetAdapter(MultiRoundContractNet.ProposalRequester).The fail-fast behaviour of this registration is new in 0.15.0: previously
negotiate(java.util.List<com.tnsai.agents.Agent>, com.tnsai.coordination.negotiation.NegotiationConfig)returned a fabricated contract. -
ContractNetAdapter
Adapter wired to a real proposal source.- Since:
- 0.15.0
-
-
Method Details
-
negotiate
Description copied from interface:NegotiationProtocolExecutes the negotiation between the given parties.- Specified by:
negotiatein interfaceNegotiationProtocol- Parameters:
parties- the agents participating in negotiationconfig- negotiation configuration- Returns:
- the negotiation outcome
-
getType
public com.tnsai.annotations.Coordination.NegotiationType getType()Description copied from interface:NegotiationProtocolReturns the negotiation type this protocol handles.- Specified by:
getTypein interfaceNegotiationProtocol- Returns:
- the supported negotiation type
-