edu.brook
Class DemographicPrisonersDilemma

java.lang.Object
  extended by org.ascape.model.AscapeObject
      extended by org.ascape.model.Agent
          extended by org.ascape.model.LocatedAgent
              extended by org.ascape.model.Cell
                  extended by org.ascape.model.CellOccupant
                      extended by org.ascape.model.Scape
                          extended by edu.brook.DemographicPrisonersDilemma
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.EventListener, ControlListener, ScapeListener, Location, Node, SpaceContext, HasName, RandomFunctions, IGraphicsAdapted
Direct Known Subclasses:
DemographicPrisonersDilemma3D

public class DemographicPrisonersDilemma
extends Scape
implements IGraphicsAdapted

Demographic Prisoner_s Dilemma Java Implementation. Generated by AMF for model: DemographicPrisoner_sDilemma.metaabm in project: org.eclipse.amp.amf.examples.escape

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.ascape.model.Scape
Scape.ConditionalIterator, Scape.DrawFeatureObservable
 
Field Summary
 
Fields inherited from class org.ascape.model.Scape
AGENT_ORDER, agentsPerIteration, ALL_AGENTS, CLEAR_STATS_RULE, COLLECT_STATS_RULE, COMPARE_ORDERED_QUALIFIERS, COMPLETE_TOUR, copyrightAndCredits, CREATE_GRAPHIC_VIEW_RULE, CREATE_RULE, CREATE_SCAPE_RULE, CREATE_VIEW_RULE, EXECUTE_RULES_RULE, INITIAL_RULES_RULE, initialRules, prototypeAgent, REPEATED_DRAW, RULE_ORDER, version
 
Fields inherited from class org.ascape.model.CellOccupant
PLAY_HOST_RULE, RANDOM_WALK_AVAILABLE_RULE
 
Fields inherited from class org.ascape.model.Cell
CALCULATE_NEIGHBORS_RULE, neighbors, PLAY_NEIGHBORS_RULE, PLAY_RANDOM_NEIGHBOR_RULE
 
Fields inherited from class org.ascape.model.LocatedAgent
agentSize, coordinate, MOVE_RANDOM_LOCATION_RULE, RANDOM_WALK_RULE, thisUpdate
 
Fields inherited from class org.ascape.model.Agent
DEATH_RULE, FISSIONING_RULE, FORCE_DIE_RULE, FORCE_FISSION_RULE, FORCE_MOVE_RULE, INITIALIZE_RULE, ITERATE_AND_UPDATE_RULE, ITERATE_RULE, METABOLISM_RULE, MOVEMENT_RULE, PLAY_OTHER, UPDATE_RULE
 
Fields inherited from class org.ascape.model.AscapeObject
ARBITRARY_SEED, name, PLATFORM_DEFAULT_COLOR, scape
 
Constructor Summary
DemographicPrisonersDilemma()
          Constructs a new Demographic Prisoner_s Dilemma.
 
Method Summary
 void calculateTimeStep(int timeStep)
           
 java.lang.Object clone()
          Clones the agent, ensuring that a unique id is assigned.
protected  void create2DViews()
           
protected  void createChartViews()
           
 void createGraphicViews()
          Creates UI views for Demographic Prisoner_s Dilemma.
protected  void createGraphViews()
           
