Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uchicago.src.repastdemos.enn
Class EnnBase

    java.lang.Object
      uchicago.src.sim.engine.SimModelImpl
          uchicago.src.repastdemos.enn.EnnBase

All Implemented Interfaces:
  DescriptorContainer, SimEventProducer, SimModel

Direct Known Subclasses:
  EnnBatchModel, EnnModel

    public abstract class EnnBase

extends SimModelImpl

Base class for EnnModels. The gui model (EnnModel.java) and the batch model share common behavoir and state. This class encapsulates these shared qualities. 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. Here agent's play a coordination game with their neighbors and receive a payoff. After all agents have have played the game, then each agents determines whether the current location and strategy meet their aspiration, changing strategies and moving if necesary. As described in the paper, satisfied agents can play a strategy of "strategy upgrade" or "pure aspiration". Here only strategy upgrade is implemented. Playing this strategy means that a content agent finds the best average strategy of all its neighbors and plays this the next turn. Unsatisfied agents can have a strategy of either move and change or change first. A strategy of move and changes means that an agent moves a random distance in a random direction and then changes its stratgey to the best average strategy of all its neighbors. Change first means that an agent changes its strategy and then if still unsatisfied, changes to a move and change strategy the next turn.

These values can be changed as initial parameters before a run
. PURE_ASPIRATION = 0
STRATEGY_UPGRADE = 1
CHANGE_FIRST = 2
MOVE_AND_CHANGE = 3
See the playGame method of EnnAgent for the details of the strategies.
See SugarModel.java for more on the general structure of a simulation model file.

Version:
  $Revision: 1.1 $ $Date: 2005/08/12 20:04:51 $
Author:
  Nick Collier and Randal Picker

Field Summary
`protected java.util.ArrayList` | `agentList`
`protected int` | `aspiration`
`protected float` | `bValue`
`static int` | `DO_LOAD_GUI`
`static int` | `DONT_LOAD_GUI`
`protected int` | `gridDensity`
`protected int` | `happyPlay`
`protected int` | `leftPercent`
`protected int` | `loadGui` if the model should load gui elements or not, used to run the nonbatch model in batch mode.
`protected DataRecorder` | `recorder`
`protected Schedule` | `schedule`
`protected boolean` | `shuffle`
`protected Object2DTorus` | `space`
`protected int` | `unhappyPlay`
`protected static int` | `WORLD_X_SIZE`
`protected static int` | `WORLD_Y_SIZE`

Fields inherited from class uchicago.src.sim.engine.SimModelImpl
`descriptors, modelManipulator`

Constructor Summary
`EnnBase()`

Method Summary
`protected void` | `buildModel()`
`double` | `computeOAC()`
`double` | `computeOSWA()`
`double` | `computeRave()`
`int` | `getAspiration()`
`float` | `getBValue()`
`int` | `getDoShuffle()`
`int` | `getGridDensity()`
`int` | `getHappyPlay()`
`java.lang.String[]` | `getInitParam()` Gets the names of the initial model parameters to set.
`int` | `getLoadGui()`
`java.lang.String` | `getName()` Gets the name of the model/simulation.
`int` | `getPercentLeft()`
`Schedule` | `getSchedule()` Gets the Schedule created by the model.
`int` | `getUnhappyPlay()`
`protected abstract void` | `initDataRecorder()`
`void` | `setAspiration(int newAspiration)`
`void` | `setBValue(float newBValue)`
`void` | `setDoShuffle(int i)`
`void` | `setGridDensity(int newDensity)`
`void` | `setHappyPlay(int play)`
`void` | `setLoadGui(int loadGui)`
`void` | `setPercentLeft(int newPercentLeft)`
`void` | `setUnhappyPlay(int play)`

Methods inherited from class uchicago.src.sim.engine.SimModelImpl
`addPropertyListener, addSimEventListener, clearMediaProducers, clearPropertyListeners, fireBooleanPropertyEvent, fireEndSim, fireNumericPropertyEvent, fireObjectPropertyEvent, firePauseSim, fireSimEvent, fireStopSim, fireStringPropertyEvent, generateNewSeed, getController, getMediaProducers, getModelManipulator, getParameterDescriptors, getPropertiesValues, getRngSeed, getTickCount, pause, registerDisplaySurface, registerMediaProducer, removePropertyListener, removeSimEventListener, setController, setRngSeed, stop`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface uchicago.src.sim.engine.SimModel
`begin, setup`

Field Detail

### WORLD_X_SIZE

    protected static final int WORLD_X_SIZE

See Also:
  Constant Field Values

### WORLD_Y_SIZE

    protected static final int WORLD_Y_SIZE

See Also:
  Constant Field Values

### aspiration

    protected int aspiration

### gridDensity

    protected int gridDensity

### bValue

    protected float bValue

### leftPercent

    protected int leftPercent

### unhappyPlay

    protected int unhappyPlay

### happyPlay

    protected int happyPlay

### shuffle

    protected boolean shuffle

### schedule

    protected Schedule schedule

### agentList

    protected java.util.ArrayList agentList

### DO_LOAD_GUI

    public static final int DO_LOAD_GUI

See Also:
  Constant Field Values

### DONT_LOAD_GUI

    public static final int DONT_LOAD_GUI

See Also:
  Constant Field Values

### loadGui

    protected int loadGui

  if the model should load gui elements or not, used to run the nonbatch model in batch mode.

### space

    protected Object2DTorus space

### recorder

    protected DataRecorder recorder

Constructor Detail

### EnnBase

    public EnnBase()

Method Detail

### getAspiration

    public int getAspiration()

### setAspiration

    public void setAspiration(int newAspiration)

### getGridDensity

    public int getGridDensity()

### setGridDensity

    public void setGridDensity(int newDensity)

### setBValue

    public void setBValue(float newBValue)

### getBValue

    public float getBValue()

### getPercentLeft

    public int getPercentLeft()

### setPercentLeft

    public void setPercentLeft(int newPercentLeft)

### setHappyPlay

    public void setHappyPlay(int play)

### getHappyPlay

    public int getHappyPlay()

### setUnhappyPlay

    public void setUnhappyPlay(int play)

### getUnhappyPlay

    public int getUnhappyPlay()

### setDoShuffle

    public void setDoShuffle(int i)

### getDoShuffle

    public int getDoShuffle()

### computeOAC

    public double computeOAC()

### computeRave

    public double computeRave()

### computeOSWA

    public double computeOSWA()

### initDataRecorder

    protected abstract void initDataRecorder()

### buildModel

    protected void buildModel()

### getInitParam

    public java.lang.String[] getInitParam()

  Description copied from interface: `SimModel`
  Gets the names of the initial model parameters to set. These names must have get and set methods supplied by the model. For example, for the parameter maxAge, the model must have getMaxAge and setMaxAge methods.

  Returns:
    a String[] of the initial parameter names

### getSchedule

    public Schedule getSchedule()

  Description copied from interface: `SimModel`
  Gets the Schedule created by the model.

  Returns:
    the schedule created by the model

### getName

    public java.lang.String getName()

  Description copied from interface: `SimModel`
  Gets the name of the model/simulation.

  Returns:
    the name of the model/simulation

### getLoadGui

    public int getLoadGui()

### setLoadGui

    public void setLoadGui(int loadGui)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD