class AgentUtilsExtension
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
int |
adversaryBATNA |
int |
adversaryRow |
boolean |
competitive |
double |
LIE_THRESHOLD |
int |
myPresentedBATNA |
int |
myRow |
protected java.util.ArrayList<java.lang.Boolean> |
previouslyOffered |
Constructor and Description |
---|
AgentUtilsExtension(IAGOCoreVH core)
Constructor for the AUE.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addPref(Preference p)
Adds the given preference to the list of preferences.
|
protected int |
adversaryValue(Offer o,
java.util.ArrayList<java.lang.Integer> ordering)
Returns the expected value for this agent's adversary on an offer for a given ordering of preferences.
|
protected int |
adversaryValueMax(Offer o)
Returns the maximum possible value for an adversary on an offer for all current orderings of preferences.
|
protected int |
adversaryValueMin(Offer o)
Returns the minimum possible value for an adversary on an offer for all current orderings of preferences.
|
protected void |
configureGame(GameSpec game)
Configures initial parameters for the given game.
|
boolean |
conflictBATNA(int agentBATNA,
int adversaryBATNA)
determines if a pair of given BATNA's are in conflict, i.e.
|
protected Preference |
dequeuePref()
Removes the 0th element in the preferences queue.
|
protected int |
findAdversaryIdealBest()
Finds the adversary's highest ranked item in the most ideal ordering
|
protected int |
findAdversaryIdealSecondBest()
Finds the adversary's second highest ranked item in the most ideal ordering
|
protected int |
findAdversaryIdealWorst(GameSpec game)
Finds the adversary's lowest ranked item in the most ideal ordering
|
(package private) int |
findAdversaryItemIndex(GameSpec game,
int num)
Finds the position on the board (1 through num issues) of an item with a particular ranking for the agent's adversary.
|
(package private) java.lang.String |
findMyItem(int order,
GameSpec game)
Finds the name of an item that's ranked a certain way by the agent.
|
(package private) int |
findMyItemIndex(GameSpec game,
int num)
Finds the position on the board (1 through num issues) of an item with a particular ranking for current agent
|
protected int |
getAdversaryValue(Offer o)
Helper to easily return expected/predicted value of an offer for an agent's adversary
|
int |
getID()
Getter for the agent's ID (0 for user, 1 for computer agent)
|
protected int |
getLedger()
Returns a simple int representing the internal "ledger" of favors done for the agent.
|
int |
getLyingBATNA(GameSpec game,
double lieThreshold,
boolean liar)
Finds the BATNA of an agent, takes into consideration whether it's lying or not
|
int |
getMaxPossiblePoints()
Finds the maximum amount of total points to be had in a certain game (i.e., agent's score if they received every item).
|
protected java.util.ArrayList<java.lang.Integer> |
getMinimaxOrdering()
Finds the ordering among possible orderings that is most/least different than the VH's ordering, based on the value of isFixedPie (set by separate method).
|
protected java.util.ArrayList<java.lang.Integer> |
getMyOrdering()
Returns the normalized ordering of VH preferences (e.g., a point value of {3, 7, 2} would return {2, 1, 3}), with 1 being the highest
|
protected GameSpec |
getSpec()
returns the GameSpec being used in the current game.
|
protected int |
getTotalLedger()
Returns a simple int representing the internal "ledger" of favors done for the agent, including all pending values.
|
protected int |
getVerbalLedger()
Returns a simple int representing the potential "ledger" of favors verbally agreed to.
|
protected boolean |
isFullOffer(Offer o)
Check to see if the offer is a full offer.
|
protected boolean |
isImportantGame()
Determines if there is a "particularly" valuable item this time around.
|
protected Event |
lastEvent(java.util.LinkedList<Event> history,
Event.EventClass type)
Returns the last event of type type, or null if nothing found.
|
protected Event |
lastEventReceived(java.util.LinkedList<Event> history,
Event.EventClass type)
Returns the last event of type type that was received, or null if nothing found.
|
int |
lowerBATNA(int vhPresentedBATNA)
determines if a pair of given BATNA's are in conflict, i.e.
|
protected void |
modifyOfferLedger(int increment)
Allows you to modify the agent's internal "ledger" of favors done for it.
|
protected void |
modifyVerbalLedger(int increment)
Allows you to modify the agent's internal "ledger" of favors done for it.
|
protected int |
myActualOfferValue(Offer o)
Returns the value of an offer with respect to the caller.
|
protected int |
myActualOrderValue(java.util.ArrayList<java.lang.Integer> o)
Returns the VH value of an ordering (of preferences?).
|
(package private) Preference |
randomPref()
Finds a random, accurate preference
|
protected boolean |
reconcileContradictions()
Eliminates invalid orderings by looking at preferences, the oldest ones first.
|
protected Event |
secondLastEvent(java.util.LinkedList<Event> history,
Event.EventClass type)
Returns the second to last event of type type, or null if nothing found.
|
protected void |
setAgentBelief(boolean fixedpie)
Sets the agent belief for when multiple opponent orderings are equally likely.
|
public int adversaryBATNA
public int myPresentedBATNA
public final double LIE_THRESHOLD
protected java.util.ArrayList<java.lang.Boolean> previouslyOffered
public boolean competitive
public int myRow
public int adversaryRow
AgentUtilsExtension(IAGOCoreVH core)
core
- The VH associated with this instance of AUE.protected void configureGame(GameSpec game)
game
- the game being played.protected void setAgentBelief(boolean fixedpie)
fixedpie
- true if fixed pie belief is in effect, false otherwise (if method is not called, defaults to false)protected GameSpec getSpec()
protected void addPref(Preference p)
p
- the preference to addprotected Preference dequeuePref()
protected int myActualOfferValue(Offer o)
o
- the offerprotected int myActualOrderValue(java.util.ArrayList<java.lang.Integer> o)
o
- the orderingprotected boolean isFullOffer(Offer o)
o
- the offerprotected java.util.ArrayList<java.lang.Integer> getMyOrdering()
protected int adversaryValue(Offer o, java.util.ArrayList<java.lang.Integer> ordering)
o
- the offerordering
- the orderingprotected int adversaryValueMax(Offer o)
o
- the offerprotected int adversaryValueMin(Offer o)
o
- the offerprotected int findAdversaryIdealBest()
protected int findAdversaryIdealSecondBest()
protected int findAdversaryIdealWorst(GameSpec game)
protected Event lastEvent(java.util.LinkedList<Event> history, Event.EventClass type)
history
- the history to searchtype
- the type of EventClass to search forprotected Event lastEventReceived(java.util.LinkedList<Event> history, Event.EventClass type)
history
- the history to searchtype
- the type of EventClass to search forprotected Event secondLastEvent(java.util.LinkedList<Event> history, Event.EventClass type)
history
- the history to searchtype
- the type of EventClass to search forprotected boolean reconcileContradictions()
public int getLyingBATNA(GameSpec game, double lieThreshold, boolean liar)
game
- lieThreshold
- the gauge of how much an agent exaggerates its BATNAliar
- whether or not the agent actually wants to lieprotected java.util.ArrayList<java.lang.Integer> getMinimaxOrdering()
public int getMaxPossiblePoints()
public boolean conflictBATNA(int agentBATNA, int adversaryBATNA)
agentBATNA
- can be either the true BATNA, or the presented BATNA, depending on the circumstancesadversaryBATNA
- this should always be the stored value of the opponent's BATNA.public int lowerBATNA(int vhPresentedBATNA)
vhPresentedBATNA
- can be either the true BATNA, or the presented BATNA, depending on the circumstancesprotected int getAdversaryValue(Offer o)
o
- an offer to look atpublic int getID()
int findMyItemIndex(GameSpec game, int num)
game
- num
- the ranking of the item within an ordering (i.e., 1 means best, 2 means second best, etc.)int findAdversaryItemIndex(GameSpec game, int num)
game
- num
- the ranking of the item within an ordering (i.e., 1 means best, 2 means second best, etc.)java.lang.String findMyItem(int order, GameSpec game)
order
- The rank of the item.game
- The GameSpec being used.Preference randomPref()
protected boolean isImportantGame()
protected int getLedger()
protected int getTotalLedger()
protected int getVerbalLedger()
protected void modifyVerbalLedger(int increment)
increment
- value (negative ok)protected void modifyOfferLedger(int increment)
increment
- value (negative ok)