This page last changed on Nov 27, 2007 by etatara.

The Context is the core concept and object in Repast Simphony.  It provides a data structure to organize your agents from both a modelling perspective as well as a software perspective.  Fundamentally, a context is just a bucket full of agents, but they provide more richness.

Repast S contexts are hierarchically nested named containers that hold model components.  The model components can be any type of POJO, including other contexts, but are often expected to be agent objects.  Each model component can be present in as many contexts as the modeler desires. The hierarchical nesting means that a model component that is present in a context is also present in all of that context's parent contexts.  Of course, the converse is not true in the general case.  The hierarchical nesting structure itself can be declaratively or imperatively specified by the modeler. Context membership and structure is completely dynamic and agents can be in any number or combination of contexts at any time.  Furthermore, agents can themselves contain any number of contexts and even be contexts.  In addition, the contents of components within contexts (e.g., agent properties) can be declaratively logged at runtime.

In addition to supporting hierarchical nesting, contexts support projections.  Repast S projections are named sets of relationships defined over the members of a context.  For example, a Repast S network projection stores a network or graph relationship between the members of its context.  The members of this context can then ask who they are linked to and who is linked to them. Similarly, the Repast S grid projection stores a set of Cartesian coordinates for each member of the context. The members of this context can ask where they are.  For more details on projections, see Details on Projections. Each context can support any mixture of projections.  Also, projections can be declaratively visualized at runtime.

Contexts also support data layers.  Data layers represent numerical data that can be accessed using a set of coordinates.  Data layers allow model designers to provide numerical values with which their agents can interact.  The data layers for a given context are separate from the layers for other contexts, allowing the agents to orient themselves with respect to a set of data depending on which context they are using.  Within a context, data layers can be connected to:

  • a particular projection (e.g., each cell in a two-dimensional grid may have some data associated with it),
  • multiple projections (e.g., a value at a particular set of coordinates might depend on both a grid and a set of network relations), or
  • no projections (e.g., the data is stored in an abstract matrix).
Document generated by Confluence on Nov 30, 2007 19:31