protected  Player createPlayerPrototype()
          Create an instance of Player that will be used to populate the playerScape.
 void createScape()
          Creates the members of Demographic Prisoner_s Dilemma.
 int getBirthAge()
          Gets the Birth Age property for Demographic Prisoner_s Dilemma.
 java.util.List<IAgentChild> getChildren()
           
 int getDeathAge()
          Gets the Death Age property for Demographic Prisoner_s Dilemma.
 int getFissionWealth()
          Gets the Fission Wealth property for Demographic Prisoner_s Dilemma.
 Scape getGameSpace()
          Gets the Game Space property for Demographic Prisoner_s Dilemma.
 int[] getGameSpaceDimensions()
          Gets the Dimensions property for Game Space.
 int getGameSpaceHeight()
          Gets the Height property for Game Space.
 int getGameSpaceWidth()
          Gets the Width property for Game Space.
 IGraphicsAdapter getGraphicsAdapter()
           
 int getInheiritedWealth()
          Gets the Inheirited Wealth property for Demographic Prisoner_s Dilemma.
 int getInitialWealth()
          Gets the Initial Wealth property for Demographic Prisoner_s Dilemma.
 int getMaximumAge()
          Gets the Maximum Age property for Demographic Prisoner_s Dilemma.
 int getMaximumWealth()
          Gets the Maximum Wealth property for Demographic Prisoner_s Dilemma.
 int getMinimumWealth()
          Gets the Minimum Wealth property for Demographic Prisoner_s Dilemma.
 double getMutationRate()
          Gets the Mutation Rate property for Demographic Prisoner_s Dilemma.
 java.lang.String getName()
           
 int getPayoffCC()
          Gets the Payoff Cooperate Cooperate property for Demographic Prisoner_s Dilemma.
 int getPayoffCD()
          Gets the Payoff Cooperate Defect property for Demographic Prisoner_s Dilemma.
 int getPayoffDC()
          Gets the Payoff Defect Cooperate property for Demographic Prisoner_s Dilemma.
 int getPayoffDD()
          Gets the Payoff Defect Defect property for Demographic Prisoner_s Dilemma.
 int getPlayerCount()
          Gets the Player Count property for Demographic Prisoner_s Dilemma.
 Scape getPlayerScape()
          Returns the Scape containing Players.
 long getUID()
           
static void main(java.lang.String[] args)
           
 void scapeSetup(ScapeEvent scapeEvent)
           
 void setBirthAge(int _birthAge)
          Sets the Birth Age property for Demographic Prisoner_s Dilemma.
 void setDeathAge(int _deathAge)
          Sets the Death Age property for Demographic Prisoner_s Dilemma.
 void setFissionWealth(int _fissionWealth)
          Sets the Fission Wealth property for Demographic Prisoner_s Dilemma.
 void setGameSpace(Scape _gameSpace)
          Sets the Game Space property for Demographic Prisoner_s Dilemma.
 void setGameSpaceDimensions(int[] _gameSpaceDimensions)
          Sets the Dimensions property for Game Space.
 void setGameSpaceHeight(int _gameSpaceHeight)
          Sets the Height property for Game Space.
 void setGameSpaceWidth(int _gameSpaceWidth)
          Sets the Width property for Game Space.
 void setInheiritedWealth(int _inheiritedWealth)
          Sets the Inheirited Wealth property for Demographic Prisoner_s Dilemma.
 void setInitialWealth(int _initialWealth)
          Sets the Initial Wealth property for Demographic Prisoner_s Dilemma.
 void setMaximumAge(int _maximumAge)
          Sets the Maximum Age property for Demographic Prisoner_s Dilemma.
 void setMaximumWealth(int _maximumWealth)
          Sets the Maximum Wealth property for Demographic Prisoner_s Dilemma.
 void setMinimumWealth(int _minimumWealth)
          Sets the Minimum Wealth property for Demographic Prisoner_s Dilemma.
 void setMutationRate(double _mutationRate)
          Sets the Mutation Rate property for Demographic Prisoner_s Dilemma.
 void setPayoffCC(int _payoffCC)
          Sets the Payoff Cooperate Cooperate property for Demographic Prisoner_s Dilemma.
 void setPayoffCD(int _payoffCD)
          Sets the Payoff Cooperate Defect property for Demographic Prisoner_s Dilemma.
 void setPayoffDC(int _payoffDC)
          Sets the Payoff Defect Cooperate property for Demographic Prisoner_s Dilemma.
 void setPayoffDD(int _payoffDD)
          Sets the Payoff Defect Defect property for Demographic Prisoner_s Dilemma.
 void setPlayerCount(int _playerCount)
          Sets the Player Count property for Demographic Prisoner_s Dilemma.
 void startSimulationAgentChild(int timeStep)
           
 
