public interface MultilateralProtocol
SessionManager
. There also exists an
MultilateralProtocolAdapter
which implements all the methods in this
interface with default values. *
For some examples on Alternating offer protocols, please refer to:
AlternatingOfferConsensusProtocol
StackedAlternatingOffersProtocol
AlternatingOfferMajorityVotingProtocol
For an example on Mediator protocols, please refer to:
MediatorProtocol
Modifier and Type | Method and Description |
---|---|
void |
afterSession(Session session,
java.util.List<NegotiationPartyInternal> parties)
This will get called just after ending the session.
|
void |
applyAction(Action action,
Session session)
Apply the action according to the protocol.
|
void |
beforeSession(Session session,
java.util.List<NegotiationPartyInternal> parties)
This will get called just before the session starts.
|
void |
endNegotiation()
Overwrites the rest of the protocol and sets the protocol state to finish
|
void |
endNegotiation(java.lang.String reason)
Overwrites the rest of the protocol and sets the protocol state to finish
|
java.util.Map<NegotiationPartyInternal,java.util.List<NegotiationPartyInternal>> |
getActionListeners(java.util.List<NegotiationPartyInternal> parties)
Get a map of parties that are listening to each other's response
|
Bid |
getCurrentAgreement(Session session,
java.util.List<NegotiationPartyInternal> parties)
This method should return the current agreement.
|
ExecutorWithTimeout |
getExecutor()
Gets the executor used to box actions that agents can influence.
|
int |
getNumberOfAgreeingParties(Session session,
java.util.List<NegotiationPartyInternal> parties)
Gets the number of parties that currently agree to the offer.
|
Round |
getRoundStructure(java.util.List<NegotiationPartyInternal> parties,
Session session)
Get the structure of the current round.
|
boolean |
isFinished(Session session,
java.util.List<NegotiationPartyInternal> parties)
Check if the protocol is done or still busy.
|
void |
setExecutor(ExecutorWithTimeout executor)
Sets the executor used to box actions that agents can influence.
|
Round getRoundStructure(java.util.List<NegotiationPartyInternal> parties, Session session)
NegotiationPartyInternal
and
the complete Session
which can be used to diversify the round
structure at some point during the session.parties
- The parties currently participatingsession
- The complete session historyvoid beforeSession(Session session, java.util.List<NegotiationPartyInternal> parties) throws NegotiationPartyTimeoutException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
session
- The session instance that will be used for the sessionparties
- The parties that will participate in the sessionNegotiationPartyTimeoutException
java.util.concurrent.ExecutionException
java.lang.InterruptedException
void afterSession(Session session, java.util.List<NegotiationPartyInternal> parties)
session
- The session instance that was used for the sessionparties
- The parties that participated in the sessionvoid applyAction(Action action, Session session)
action
- action to applysession
- the current state of this sessionboolean isFinished(Session session, java.util.List<NegotiationPartyInternal> parties)
SessionManager
will not start a new
Round
after the current one. It will however finish all the turns
described in the
getRoundStructure(java.util.List, negotiator.session.Session)
method.session
- the current state of this sessionjava.util.Map<NegotiationPartyInternal,java.util.List<NegotiationPartyInternal>> getActionListeners(java.util.List<NegotiationPartyInternal> parties)
parties
- The parties involved in the current negotiationNegotiationParty
that is
responding to a NegotiationParty.chooseAction(List)
event, and the value is a list of NegotiationParty
s that
are listening to that key party's response.Bid getCurrentAgreement(Session session, java.util.List<NegotiationPartyInternal> parties)
session
- The complete session history up to this pointparties
- The parties involved in the current negotiationint getNumberOfAgreeingParties(Session session, java.util.List<NegotiationPartyInternal> parties)
session
- the current state of this sessionparties
- The parties currently participatingvoid endNegotiation()
void endNegotiation(java.lang.String reason)
reason
- Optionally give a reason why the protocol is finished.ExecutorWithTimeout getExecutor()
void setExecutor(ExecutorWithTimeout executor)