public interface NegotiationParty
AbstractNegotiationParty
to get
more support from the parent class. Parties can do multilateral negotiations.
Notice that 'multilateral' includes 'bilateral'.
Your implementation must adhere to the protocol that it specifies in
getProtocol()
. If it doesn't, it may be kicked from the negotiation
at runtime.
Implementors of this class must have a public no-argument constructor. In fact we recommend not to implement any constructor at all and do initialization in the init() call.
Immediately after construction of the class, the functiondsf
init(AbstractUtilitySpace, Deadline, TimeLineInfo, long, AgentID,PersistentDataContainer)
will be called.
The functions in this interface are implemented by competitors in a
competition of agents. All calls to the functions are sand-boxed in an
attempt to ensure the competition will follow the protocols (instead of
crashing). Sand-boxing attempts to protect the rest of the system for
out-of-memory, time-out, throws, and various types of SecurityManager
related issues (eg calling System.exit(int)
) that may occur inside
the implemented party.
The time limits are given below for each of the functions. Some functions are limited to a fixed time limit. Other functions are limited to a deadline as set in the actual settings for the negotiation. In that case, the deadline is a global deadline for which the entire negotiation session must be completed. If the deadline is round based, the session is also time-limited to 180 seconds.
Modifier and Type | Method and Description |
---|---|
Action |
chooseAction(java.util.List<java.lang.Class<? extends Action>> possibleActions)
When this function is called, it is expected that the Party chooses one
of the actions from the possible action list and returns an instance of
the chosen action.
|
java.lang.String |
getDescription() |
java.lang.Class<? extends MultilateralProtocol> |
getProtocol()
Get the protocol that this party supports.
|
void |
init(AbstractUtilitySpace utilSpace,
Deadline deadline,
TimeLineInfo timeline,
long randomSeed,
AgentID agentID,
PersistentDataContainer storage)
Initializes the party.
|
java.util.Map<java.lang.String,java.lang.String> |
negotiationEnded(Bid acceptedBid)
This is called to inform the agent that the negotiation has been ended.
|
void |
receiveMessage(AgentID sender,
Action action)
This method is called when another
NegotiationParty chose an
Action . |
void init(AbstractUtilitySpace utilSpace, Deadline deadline, TimeLineInfo timeline, long randomSeed, AgentID agentID, PersistentDataContainer storage)
utilSpace
- (a copy of/readonly version of) the
AbstractUtilitySpace
to be used for this session.deadline
- The deadline used for this negotiation.timeline
- The TimeLineInfo
about current session.randomSeed
- A random seed that can be used for creating "consistent
random" behaviour.agentID
- The agent's ID.storage
- storage space where the agent can store data that is
persistent over sessions. Depending on the run settings, each
[agentclass, profiles] tuple can have its own unique storage
that persists only during the run of a tournament. Between
sessions, this data is saved to disk to avoid memory issues
when other agents are running. If the storage is not empty,
this data is retrieved at the start of each session and saved
at the end of each session. The load is timeboxed by the
negotiation settings. The save time is limited to 1 second.
The programmer should ensure that storage is actually
serializable. This call is timeboxed by the negotiation
deadline settings.Action chooseAction(java.util.List<java.lang.Class<? extends Action>> possibleActions)
possibleActions
- List of all actions possible.Action
.void receiveMessage(AgentID sender, Action action)
NegotiationParty
chose an
Action
. This call is timeboxed by the negotiation deadline
settings.sender
- The initiator of the action.This is either the AgentID, or
null if the sender is not an agent (e.g., the protocol).action
- The action performedjava.lang.String getDescription()
java.lang.Class<? extends MultilateralProtocol> getProtocol()
MultilateralProtocol
, usually
StackedAlternatingOffersProtocol
. The call must finish
within 1 second.java.util.Map<java.lang.String,java.lang.String> negotiationEnded(Bid acceptedBid)
acceptedBid
- the final accepted bid, or null if no agreement was reached.Map
containing data to log for this agent. null is equal
to returning an empty HashMap. Typically, this info will be
logged by XmlWriteStream.write(String, java.util.Map)