Methods inherited from class org.ascape.model.Scape
add, add, add, add, addAll, addDrawFeature, addInitialRule, addInitialRule, addRule, addRule, addScapeListener, addScapeListenerFirst, addStatCollector, addStatCollectorIfNew, addStatCollectors, addView, addView, addView, addViews, addViews, addViews, assignParameters, assignParameters, calculateDistance, calculateDistance, clear, construct, contains, containsAll, contentsToString, countWithin, createNonGraphicViews, createSelfView, createViews, createViews, environmentQuiting, execute, execute, executeOnMembers, executeOnMembers, executeOnMembers, executeOnMembers, executeOnRoot, executeOnRoot, find, findMaximum, findMaximum, findMaximumWithin, findMinimum, findMinimum, findMinimumWithin, findNearest, findRandom, findRandom, findRandom, findRandomCoordinate, findWithin, get, get, getAgentsPerIteration, getAllScapes, getCollectStats, getData, getDescription, getDrawFeatures, getDrawFeaturesObservable, getEnvironment, getExecutionOrder, getExecutionStyle, getExtent, getHome, getHTMLDescription, getInitialRules, getIteration, getIterationsPerRedraw, getModel, getPausePeriod, getPeriod, getPeriodDescription, getPeriodName, getPrototype, getPrototypeAgent, getRoot, getRules, getRunner, getScapeListeners, getSize, getSpace, getStartPeriod, getStatCollectors, getStopPeriod, getSuperScape, getThreadCount, getUIEnvironment, getUserEnvironment, hasWithin, initialize, isAllViewsUpdated, isAutoCreate, isCellsRequestUpdates, isEmpty, isGraphic, isHome, isLifeOfScape, isListenersAndMembersCurrent, isMembersActive, isMutable, isPaused, isPeriodic, isPopulateOnCreate, isRoot, isRunning, isScapeListener, isSerializable, isStartOnOpen, isUpdateNeeded, isValidPeriod, isViewSelf, iterator, listenerOrMemberUpdated, listenerUpdated, memberUpdated, moveAway, moveToward, newAgent, newAgent, notifyViews, notifyViews, populate, remove, remove, removeAll, removeDrawFeature, removeScapeListener, respondControl, respondDrawFeature, retainAll, retrieveAllAccessors, retrieveAllAccessorsOrdered, retrieveModelAccessorsOrdered, save, save, scapeAdded, scapeClosing, scapeDeserialized, scapeInitialized, scapeIterated, scapeIterator, scapeIterator, scapeIterators, scapeNotification, scapeRandomIterator, scapeRemoved, scapeStarted, scapeStopped, search, searchMax, searchMin, set, set, set, set, setAgentsPerIteration, setAutoCreate, setAutoRestart, setCellsRequestUpdates, setCollectStats, setCollectStats, setDescription, setEarliestPeriod, setExecutionOrder, setExecutionStyle, setExtent, setExtent, setExtent, setHome, setHTMLDescription, setInitialRules, setIterationsPerRedraw, setIterationsPerRedraw, setLatestPeriod, setMembersActive, setPaused, setPausePeriod, setPeriodic, setPeriodName, setPopulateOnCreate, setPrototypeAgent, setRunner, setRunning, setSerializable, setSize, setSpace, setStartOnOpen, setStartPeriod, setStopPeriod, setSuperScape, setThreadCount, setViewSelf, size, toArray, toArray, toString, withinIterator
 
