public class QOAgent
extends java.lang.Object
QOAgentThread
,
QMessages
,
QCommunication
,
QAgentsCore
,
QAgentType
Modifier and Type | Field and Description |
---|---|
QGameTime |
m_gtStopNeg |
QGameTime |
m_gtStopTurn |
static java.lang.String |
NOT_APPLICABLE_STR1 |
Constructor and Description |
---|
QOAgent(QOAgent pAgent,
boolean bIsEquilibriumAgent,
java.lang.String sSide,
java.lang.String sSupportMediator,
java.lang.String sName,
java.lang.String sId) |
QOAgent(QOAgent pAgent,
java.lang.String sSide,
java.lang.String sSupportMediator,
java.lang.String sName,
java.lang.String sId)
Initialize the QOAgent
|
Modifier and Type | Method and Description |
---|---|
void |
calculateEquilibriumResponse(int nMessageType,
int[] CurrentAgreementIdx,
java.lang.String sOriginalMessage) |
void |
calculateFirstOffer() |
void |
calculateResponse(int nMessageType,
int[] CurrentAgreementIdx,
java.lang.String sOriginalMessage)
Update opponent's probability given the message received
and devicde whether to accept the message or reject it
|
void |
endNegotiation()
Ends the negotiation.
|
void |
generateId()
Generates a random id for the QOAgent and saves it to m_sAgentId
|
java.lang.String |
getAgentId() |
java.lang.String |
getAgentName() |
java.lang.String |
getAgentSide() |
int[] |
getAgreementIndices(java.lang.String sAgreementStr) |
int |
getCurrentTurn()
Returns the current negotiation's turn
|
boolean |
getIsOfferToSend() |
int |
getMaxTurns() |
int |
getMsgId() |
java.lang.String |
getOpponentAgentId() |
java.lang.String |
getOpponentsProbabilitStr() |
long |
getSecondsForTurn() |
java.lang.String |
getSupportMediator() |
void |
incrementCurrentTurn()
Increments the current turn
|
void |
incrementMsgId()
Increments the next message id.
|
void |
printMessageToServer(java.lang.String sMessage) |
void |
receivedMessage(java.lang.String sMessage)
Called by QCommunication when a message is received from the server.
|
void |
register()
Resgisters the agent with the server
|
void |
saveAcceptedMsg(java.lang.String sMessage) |
void |
sendBestAgreement()
Sends the best agreeement for the agent at the current turn
|
void |
setCalculateEquilibriumForAllAgents(boolean bCalculateForAllAgents) |
void |
setCurrentTurn(int nCurrentTurn)
Sets the current negotiation's turn
|
void |
setEquilibriumAgent(boolean bIsEquilibriumAgent)
Main function of the agent.
|
void |
setHasOpponent(boolean bHasOpponent,
java.lang.String sOppId)
Sets whether the agent has an opponent already or not
|
void |
setMaxTurns(int nMaxTurns) |
void |
setMsgId(int nMsgId)
Sets a new message id
|
void |
setOpponentAgentId(java.lang.String sOppId)
Sets the opponent's id
|
void |
setSecondsForTurn(long lSeconds)
Sets the number of seconds for each turn
|
void |
updateAgreementsValues() |
void |
updateOpponentProbability(int[] CurrentAgreementIdx,
int nMessageType,
int nResponseType) |
public static final java.lang.String NOT_APPLICABLE_STR1
public QGameTime m_gtStopTurn
public QGameTime m_gtStopNeg
public QOAgent(QOAgent pAgent, java.lang.String sSide, java.lang.String sSupportMediator, java.lang.String sName, java.lang.String sId)
sSide
- - the side of the QOAgentnPortNum
- - the port number it connects tosSupportMediator
- - whether there is a mediatorsName
- - the name of the QOAgentsId
- - the id of the QOAgentpublic QOAgent(QOAgent pAgent, boolean bIsEquilibriumAgent, java.lang.String sSide, java.lang.String sSupportMediator, java.lang.String sName, java.lang.String sId)
public void setEquilibriumAgent(boolean bIsEquilibriumAgent)
public void setCalculateEquilibriumForAllAgents(boolean bCalculateForAllAgents)
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 messageQMessages
,
QCommunication
public void printMessageToServer(java.lang.String sMessage)
public void endNegotiation()
QCommunication
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 calculateFirstOffer()
public boolean getIsOfferToSend()
public void updateAgreementsValues()
public int getMsgId()
public void setMsgId(int nMsgId)
nMsgId
- - the new message idpublic void incrementMsgId()
QCommunication#printMsg
public void generateId()
public void register()
QMessages
,
QCommunication
public void sendBestAgreement()
public int[] getAgreementIndices(java.lang.String sAgreementStr)
public void calculateResponse(int nMessageType, int[] CurrentAgreementIdx, java.lang.String sOriginalMessage)
nMessageType
- - message typeCurrentAgreementIdx
- - array of agreement indicespublic void calculateEquilibriumResponse(int nMessageType, int[] CurrentAgreementIdx, java.lang.String sOriginalMessage)
public void saveAcceptedMsg(java.lang.String sMessage)
public java.lang.String getOpponentsProbabilitStr()
public void updateOpponentProbability(int[] CurrentAgreementIdx, int nMessageType, int nResponseType)