|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.repastdemos.enn.EnnAgent
public class EnnAgent
A partial implementation of Randal Picker's Endogenous Neighborhood game as described in his as yet unpublished "Endogenous Neighborhoods and Norms." This simulation extends prior work by Randal Picker. See "Simple Games in a Complex World: A Generative Approach to the Adoption of Norms", 64 University of Chicago Law Review 1225 (1997). Thanks to Randal Picker for allowing us to include this with Repast. This agent plays a coordination game with its neighbors (if any). According its descision strategy an agent plays left or right each turn, calculates the payoffs, and decides what to do next turn.
| Field Summary | |
|---|---|
static int |
CHANGE_FIRST
|
static int |
MOVE_AND_CHANGE
|
static int |
PURE_ASPIRATION
|
static int |
STRATEGY_UPGRADE
|
| Fields inherited from interface uchicago.src.sim.games.GameAgent |
|---|
LEFT, NULL, RIGHT |
| Constructor Summary | |
|---|---|
EnnAgent(int xValue,
int yValue,
int aspirationValue,
int curStrategyValue,
EnnGame game,
Object2DTorus space,
int contentStrategy,
int discontentStrategy)
|
|
| Method Summary | |
|---|---|
void |
agentMove()
|
void |
draw(SimGraphics g)
Invoked when the object should draw itself |
int |
getAspiration()
|
boolean |
getContent()
|
int |
getCurStrategy()
|
float |
getPayoff()
Gets the current payoff for this agent. |
int |
getPrevStrategy()
|
int |
getStrategy()
Gets the current strategy (GameAgent.LEFT or GameAgent.RIGHT) |
int |
getX()
Gets the x coordinate of this drawable. |
int |
getY()
Gets the y coordinate of the this drawable. |
void |
makeStrategyDecision()
Decide what (left or right) to play next turn depending on how payoff meets aspiration and what the agent's decision strategy is. |
void |
playGame()
Performs the first part of agent's behavoir for this turn. |
void |
setAspiration(int aspirationValue)
|
void |
setContent(boolean contentValue)
|
void |
setCurStrategy(int curStrategyValue)
|
void |
setPayoff(float payoff)
Sets the payoff for this agent. |
void |
setPrevStrategy(int prevStrategyValue)
|
void |
setStrategy(int newStrategy)
Sets the current strategy (GameAgent.LEFT or GameAgent.RIGHT) |
void |
setX(int xValue)
|
void |
setY(int yValue)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int PURE_ASPIRATION
public static final int STRATEGY_UPGRADE
public static final int CHANGE_FIRST
public static final int MOVE_AND_CHANGE
| Constructor Detail |
|---|
public EnnAgent(int xValue,
int yValue,
int aspirationValue,
int curStrategyValue,
EnnGame game,
Object2DTorus space,
int contentStrategy,
int discontentStrategy)
| Method Detail |
|---|
public float getPayoff()
GameAgent
getPayoff in interface GameAgentpublic int getX()
Drawable
getX in interface Drawablepublic void setX(int xValue)
public int getY()
Drawable
getY in interface Drawablepublic void setY(int yValue)
public boolean getContent()
public void setContent(boolean contentValue)
public int getAspiration()
public void setAspiration(int aspirationValue)
public int getCurStrategy()
public void setCurStrategy(int curStrategyValue)
public int getPrevStrategy()
public void setPrevStrategy(int prevStrategyValue)
public void playGame()
An agent's action is broken up into two parts in order that all agent's play the same game on the same field. And then take action after all the agent's have played. Collapsing both parts into a "step()" method and calling that from the schedule means that each agent plays, then moves etc. and then the next agent plays etc.
public void makeStrategyDecision()
public void agentMove()
public int getStrategy()
GameAgent
getStrategy in interface GameAgentpublic void setPayoff(float payoff)
GameAgent
setPayoff in interface GameAgentpublic void setStrategy(int newStrategy)
GameAgent
setStrategy in interface GameAgentpublic void draw(SimGraphics g)
Drawable
draw in interface Drawable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||