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 AbstractUtilitySpace |
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() |
Action |
getLastReceivedAction() |
int |
getNumberOfParties() |
AgentID |
getPartyId() |
java.lang.Class<? extends MultilateralProtocol> |
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.
|
AbstractUtilitySpace |
getUtilitySpace()
Gets this agent's utility space.
|
double |
getUtilityWithDiscount(Bid bid)
Gets the time discounted utility for the given bid.
|
void |
init(AbstractUtilitySpace utilSpace,
Deadline dl,
TimeLineInfo tl,
long randomSeed,
AgentID agentId)
Initializes the party.
|
void |
receiveMessage(AgentID sender,
Action act)
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 AbstractUtilitySpace utilitySpace
public void init(AbstractUtilitySpace utilSpace, Deadline dl, TimeLineInfo tl, long randomSeed, AgentID agentId)
NegotiationParty
init
in interface NegotiationParty
utilSpace
- (a copy of/readonly version of) the
AbstractUtilitySpace
to be used for this session.dl
- The deadline used for this negotiation.tl
- The TimeLineInfo
about current session.randomSeed
- A random seed that can be used for creating "consistent
random" behaviour.agentId
- The agent's ID.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 AbstractUtilitySpace getUtilitySpace()
public TimeLineInfo getTimeLine()
public java.lang.String toString()
toString
in class java.lang.Object
public void receiveMessage(AgentID sender, Action act)
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).act
- The action performedpublic Action getLastReceivedAction()
Action
or null if nothing received yet.public int getNumberOfParties()
public final AgentID getPartyId()
public java.lang.String getDescription()
getDescription
in interface NegotiationParty
public java.lang.Class<? extends MultilateralProtocol> getProtocol()
NegotiationParty
getProtocol
in interface NegotiationParty
MultilateralProtocol
, usually
StackedAlternatingOffersProtocol
.