Analysis and Design
This section discusses the object-oriented analysis design of the Schelling model using MBSSM architecture. In the design stage, we need to describe the entities and mechanisms of the Schelling model within the general micro-macro scheme.
On the micro level, there is Agent class which has attributes such as location and satisfaction status. On the macro level, there is a structural entity Board that can has attributes such as cells (to manage agent location), average satisfaction, segregation index.
Within this system, there will be three types of mechanisms. The situation mechanisms (macro-to-micro) include updating satisfaction and getting empty cells. The locations of neighbour agents in the board (macro level) affect the satisfaction status of the agents (at the micro level). Getting empty cells is a operation in which the agents get the current empty cells from the Board to prepare for the move operation. The action mechanisms (micro-to-micro) is the move operation, i.e. the agents move to a random location when they are dissatisfied. The transformational mechanisms (micro-to-marco) include updating cells, updating average satisfaction, updating segregation index. The updating cells mechanism occurs after the move operation and captures the effect of the move operation by agents on the Board structural entity. In updating average satisfaction, the Board calculate the average satisfaction of all agents in the population. Lastly, the Board also update its segregation index. The segregation index can be used to track the emerged segregation phenomenon in the system.
Applying the MBSSM architecture, the general micro-macro scheme was translated into the following UML class diagram. The Main is the main program that will initiate and run the simulation model. The SchellingModel class manages Boad and SchellingAgent objects in the simulation, schedule the simulation operations per tick, and collect data. At the micro level, The agent behaviours described previously was captured into a SchellingTheory class. Even though there is only one theory in this example, we still use the Mediator design pattern so that it can be extended easily adding more theories. The SegregationTheoryMediator is in between SchellingAgent and SchellingTheory to mediate their interaction.
Most of these classes can be constructed by extending from the core of the MBSSM architecture.
- The SchellingModel extends the Model class.
- The Board extends the StructuralEntity class.
- The SchellingAgent extends the Agent class.
- The SchellingTheory extends the Theory class.
- The SegregationTheoryMediator extend the TheoryMediator class.