Methods inherited from class org.ascape.model.CellOccupant
die, findAvailableNeighbors, findNearest, findNearest, findNearest, findNearest, findNearest, findNeighbors, findNeighborsOnHost, findRandomAvailableNeighbor, findRandomNeighbor, findRandomNeighborOnHost, findWithin, findWithin, findWithin, getCoordinate, getHostCell, getHostScape, leave, moveAway, moveTo, moveToRandomLocation, moveToward, playNeighbors, playRandomNeighbor, randomWalk, randomWalkAvailable, setHostCell, setHostScape
 
Methods inherited from class org.ascape.model.Cell
calculateNeighbors, countNeighbors, findOccupants, findRelative, getDistance, getNeighbors, getNeighbors, getNetwork, getOccupant, hostedCondition, isAvailable, removeOccupant, setNeighbors, setNeighborsList, setNetwork, setOccupant
 
Methods inherited from class org.ascape.model.LocatedAgent
calculateDistance, calculateDistance, countWithin, countWithin, countWithin, findMaximumWithin, findWithin, getAgentSize, hasWithin, hasWithin, hasWithin, isUpdateNeeded, moveAway, moveAway, moveTo, moveToward, moveToward, requestUpdate, requestUpdateNext, setAgentSize, setCoordinate
 
Methods inherited from class org.ascape.model.Agent
clearDeleteMarker, death, deathCondition, execute, execute, fission, fissionCondition, fissioning, getColor, getColor, getImage, getImage, getPlatformColor, isDelete, isInitialized, iterate, markForDeletion, metabolism, move, movement, movementCondition, play, scapeCreated, setInitialized, setScape, update
 
Methods inherited from class org.ascape.model.AscapeObject
diffDeep, diffDeep, diffDeepBFS, diffDeepDFS, diffDeepValidate, diffDeepVisit, equalsDeep, equalsDeep, equalsDeep, getComparisonStream, getRandom, getRandomSeed, getScape, randomInRange, randomInRange, randomIs, randomToLimit, reseed, setComparisonStream, setName, setRandom, setRandomSeed
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 
Methods inherited from interface org.ascape.model.event.ScapeListener
getScape
 
Methods inherited from interface org.ascape.model.space.Location
clearDeleteMarker, isDelete, markForDeletion, setCoordinate
 

Constructor Detail

DemographicPrisonersDilemma

public DemographicPrisonersDilemma()
Constructs a new Demographic Prisoner_s Dilemma.

Method Detail

getChildren

public java.util.List<IAgentChild> getChildren()

getUID

public long getUID()


clone

public java.lang.Object clone()
Clones the agent, ensuring that a unique id is assigned.

Specified by:
clone in interface ScapeListener
Specified by:
clone in interface Location
Overrides:
clone in class Scape
Returns:
the object

createPlayerPrototype

protected Player createPlayerPrototype()
Create an instance of Player that will be used to populate the playerScape. Overide to customize the prototype, for example to change the views created for a member scape.


createScape

public void createScape()
Creates the members of Demographic Prisoner_s Dilemma.

Overrides:
createScape in class Scape
See Also:
Scape.setPopulateOnCreate(boolean)

createGraphicViews

public void createGraphicViews()
Creates UI views for Demographic Prisoner_s Dilemma.

Overrides:
createGraphicViews in class Scape

scapeSetup

public void scapeSetup(ScapeEvent scapeEvent)

Specified by:
scapeSetup in interface ScapeListener
Overrides:
scapeSetup in class Scape
Parameters:
scapeEvent - the associated scape event

getPlayerScape

public Scape getPlayerScape()
Returns the Scape containing Players.


createChartViews

protected void createChartViews()


create2DViews

protected void create2DViews()


createGraphViews

protected void createGraphViews()


getGraphicsAdapter

public IGraphicsAdapter getGraphicsAdapter()

Specified by:
getGraphicsAdapter in interface IGraphicsAdapted

main

public static void main(java.lang.String[] args)


startSimulationAgentChild

