public abstract class AgentAdapter extends java.lang.Object implements NegotiationParty
Agent
to the NegotiationParty
so that legacy agents
can be run in the new multiparty system. Notice that these agents could
handle only 1 opponent, and thus may behave weird if presented with more than
one opponent.
What is unusual (in the Java sense) is that Agent extends this, not the other
way round. This way, all old agents also become a NegotiationParty.Constructor and Description |
---|
AgentAdapter() |
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.
|
protected abstract Agent |
getAgent() |
java.lang.String |
getDescription()
This is a convenience wrapper so that we don't have to fix all old agent
descriptions (these used to be in the xml file)
|
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 . |
protected abstract Agent getAgent()
public final void init(AbstractUtilitySpace utilSpace, Deadline deadline, TimeLineInfo timeline, long randomSeed, AgentID agentID, PersistentDataContainer storage)
NegotiationParty
init
in interface NegotiationParty
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.public final Action chooseAction(java.util.List<java.lang.Class<? extends Action>> possibleActions)
NegotiationParty
chooseAction
in interface NegotiationParty
possibleActions
- List of all actions possible.Action
.public final void receiveMessage(AgentID sender, Action action)
NegotiationParty
NegotiationParty
chose an
Action
. This call is timeboxed by the negotiation deadline
settings.receiveMessage
in interface NegotiationParty
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 performedpublic java.lang.String getDescription()
getDescription
in interface NegotiationParty
public final java.lang.Class<? extends MultilateralProtocol> getProtocol()
NegotiationParty
getProtocol
in interface NegotiationParty
MultilateralProtocol
, usually
StackedAlternatingOffersProtocol
. The call must finish
within 1 second.public final java.util.Map<java.lang.String,java.lang.String> negotiationEnded(Bid acceptedBid)
NegotiationParty
negotiationEnded
in interface NegotiationParty
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)