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(NegotiationInfo info)
Initializes the party, informing it of many negotiation details.
|
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 to inform the party that another
NegotiationParty chose an Action. |
protected abstract Agent getAgent()
public final void init(NegotiationInfo info)
NegotiationPartyinit in interface NegotiationPartyinfo - information about the negotiation that this party is part of.public final Action chooseAction(java.util.List<java.lang.Class<? extends Action>> possibleActions)
NegotiationPartychooseAction in interface NegotiationPartypossibleActions - List of all actions possible.Action.public final void receiveMessage(AgentID sender, Action action)
NegotiationPartyNegotiationParty chose an Action.receiveMessage in interface NegotiationPartysender - 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 NegotiationPartypublic final java.lang.Class<? extends MultilateralProtocol> getProtocol()
NegotiationPartygetProtocol in interface NegotiationPartyMultilateralProtocol, usually
StackedAlternatingOffersProtocol.public final java.util.Map<java.lang.String,java.lang.String> negotiationEnded(Bid acceptedBid)
NegotiationPartynegotiationEnded in interface NegotiationPartyacceptedBid - 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) to
an XML file.