public interface MultilateralProtocol
The protocol is executed for example by the
SessionManager.
beforeSession(Session, List) should be called
and all agents should receive the actions accordingly.
getRoundStructure(List, Session) should be called to determine
the Round
Turn in the Round :
Turn.getParty() agent should be called with the specified
allowed actions.
getActionListeners(List) should be called to get a list of which
agents need to hear the picked action of this agent.
isFinished(Session, List) should be checked after the round is
complete to see if there are other rounds . If so, repeat
afterSession(Session, List)
should be called
| Modifier and Type | Method and Description |
|---|---|
void |
afterSession(Session session,
java.util.List<NegotiationParty> parties)
This will get called just after ending the session.
|
void |
applyAction(Action action,
Session session)
Apply the action according to the protocol.
|
java.util.Map<NegotiationParty,java.util.List<Action>> |
beforeSession(Session session,
java.util.List<NegotiationParty> parties)
Returns a list of Actions to be sent to
NegotiationParty.receiveMessage(AgentID, Action) . |
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<NegotiationParty,java.util.List<NegotiationParty>> |
getActionListeners(java.util.List<NegotiationParty> parties)
Get a map of parties that are listening to each other's response.
|
Bid |
getCurrentAgreement(Session session,
java.util.List<NegotiationParty> parties)
This method should return the current agreement.
|
int |
getNumberOfAgreeingParties(Session session,
java.util.List<NegotiationParty> parties)
Gets the number of parties that currently agree to the offer.
|
Round |
getRoundStructure(java.util.List<NegotiationParty> parties,
Session session)
Get the structure of the current round.
|
boolean |
isFinished(Session session,
java.util.List<NegotiationParty> parties)
Check if the protocol is done or still busy.
|
Round getRoundStructure(java.util.List<NegotiationParty> parties, Session session)
NegotiationParty 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 historyjava.util.Map<NegotiationParty,java.util.List<Action>> beforeSession(Session session, java.util.List<NegotiationParty> parties) throws NegotiationPartyTimeoutException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
NegotiationParty.receiveMessage(AgentID, Action) . This will get
called just before the session starts. If some initialization with needs
to be done by the protocol, it can be done here.session - The upcoming Sessionparties - The NegotiationPartys that will participate in the
sessionNegotiationPartyTimeoutExceptionjava.util.concurrent.ExecutionExceptionjava.lang.InterruptedExceptionvoid afterSession(Session session, java.util.List<NegotiationParty> parties)
NegotiationParty.negotiationEnded(Bid) as these are always
called by the SessionManager.session - The session instance that was used for the sessionparties - The parties that participated in the sessionvoid applyAction(Action action, Session session) throws ActionException
action - action to apply. The Agent ID in the action already has been
checked when this is called.session - the current state of this sessionActionException - if the proposed action is illegal according to the protocol.boolean isFinished(Session session, java.util.List<NegotiationParty> 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, genius.core.session.Session)
method.session - the current state of this sessionparties - all the parties involved in the negotiationjava.util.Map<NegotiationParty,java.util.List<NegotiationParty>> getActionListeners(java.util.List<NegotiationParty> parties)
DefaultMultilateralProtocol.listenToAll(List) and
DefaultMultilateralProtocol.listenToNone(List)parties - The parties involved in the current negotiationNegotiationParty that is
responding to a NegotiationParty.chooseAction(List)
event, and the value is a list of NegotiationPartys that
are listening to that key party's response.Bid getCurrentAgreement(Session session, java.util.List<NegotiationParty> parties)
session - The complete session history up to this pointparties - The parties involved in the current negotiationint getNumberOfAgreeingParties(Session session, java.util.List<NegotiationParty> 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.