public class AutomatedAgent
extends java.lang.Object
AutomatedAgentThread
,
AutomatedAgentMessages
,
AutomatedAgentCommunication
,
AutomatedAgentsCore
,
AutomatedAgentType
Modifier and Type | Field and Description |
---|---|
AutomatedAgentGameTime |
m_gtStopNeg |
AutomatedAgentGameTime |
m_gtStopTurn |
static java.lang.String |
SIDE_A_NAME |
static java.lang.String |
SIDE_B_NAME |
Constructor and Description |
---|
AutomatedAgent() |
AutomatedAgent(java.lang.String sSide,
int nPortNum,
java.lang.String sName,
java.lang.String sId)
Initialize the Automated Agent
|
Modifier and Type | Method and Description |
---|---|
void |
calculateAgreement() |
void |
calculateNextTurnOffer() |
void |
calculateResponse(int nMessageType,
int[] CurrentAgreementIdx,
java.lang.String sOriginalMessage)
Decide regarding a received message
For example, decide whether to accept or reject it, or receiveMessage other agent's data
|
void |
endNegotiation()
Ends the negotiation.
|
java.lang.String |
formatMessage(int message,
java.lang.String sMessage) |
void |
generateId()
Generates a random id for the Automated Agent and saves it to m_sAgentId
|
java.lang.String |
getAgentId() |
java.lang.String |
getAgentName() |
java.lang.String |
getAgentSide() |
AutomatedAgentType |
getAgentType() |
int[] |
getAgreementIndices(java.lang.String sAgreementStr) |
java.lang.String |
getAgreementStr(int[] currentAgreementIdx) |
double |
getAgreementValue(int[] agreementIndices) |
java.lang.String |
getAutomatedAgentAgreement() |
java.lang.String |
getBestAgreementStr() |
double |
getBestAgreementValue() |
int |
getCurrentTurn()
Returns the current negotiation's turn
|
double |
getCurrentTurnAutomatedAgentValue() |
AutomatedAgentType |
getCurrentTurnSideAgentType(java.lang.String sideName,
int type) |
int |
getMaxTurns() |
int |
getMsgId() |
double |
getNextTurnAutomatedAgentOfferValue() |
double |
getNextTurnAutomatedAgentValue() |
AutomatedAgentType |
getNextTurnSideAgentType(java.lang.String sideName,
int type) |
java.lang.String |
getOpponentAgentId() |
double |
getOptingOutValue() |
int |
getPort() |
int[] |
getPreviousAcceptedAgreementsIndices() |
long |
getSecondsForTurn()
Get the number of seconds for each turn
return m_lSecondsForTurn - the number of seconds per turn
|
boolean |
getSendOfferFlag() |
double |
getStatusQuoValue() |
java.lang.String |
getSupportMediator() |
int |
getTotalAgreementsNum() |
int |
getTotalIssues() |
java.lang.String |
getWorstAgreementStr() |
double |
getWorstAgreementValue() |
void |
incrementCurrentTurn()
Increments the current turn
|
void |
incrementMsgId()
Increments the next message id.
|
void |
printMessageToServer(java.lang.String sMessage)
Used to send a message back to the server/opponent
|
void |
receivedMessage(java.lang.String sMessage)
Called by AutomatedAgentCommunication when a message is received from the server.
|
void |
saveAcceptedMsg(java.lang.String sMessage)
If an offer is accepted, need to save it for future
references and comparisons
|
void |
setAgentType(java.lang.String side,
int type) |
void |
setCurrentTurn(int nCurrentTurn)
Sets the current negotiation's turn
|
void |
setCurrentTurnAgreementString(java.lang.String agreementStr) |
void |
setCurrentTurnAutomatedAgentValue(double value) |
void |
setCurrentTurnOpponentSelectedValue(double agreementValue) |
void |
setHasOpponent(boolean bHasOpponent,
java.lang.String sOppId)
Sets whether the agent's opponent has registered yet
|
void |
setMaxTurns(int nMaxTurns) |
void |
setMsgId(int nMsgId)
Sets a new message id
|
void |
setNextTurnAgreementString(java.lang.String agreementStr) |
void |
setNextTurnAutomatedAgentSelectedValue(double agreementValue) |
void |
setNextTurnAutomatedAgentValue(double value) |
void |
setNextTurnOpponentSelectedValue(double agreementValue) |
void |
setNextTurnOpponentType(int type) |
void |
setOpponentAgentId(java.lang.String sOppId)
Sets the opponent's id
|
void |
setSecondsForTurn(long lSeconds)
Sets the number of seconds for each turn
|
void |
setSendOfferFlag(boolean flag) |
void |
updateAgreementsValues()
Update the agreement values when new turn begins
|
public static final java.lang.String SIDE_A_NAME
public static final java.lang.String SIDE_B_NAME
public AutomatedAgentGameTime m_gtStopTurn
public AutomatedAgentGameTime m_gtStopNeg
public AutomatedAgent()
public AutomatedAgent(java.lang.String sSide, int nPortNum, java.lang.String sName, java.lang.String sId)
sSide
- - the side of the Automated AgentnPortNum
- - the port number it connects tosName
- - the name of the Automated AgentsId
- - the id of the Automated Agentpublic AutomatedAgentType getAgentType()
public void setAgentType(java.lang.String side, int type)
public java.lang.String getAgentName()
public java.lang.String getAgentSide()
public java.lang.String getAgentId()
public void receivedMessage(java.lang.String sMessage)
sMessage
- - the received messageAutomatedAgentMessages
,
AutomatedAgentCommunication
public void printMessageToServer(java.lang.String sMessage)
sMessage
- - the sent messageAutomatedAgentMessages
,
AutomatedAgentCommunication
public void endNegotiation()
AutomatedAgentCommunication
public int getPort()
public void setHasOpponent(boolean bHasOpponent, java.lang.String sOppId)
bHasOpponent
- - whether there is an opponentsOppId
- - the id of the opponentpublic void setOpponentAgentId(java.lang.String sOppId)
sOppId
- - the opponent's idpublic java.lang.String getOpponentAgentId()
public void setSecondsForTurn(long lSeconds)
lSeconds
- - the number of secondspublic long getSecondsForTurn()
public java.lang.String getSupportMediator()
public int getMaxTurns()
public void setMaxTurns(int nMaxTurns)
nMaxTurns
- - max number of turns for the negotiationpublic int getCurrentTurn()
public void setCurrentTurn(int nCurrentTurn)
nCurrentTurn
- - the current turnpublic void incrementCurrentTurn()
public void calculateAgreement()
public void updateAgreementsValues()
public int getMsgId()
public void setMsgId(int nMsgId)
nMsgId
- - the new message idpublic void incrementMsgId()
AutomatedAgentCommunication#printMsg
public void generateId()
public int[] getAgreementIndices(java.lang.String sAgreementStr)
public void saveAcceptedMsg(java.lang.String sMessage)
sMessage
- - the accepted offerpublic void calculateResponse(int nMessageType, int[] CurrentAgreementIdx, java.lang.String sOriginalMessage)
nMessageType
- - message typeCurrentAgreementIdx
- - array of agreement indicespublic java.lang.String getAutomatedAgentAgreement()
public java.lang.String formatMessage(int message, java.lang.String sMessage)
public double getAgreementValue(int[] agreementIndices)
public int[] getPreviousAcceptedAgreementsIndices()
public void calculateNextTurnOffer()
public double getNextTurnAutomatedAgentOfferValue()
public AutomatedAgentType getNextTurnSideAgentType(java.lang.String sideName, int type)
public AutomatedAgentType getCurrentTurnSideAgentType(java.lang.String sideName, int type)
public double getNextTurnAutomatedAgentValue()
public double getCurrentTurnAutomatedAgentValue()
public void setNextTurnAutomatedAgentValue(double value)
public void setCurrentTurnAutomatedAgentValue(double value)
public void setNextTurnAutomatedAgentSelectedValue(double agreementValue)
public void setNextTurnOpponentSelectedValue(double agreementValue)
public void setCurrentTurnOpponentSelectedValue(double agreementValue)
public void setNextTurnAgreementString(java.lang.String agreementStr)
public void setCurrentTurnAgreementString(java.lang.String agreementStr)
public void setNextTurnOpponentType(int type)
public java.lang.String getAgreementStr(int[] currentAgreementIdx)
public java.lang.String getBestAgreementStr()
public double getBestAgreementValue()
public java.lang.String getWorstAgreementStr()
public double getWorstAgreementValue()
public double getStatusQuoValue()
public double getOptingOutValue()
public int getTotalAgreementsNum()
public int getTotalIssues()
public boolean getSendOfferFlag()
public void setSendOfferFlag(boolean flag)