public void startSimulationAgentChild(int timeStep)


calculateTimeStep

public void calculateTimeStep(int timeStep)


getPlayerCount

public int getPlayerCount()
Gets the Player Count property for Demographic Prisoner_s Dilemma.

Returns:
The number of players to create.

setPlayerCount

public void setPlayerCount(int _playerCount)
Sets the Player Count property for Demographic Prisoner_s Dilemma. The number of players to create.

Parameters:
_playerCount - the new Player Count value

getMinimumWealth

public int getMinimumWealth()
Gets the Minimum Wealth property for Demographic Prisoner_s Dilemma.

Returns:

setMinimumWealth

public void setMinimumWealth(int _minimumWealth)
Sets the Minimum Wealth property for Demographic Prisoner_s Dilemma.

Parameters:
_minimumWealth - the new Minimum Wealth value

getMaximumWealth

public int getMaximumWealth()
Gets the Maximum Wealth property for Demographic Prisoner_s Dilemma.

Returns:

setMaximumWealth

public void setMaximumWealth(int _maximumWealth)
Sets the Maximum Wealth property for Demographic Prisoner_s Dilemma.

Parameters:
_maximumWealth - the new Maximum Wealth value

getMaximumAge

public int getMaximumAge()
Gets the Maximum Age property for Demographic Prisoner_s Dilemma.

Returns:

setMaximumAge

public void setMaximumAge(int _maximumAge)
Sets the Maximum Age property for Demographic Prisoner_s Dilemma.

Parameters:
_maximumAge - the new Maximum Age value

getPayoffCC

public int getPayoffCC()
Gets the Payoff Cooperate Cooperate property for Demographic Prisoner_s Dilemma.

Returns:
The change in wealth for a player when playing cooperate against cooperate.

setPayoffCC

public void setPayoffCC(int _payoffCC)
Sets the Payoff Cooperate Cooperate property for Demographic Prisoner_s Dilemma. The change in wealth for a player when playing cooperate against cooperate.

Parameters:
_payoffCC - the new Payoff Cooperate Cooperate value

getPayoffCD

public int getPayoffCD()
Gets the Payoff Cooperate Defect property for Demographic Prisoner_s Dilemma.

Returns:
The change in wealth for a player when playing cooperate against defect.

setPayoffCD

public void setPayoffCD(int _payoffCD)
Sets the Payoff Cooperate Defect property for Demographic Prisoner_s Dilemma. The change in wealth for a player when playing cooperate against defect.

Parameters:
_payoffCD - the new Payoff Cooperate Defect value

getPayoffDC

public int getPayoffDC()
Gets the Payoff Defect Cooperate property for Demographic Prisoner_s Dilemma.

Returns:
The change in wealth for a player when playing defect against cooperate.

setPayoffDC

public void setPayoffDC(int _payoffDC)
Sets the Payoff Defect Cooperate property for Demographic Prisoner_s Dilemma. The change in wealth for a player when playing defect against cooperate.

Parameters:
_payoffDC - the new Payoff Defect Cooperate value

getPayoffDD

public int getPayoffDD()
Gets the Payoff Defect Defect property for Demographic Prisoner_s Dilemma.

Returns:
The change in wealth for a player when both players defect.

setPayoffDD

public void setPayoffDD(int _payoffDD)
Sets the Payoff Defect Defect property for Demographic Prisoner_s Dilemma. The change in wealth for a player when both players defect.

Parameters:
_payoffDD - the new Payoff Defect Defect value

getFissionWealth

public int getFissionWealth()
Gets the Fission Wealth property for Demographic Prisoner_s Dilemma.

Returns:
The wealth level at which an agent can fission.

setFissionWealth

public void setFissionWealth(int _fissionWealth)
Sets the Fission Wealth property for Demographic Prisoner_s Dilemma. The wealth level at which an agent can fission.

Parameters:
_fissionWealth - the new Fission Wealth value

