public abstract class AbstractNegotiationParty extends java.lang.Object implements NegotiationParty
NegotiationParty
interface. This basic
implementation sets up some common variables for you.Modifier and Type | Field and Description |
---|---|
protected Deadline |
deadlines
map of all deadlines set for this party.
|
protected java.util.Random |
rand
Random seed used by this party.
|
protected TimeLineInfo |
timeline
Time line used by the party if time deadline is set.
|
protected UtilitySpace |
utilitySpace
utility space used by this party (set in constructor).
|
Constructor and Description |
---|
AbstractNegotiationParty() |
Modifier and Type | Method and Description |
---|---|
protected Bid |
generateRandomBid()
Generates a random bid which will be generated using this.utilitySpace.
|
java.lang.String |
getDescription() |
int |
getNumberOfParties() |
AgentID |
getPartyId() |
java.lang.Class<? extends MultilateralProtocolAdapter> |
getProtocol()
Get the protocol that this party supports.
|
protected Value |
getRandomValue(Issue currentIssue)
Gets a random value for the given issue.
|
TimeLineInfo |
getTimeLine()
Gets this agent's time line.
|
double |
getUtility(Bid bid)
Gets the utility for the given bid.
|
UtilitySpace |
getUtilitySpace()
Gets this agent's utility space.
|
double |
getUtilityWithDiscount(Bid bid)
Gets the time discounted utility for the given bid.
|
void |
init(UtilitySpace utilSpace,
Deadline dl,
TimeLineInfo tl,
long randomSeed,
AgentID agentId)
This is the first call made to a NegotiationParty after its
instantiation.
|
void |
receiveMessage(AgentID sender,
Action arguments)
This method is called when another
NegotiationParty chose an
Action . |
java.lang.String |
toString()
Returns a human readable string representation of this party.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
chooseAction
protected TimeLineInfo timeline
protected Deadline deadlines
protected java.util.Random rand
protected UtilitySpace utilitySpace
public void init(UtilitySpace utilSpace, Deadline dl, TimeLineInfo tl, long randomSeed, AgentID agentId)
NegotiationParty
init
in interface NegotiationParty
utilSpace
- (a copy of/readonly version of) the UtilitySpace
to be
used for this session.tl
- The TimeLineInfo
about current session.agentId
- the AgentID
.protected Bid generateRandomBid()
protected Value getRandomValue(Issue currentIssue) throws java.lang.Exception
currentIssue
- The issue to generate a random value forjava.lang.Exception
- if the issues type is not Discrete, Real or Integer.public double getUtility(Bid bid)
bid
- The bid to get the utility forpublic double getUtilityWithDiscount(Bid bid)
bid
- The bid to get the utility forpublic final UtilitySpace getUtilitySpace()
public TimeLineInfo getTimeLine()
public java.lang.String toString()
toString
in class java.lang.Object
public void receiveMessage(AgentID sender, Action arguments)
NegotiationParty
NegotiationParty
chose an
Action
.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).arguments
- The action performedpublic int getNumberOfParties()
public AgentID getPartyId()
public java.lang.String getDescription()
getDescription
in interface NegotiationParty
public java.lang.Class<? extends MultilateralProtocolAdapter> getProtocol()
NegotiationParty
getProtocol
in interface NegotiationParty
MultilateralProtocol
, usually
StackedAlternatingOffersProtocol
.