RePast
v. 2.0

uchicago.src.sim.Schelling
Class SchellingGis

java.lang.Object
  |
  +--uchicago.src.sim.engine.SimModelImpl
        |
        +--uchicago.src.sim.Schelling.SchellingGis
All Implemented Interfaces:
DescriptorContainer, SimEventProducer, SimModel

public class SchellingGis
extends SimModelImpl

This is an implementation of the classic Thomas Schelling model of segregation. Models of Segregation (in Strategic Theory and Its Applications). Thomas C. Schelling The American Economic Review, Vol. 59, No. 2, Papers and Proceedings of the Eighty-first Annual Meeting of the American Economic Association. (May, 1969), pp. 488-493. Agents are randomly placed on a grid (which, in our case, is a set of gis polygons). Each agent as a tolerance for agents who are a different color. Each time step, the agents evaluate their neighborhood. If the number of different agents in their neighborhood is greater than their tolerances, the agents will move to an unoccupied location. The neighborhood in this particular model is defined as the Delaunay triangulation of the centroids of the polygons. Keep in mind that there is no guarantee that the centroid will be inside the polygon. For a better description of Delaunay triangulation @see uchicago.src.sim.space.Delauany.


Field Summary
 
Fields inherited from class uchicago.src.sim.engine.SimModelImpl
descriptors, modelManipulator
 
Constructor Summary
SchellingGis()
          This builds the model based on on a shapefile.
 
Method Summary
 void begin()
          Begins a simulation run.
 double getDensity()
           
 String[] getInitParam()
          Gets the names of the initial model parameters to set.
 String getName()
          Gets the name of the model/simulation.
 double getPerGreen()
           
 Schedule getSchedule()
          Gets the Schedule created by the model.
 double getTolerance()
           
static void main(String[] args)
           
 void setDensity(double density)
           
 void setPerGreen(double perGreen)
           
 void setTolerance(double tolerance)
           
 void setup()
          Prepares a model for a new run, typically by deallocating objects or setting them to some reasonable default.
 
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, getTickCountDouble, 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
 

Constructor Detail

SchellingGis

public SchellingGis()
This builds the model based on on a shapefile. Note that this is done in the constructor, not in the buildModel method. Since one assumes that the shapefile is not changed in between runs, this is prudent. Reading in Shapefile data is a slow process, so it is best to do this only once. Note that the Shapefile data source takes a url, so the file name has to be absolute. The ShapefileDatasource could easily be swapped with another datasource such as a GmlDatasource. Please look at the geotools documentation to see what datasources are available.

Method Detail

getTolerance

public double getTolerance()

setTolerance

public void setTolerance(double tolerance)

getPerGreen

public double getPerGreen()

setPerGreen

public void setPerGreen(double perGreen)

getDensity

public double getDensity()

setDensity

public void setDensity(double density)

getInitParam

public 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

begin

public void begin()
Description copied from interface: SimModel
Begins a simulation run. All initialization, building the model, diplay, etc. should take place here. This method is called whenever the start button (or the step button if the run has not yet begun) is clicked. If running in batch mode this is called to kick off a new simulation run.


setup

public void setup()
Description copied from interface: SimModel
Prepares a model for a new run, typically by deallocating objects or setting them to some reasonable default. Called whenever the setup button is clicked or if operating in batch mode whenever a single run has ended in preparation for the next. Also called when the model is first loaded.


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 String getName()
Description copied from interface: SimModel
Gets the name of the model/simulation.

Returns:
the name of the model/simulation

main

public static void main(String[] args)

RePast
v. 2.0

Bug reports and feature requests to RePast