getInheiritedWealth

public int getInheiritedWealth()
Gets the Inheirited Wealth property for Demographic Prisoner_s Dilemma.

Returns:
The wealth that is passed from parent to child.

setInheiritedWealth

public void setInheiritedWealth(int _inheiritedWealth)
Sets the Inheirited Wealth property for Demographic Prisoner_s Dilemma. The wealth that is passed from parent to child.

Parameters:
_inheiritedWealth - the new Inheirited Wealth value

getInitialWealth

public int getInitialWealth()
Gets the Initial Wealth property for Demographic Prisoner_s Dilemma.

Returns:
The wealth initially assigned to an agent at the beginning of model run.

setInitialWealth

public void setInitialWealth(int _initialWealth)
Sets the Initial Wealth property for Demographic Prisoner_s Dilemma. The wealth initially assigned to an agent at the beginning of model run.

Parameters:
_initialWealth - the new Initial Wealth value

getMutationRate

public double getMutationRate()
Gets the Mutation Rate property for Demographic Prisoner_s Dilemma.

Returns:
The probabaility that a given agent will change strategies in a given period, expressed as a value from 0.0 to 1.0.

setMutationRate

public void setMutationRate(double _mutationRate)
Sets the Mutation Rate property for Demographic Prisoner_s Dilemma. The probabaility that a given agent will change strategies in a given period, expressed as a value from 0.0 to 1.0.

Parameters:
_mutationRate - the new Mutation Rate value

getDeathAge

public int getDeathAge()
Gets the Death Age property for Demographic Prisoner_s Dilemma.

Returns:
The number of periods before an agent will be removed from game when Die At Age rule is active.

setDeathAge

public void setDeathAge(int _deathAge)
Sets the Death Age property for Demographic Prisoner_s Dilemma. The number of periods before an agent will be removed from game when Die At Age rule is active.

Parameters:
_deathAge - the new Death Age value

getBirthAge

public int getBirthAge()
Gets the Birth Age property for Demographic Prisoner_s Dilemma.

Returns:
The actual age in years as determined by data set.

setBirthAge

public void setBirthAge(int _birthAge)
Sets the Birth Age property for Demographic Prisoner_s Dilemma. The actual age in years as determined by data set.

Parameters:
_birthAge - the new Birth Age value

getGameSpaceDimensions

public int[] getGameSpaceDimensions()
Gets the Dimensions property for Game Space.

Returns:
The size of each dimension.

setGameSpaceDimensions

public void setGameSpaceDimensions(int[] _gameSpaceDimensions)
Sets the Dimensions property for Game Space. The size of each dimension.

Parameters:
_gameSpaceDimensions - the new Dimensions value

getGameSpaceWidth

public int getGameSpaceWidth()
Gets the Width property for Game Space.

Returns:
The horizontal extent of the space.

setGameSpaceWidth

public void setGameSpaceWidth(int _gameSpaceWidth)
Sets the Width property for Game Space. The horizontal extent of the space.

Parameters:
_gameSpaceWidth - the new Width value

getGameSpaceHeight

public int getGameSpaceHeight()
Gets the Height property for Game Space.

Returns:
The vertical extent of the space.

setGameSpaceHeight

public void setGameSpaceHeight(int _gameSpaceHeight)
Sets the Height property for Game Space. The vertical extent of the space.

Parameters:
_gameSpaceHeight - the new Height value

getGameSpace

public Scape getGameSpace()
Gets the Game Space property for Demographic Prisoner_s Dilemma.

Returns:

setGameSpace

public void setGameSpace(Scape _gameSpace)
Sets the Game Space property for Demographic Prisoner_s Dilemma.

Parameters:
_gameSpace - the new Game Space value

getName

public java.lang.String getName()

Specified by:
getName in interface SpaceContext
Specified by:
getName in interface HasName
Overrides:
getName in class Scape
Returns:
the name