A theoretical formalism for analyzing agent-based models
© North; licensee Springer. 2014
Received: 11 June 2013
Accepted: 7 March 2014
Published: 7 May 2014
Skip to main content
© North; licensee Springer. 2014
Received: 11 June 2013
Accepted: 7 March 2014
Published: 7 May 2014
Following Holland, complex adaptive systems (CASs) are collections of interacting, autonomous, learning decision makers embedded in an interactive environment. Modeling CASs is challenging for a variety of reasons including the presence of heterogeneity, spatial relationships, nonlinearity, and, of course, adaptation. The challenges of modeling CASs can largely be overcome by using the individual-level focus of agent-based modeling. Agent-based modeling has been used successfully to model CASs in many disciplines. Many of these models were implemented using agent-based modeling software such as Swarm, Repast 3, Repast Simphony, Repast for High-Performance Computing, MASON, NetLogo, or StarLogo. All of these options use modular imperative architectures with factored agents, spaces, a scheduler, logs, and an interface. Many custom agent-based models also use this kind of architecture. This paper’s contribution is to introduce and apply a theoretical formalism for analyzing modular imperative agent-based models of CASs. This paper includes an analysis of three example models to show how the formalism is useful for predicting the execution time and space requirements for representations of common CASs.
The paper details the formalism and then uses it to prove several new findings about modular imperative agent-based models.
It is proven that the asymptotic time and space performance of modular imperative agent-based modeling studies is computationally optimal for a common class of problems. Here ‘optimal’ means that no other technique can solve the same problem computationally using less asymptotic time or space. Modular imperative agent-based models are shown to be universal models, subject to the correctness of the Church-Turing thesis. Several other results are also proven about the time and space performance of modular imperative agent-based models. The formalism is then used to predict the performance of three models and the results are found to compare closely to the measured performance.
This paper’s contribution is to introduce, analyze, and apply a theoretical formalism for proving findings about agent-based models with modular agent scheduler architectures. Given that this kind of modeling is both computationally optimal and a natural structural match for many modeling problems, it follows that it is the best modeling method for such problems.
Complex adaptive systems (CASs) are collections of interacting, autonomous, learning decision makers embedded in an interactive environment (Holland 1992; Holland 1999; Holland 2006). CASs are common in both nature and society. Examples include ecosystems composed of organisms, industrial supply chains consisting of companies, social networks of formed by people, and even the human body’s multitudinous cells. The contributing decision makers in each of these CAS, and all others, have properties and behaviors. The decision makers interact with and influence each other; learn from their experiences; and change their behaviors so they are better suited to their environment.
Modeling CASs is challenging for several reasons. The details matter, so averages often fail to properly represent these systems. Heterogeneity is the norm, so decision makers must be modeled individually. Adaptation is expected, so models must be highly dynamic. Space is central, so models must be intensively spatial. Scale matters, so models must often include large numbers of decision makers. Nonlinearity is routine, so models must track specific decision maker attributes against relevant thresholds. As an example, consider human tissue growth at the cellular level. In this situation, averages over the number of cells and extracellular materials do not take into account the unique, heterogeneous situation of each cell. Cells adapt to their circumstances and substantially change their behavior in nonlinear ways. The relative locations of cells and extracellular materials are critical for predicting long-term outcomes. Furthermore, scale matters since large numbers of cells are needed to form tissues. Consider further an example of tissue engineering where human tissues such as bone are grown in controlled environments. Now, there are nonlinear and even adaptive environmental inputs. If vascularization (e.g., blood vessel formation) is one of the goals then appropriate growth factors may be periodically added to the growth media. If growth optimization is the goal then additional factors and nutrients may also be included.
The challenges of modeling CAS such as those for tissue growth and engineering can largely be overcome by using the individual-level focus of agent-based modeling (ABM) (Bonabeau 2002; Macal and North 2010; North and Macal 2007). By modeling CAS decision makers as individual agents, the full effects of the diversity that exists among the decision makers with respect to their attributes and behaviors can be observed as they give rise to the dynamic behavior of the system as a whole. Like CAS decision makers, ABM agents have properties and behaviors, interact with and influence each other, learn from their experiences, and adapt their behaviors so they are better suited to their environment. Agent-based modeling has been used successfully to model CAS in many disciplines, including archaeology, biology, ecology, supply chains, consumer market analysis, military planning, and economics (North and Macal 2007; North and Macal 2009). Many of these models were implemented using agent-based modeling software such as Swarm (Accessed 2014), Repast 3 (Accessed 2014), Repast Simphony (Accessed 2014), Repast for High-Performance Computing (Accessed 2014), MASON (Accessed 2014), NetLogo (Wilensky 2014), and StarLogo (Accessed 2014). All of these options use modular imperative agent-based modeling architectures. Many custom agent-based models also use this kind of architecture. Three examples are reviewed later in the section on example models. These examples to show how the formalism introduced in this paper is useful for predicting the execution time and space requirements for representations of common CASs.
There are many possible theoretical foundations for computational agent-based modeling. The value of each candidate depends on the questions to be answered by the theoretical approach. For example, the theoretical foundation in North (2012) focuses on how information is actually processed in agent-based models. Other candidates are reviewed in the section on related work. This paper extends the implementation-oriented theoretical foundation in North (2012) and applies it to study a variety of new questions.
This paper’s contribution is to introduce and apply a theoretical formalism for analyzing agent-based models. This paper details the formalism and then uses it to prove several new findings about agent-based models. It is proven that the asymptotic time and space performance of agent-based modeling studies is computationally optimal for common classes of problems. Here ‘optimal’ means that no other technique can solve the same problem computationally using less asymptotic time or space. Asymptotic approaches are likely to become increasing attractive as the sizes of agent-based models grow (Parker and Epstein 2011; Murphy 2011; Collier and North 2012). Agent-based models are also shown to be universal models, subject to the correctness of the Church-Turing thesis (Kleene 1943). Here ‘universal’ means that any computational model can be expressed as an agent-based model. Several other results about agent-based model time and space performance are also proven. The formalism is then used to predict the performance of three agent-based models and the results are found to compare closely to the measured performance.
The formalism contributes several things to the modeling of CAS and is therefore needed by CAS researchers from a range of disciplines. First, the formalism provides fundamental results about the time and space performance of one of the most common ways to investigate CASs, namely modular imperative agent-based models. Second, the formalism provides a way to predict the runtime and memory required to execute modular imperative agent-based models of CASs. This will become increasingly important as the number of agents commonly represented in models rises. Third, the formalism provides a straightforward way for CAS model developers to compare the time and space performance of modular imperative CAS agent-based models to that of traditional approaches such as optimization. Fourth, the formalism anchors modular imperative agent-based models, and their associated CASs, within the algorithmic hierarchy of traditional computer science complexity theory.
There is a range of published work that uses formal systems to prove selected properties of agent-based models or related kinds of models. This work includes the use of equation-based modeling, game theory, discrete systems, classifier agents, and an earlier random access stored-program (RASP) machine-based formalism. Each of these candidates is reviewed in the next sections.
Parunak et al. (1998) compare agent-based modeling and equation-based modeling. They conclude in part that agent-based modeling is best for spatial problems and individual choices, while equation-based modeling is best for geographically concentrated problems driven by well-defined mathematical rules. Specific equation-based formalisms for analyzing simulations include partial recursive functions, difference equations, and dynamical systems.
Epstein (2007) invalidates the commonly cited dichotomy between computational agent-based models and equation-based models by proving, albeit informally, that all computational agent-based models can be expressed using partial recursive functions. Epstein begins his proof by observing that because any standard computer program is effectively Turing complete, then programs for computational agent-based models must be so as well. Epstein then notes that there is an equivalent partial recursive function for every Turing machine. Therefore, there are sets of partial recursive functions for every computational agent-based model. These partial recursive functions are equations that fully specify any given computational agent-based model. Epstein also uses the partial recursive functions approach to argue informally that computational agent-based models, particularly those in the social sciences, are deductive in nature.
Considering the partial recursive functions approach further, Epstein (2007) discusses how unnatural or “unrecognizable” this expression of an agent-based model is likely to be for most agent-based modelers and how far this formalism is from real implementations. This suggests that partial recursive functions are not presently a suitable implementation-oriented theoretical foundation for agent-based modeling.
Leombruni and Richiardi (2005) introduce an equation-based formalism that can describe both agent-based and analytical models. Their formalism is intended to bridge the conceptual gap between equation-based economics and agent-based modeling.
Leombruni and Richiardi (2005) define agent attributes using vectors of state variables and then employ time-indexed difference equations to specify how each agent’s state changes from one time step to the next. Naturally, analytical models that can be reduced to difference equations can also be represented with their formalism. Once they define their formalism, they then consider the question of how to estimate the relevant parameters in the difference equations.
Leombruni and Richiardi (2005)’s formalism has the advantage of including both agent-based and analytical models. Unfortunately, difference equations can be an extremely awkward way to specify the behavior of agents with complicated algorithmic behavior. Furthermore, they do not use their formalism to prove properties of either kind of model or show how this could be done.
Hinkelmann et al. (2011) extend Grimm et al.’s (2006) Overview, Design Concepts, and Details (ODD) protocol by adding an algebraic field to describe agent behavior. First we review ODD then consider Hinkelmann et al.’s (2011) extension of it.
ODD describes models using a three-part approach involving an overview, concepts, and details. The model overview includes a statement of the model’s intent, a description of the main variables, and a discussion of the agent activities. The design concepts include a discussion of the foundations of the model. The details include the initial setup configuration, input value definitions, and descriptions of any embedded models.
Hinkelmann et al.’s (2011) ODD extension maps each agent’s state into a set of state variables. A set of time-indexed polynomial discrete dynamical equations that update the values of each agent’s state variables are then defined in such a way as to allow the state variables to form an algebraic field. They then use the rich body of existing algebraic techniques to prove system-level properties of two simple demonstration models.
Hinkelmann et al.’s (2011) approach has the advantage of offering a straightforward way to prove properties of agent-based models while leveraging a large body of existing research. Unfortunately, expressing complicated agent behaviors using time-indexed polynomial discrete dynamical equations can become prohibitively complex. Also, Hinkelmann et al.’s (2011) note that the algebraic techniques they seek to leverage sometimes have serious weakness of their own, such as an inability to scale to realistic model sizes.
Dynamical systems are sets of equations that specify a path through a space over time (Smale 1967). Selected agent-based models can be expressed as dynamical systems models or can be approximated by them. For example, Dorofeenko and Shorish (2002) used this approach to study a variation of the prisoner’s dilemma game. It is interesting to note that even though the prisoner’s dilemma is a classic game theoretic model, Dorofeenko and Shorish did not choose analytical or algorithmic game theory as the primary method for their study.
Dorofeenko and Shorish (2002) map Epstein’s (1998) demographic prisoner’s dilemma game to a reaction–diffusion dynamical system metamodel. Epstein’s original game used a 30 × 30 square lattice populated by reproducing agents with fixed prisoner’s dilemma strategies. Dorofeenko and Shorish investigated a one-dimensional version of the game and proved that certain conditions produce regions of long-term cooperation. Their findings are interesting, but are limited to the specific model that they are investigating. In particular, they do not provide a method for generalizing their findings or applying dynamical system analysis to a wider range of agent-based models. This absence illustrates the general conclusion that dynamical systems have limited potential as a theoretical foundation for agent-based modeling, as there is no known general mapping between computational agent-based models and dynamical systems models.
Game theory is a mathematical approach for studying multiparty decision problems in interactive environments (Myerson 1991). Some of the findings that are the most relevant for this paper are that many games have at least one stable outcome (i.e., Nash equilibrium) and that many games are nondeterministic polynomial time (NP)-complete (Nisan et al. 2007). Nisan et al. (2007) show that games with exactly one Nash equilibrium are in a lower complexity class than are NP-complete problems, whereas games with two or more Nash equilibriums are NP-complete.
Game theory can be used to prove properties about agent-based models to the extent that such models can be expressed as games. There are several approaches to solving game theoretic formulations including analytic game theory and algorithmic game theory. Each will be considered separately.
Analytic game theory (Nisan et al. 2007) applies mathematical proof techniques to deduce facts about game theoretic formulations. The previously mentioned proof that certain games are NP-complete is an example. Unfortunately, only a few kinds of games are amenable to analytical proof techniques (Nisan et al. 2007). Therefore, most practical problems do not have a corresponding analytically solvable game. This constraint prevents analytic game theory from being a useful general theoretical foundation for computational agent-based modeling.
Algorithmic game theory (Nisan et al. 2007) uses computational tools to solve game theoretic problems. Its computational nature allows it to address a much wider range of cases than does analytic game theory. However, this added flexibility often comes at the expense of theoretical generality.
There are several major differentiators between algorithmic game theory and agent-based modeling. Algorithmic game theory tends to focus on specific types of outcomes, such as stable equilibrium or various kinds of oscillatory dynamics (Nisan et al. 2007). Agent-based modeling tends to address much broader outcomes (North and Macal 2007). Algorithmic game theory uses extended game formulations to specify models, whereas agent-based modeling typically uses more scalable software engineering design tools. Unlike algorithmic game theory formulations, agent-based modeling software is often designed to represent detailed geographies, rich interaction topologies, nuanced agent learning, and complex agent behaviors. Therefore, algorithmic game theory is not an appropriate theoretical foundation for agent-based modeling because of the limited kinds of outcomes that are represented, the constraints on scaling, and the substantial practical differences in how models are specified.
Quite a few different approaches to representing agent-based models using discrete systems have been published. These approaches include cellular automata and the Discrete Event System Specification (DEVS). These approaches will be considered in the following sections.
Cellular automata (Christos and Lafortune 2008) are grids of cells, each of which has a state transition diagram. Uniform cellular automata have a single state transition diagram for every cell. Non-uniform cellular automata can have state transition diagrams that vary by cell. Brown et al. (2005) discuss cellular automata in relation to spatial agent-based modeling. They observe that cellular automata tend to yield Eulerian (i.e., field-oriented) models versus Langrangian (i.e., individual-oriented) representations. Here we conclude that this limits cellular automata as a foundation for proving properties about agent-based models, since many are domains are naturally Langrangian.
DEVS is one of the best developed theoretical formalisms for analyzing complicated simulations. DEVS describes simulations as hierarchical Moore machines with timing information added to the state transitions (Zeigler et al. 2000). Classic DEVS is the core abstraction. It is a structure that consists of the following:
A set of external events that can be input to the DEVS,
A sequence set of states,
A set of internal results that can be output from the DEVS,
An internal transition function that specifies how timeouts change states,
An external transition function that specifies how inputs change states,
A time advance function that specifies how long before each state times out, and
An output function that specifies the results for each state.
Coupled DEVS extends classic DEVS by allowing hierarchical nesting of the Moore machines. An example of a hierarchical DEVS implementation is described by Bolduc and Vangheluwe (2002). Extensions that add other functionality to classical DEVS and restrictions that limit the functionality have also been studied.
DEVS provides a theoretical foundation for analyzing some critical computational properties of agent-based models such as decidability. If the Church-Turing thesis is correct, then any computing system as complex as a Moore machine can be used to calculate any function. Therefore, in principle, DEVS can represent any computable model. Nonetheless, this finding by itself does not mean that DEVS is an ideal theoretical foundation for agent-based modeling because the same conclusion can be reached about any Turing-complete system.
Unfortunately for agent-based modeling, DEVS imposes an awkward boundary between state and behavior that makes it difficult to represent dynamically generated agent behaviors. The DEVS boundary also does not correspond to common agent-based model architectures. In addition to dynamically generated behaviors, agent-based models often have state structures that are a dynamic function of the events in the models. Dynamic Structuring DEVS (Shang and Wainer 2006) attempts to address these weaknesses, but it also adds new constraints that similarly limit its utility.
In addition, DEVS lacks important constraints commonly found in agent-based models. Agent-based models have extremely wide-ranging properties, yet exhibit characteristic forms of state storage and agent behavior. These conventions place specific theoretical limitations on the computational properties of agent-based models. DEVS does not include these conventions. An appropriate theoretical foundation should represent these conventions and allow analysts to reason about them rigorously. These agent-based modeling conventions are detailed in later sections.
Holland (2006) discusses the modeling of complex adaptive systems using a variety of techniques including agent-based modeling. He briefly reviews the capabilities of control theory, economic modeling, biological cell modeling, and game theory. Holland concludes that although the formalisms he has reviewed have unique strengths, they all face the problem of relying on differential calculus in general and on partial differential equations in particular. He then argues that the usefulness of partial differential equations is undermined by the inherent nonlinearity of the domains being modeled. For Holland, the answer is to develop exploratory computer-based models that have agent rules defined using individual classifier systems. Holland’s approach does not include enough explicit simulation engine details to derive time or space performance bounds. Furthermore, his approach is a special case of the formalism presented in this paper because it can be implemented using this formalism. Unlike this paper, Holland’s paper does not include time or space bounds derived using his recommended approach.
Niazi and Hussain (2010) use the Z specification language to represent an agent-based model of wireless sensor networks. Z is an International Standards Organization standard that specifies computations using set theory and predicate calculus operating on typed expressions (Spivey 1992). Z and its derivatives offer correctness-proving tools and model-based checking capabilities. Z specifications are often detailed enough to be translated into executable software.
Niazi and Hussain (2010) show how to use Z to specify a wireless sensor network model by defining an interlocking set of Z schemas. They report that the resulting specification is useful for demonstrating or proving the correctness of the wireless sensor network model relative to well-defined requirements. Also, they show that the Z specification provides a way to document detailed expectations for model behavior. This matches well with two of Z’s purposes, namely system documentation; and system verification and validation. However, the Z language does not specifically address model execution time or space performance analysis. For example, Niazi and Hussain (2010) do not use their Z specification to predict the execution time or space performance of their wireless sensor network model.
North (2012) introduces a RASP-based formalism for the analysis of agent-based model performance and uses this formalism to prove that the total asymptotic time and space performance of a specific Mars Rover model is computationally optimal. The current paper substantially extends North (2012) in several ways. First, the formalism presented in this paper is both different and more general than that of North (2012). The formalism in this paper includes a discrete event scheduling option, a wider range of interaction spaces, a discussion of user interfaces, analysis of parallel execution, and provisions for modeling studies. Second, broadly applicable computational optimality conditions are proven in this paper. Third, several other results about agent-based model time and space performance are also proven. Fourth, this paper provides performance analysis examples for three real models and compares these results to the theoretical predictions.
An implementation-oriented theoretical foundation for computational agent-based modeling should take into account the conventions commonly seen in applied modeling. This is not to say that current agent-based modeling efforts represent the expected final form of computational agent-based modeling research. Agent-based modeling is younger than techniques such as game theory. It is anticipated that agent-based modeling will evolve rapidly in the future. As this growth proceeds, it is hoped that agent-based modeling theory and practice will advance together. This paper is intended to contribute to this evolution.
Seven free and open-source agent-based modeling libraries and environments with published descriptions will be used to illustrate the common structural conventions of agent-based models. The examples are Swarm, Repast 3, Repast Simphony, Repast for High-Performance Computing (HPC), MASON, NetLogo, and StarLogo. Each of these options has a modular imperative agent-based modeling architecture.
Swarm is an agent-based modeling library with both Objective-C and Java bindings (Minar et al. 1996). Repast 3 (North et al. 2006) is a family of three agent-based modeling libraries, two in Java and one in C#, each with architectures inspired by Swarm. Repast Simphony (North et al. 2013) is a Java-based library and environment that generalizes Repast 3. Repast HPC (Collier and North 2012) is a C++ Message Passing Interface agent-based modeling library designed to run Repast Simphony’s core feature set efficiently on supercomputers.
MASON is an agent-based modeling library that seeks to provide a focused set of core services that can be easily used with other libraries (Luke et al. 2005). Its structure is related to that of Swarm.
NetLogo (Wilensky 1999) is an educational agent-based simulation environment that uses a modified version of the Logo programming language (Harvey 1997). Repast Simphony and Repast HPC include a ReLogo module and environment inspired by Logo in general and NetLogo in particular. StarLogo (Resnick 1994) is another Logo environment related to NetLogo.
When considering the commonalities between these libraries and environment, a short list of features emerges. These features include agents, a scheduler, interaction spaces, a random number source, logging, and a user interface. These features are discussed in detail in the sections that follow. It should be noted that these features are significantly different than those suggested by the previously discussed DEVS formalism.
Agents are the decision makers in all of the selected libraries and environments. Methods for representing agents vary. For example, the simulation systems discussed above are all object-oriented except for NetLogo and StarLogo. At a minimum, agents have some type of a unique identifier (e.g., index code or memory reference), behaviors that can be activated, and attributes that can be modified. Every agent can have unique behaviors and attributes, although agents are often grouped into types, classes, or breeds. Some libraries or environments offer additional features, such as dynamically modifiable behaviors.
Initialization of agents is completed using a bootstrap module that is called before the model begins executing. Some libraries or environments also offer persistent storage using text files, extensible markup language (XML) files, binary files, databases, or clouds.
The scheduler is responsible for representing the flow of time in a simulation. Scheduling can be time stepped or can use discrete events.
Time-stepped agents activate once for each scheduler time increment. The time counter normally increases in fixed increments of one unit for each step. Schedulers often implement time-step scheduling by repeatedly scanning through a list of agents. This list may be constant or may be randomized over time to allow the agent activation order to vary.
With discrete event scheduling, each agent action occurs at a unique time. Time advances from event to event. Some systems allow multiple events at a given time. These pseudo-parallel systems usually execute simultaneous events at a given time in a randomized sequential order.
Schedulers often implement discrete event scheduling by maintaining a list of pending, time-stamped agent behaviors sorted by time of activation. The next behavior is activated whenever a running behavior is completed. If any ties occur, they are often broken with random draws as previously discussed.
Several different kinds of agent interaction spaces are usually available. All of the previously listed libraries and environments offer several basic interaction spaces, except for StarLogo, which does not have networks:
A finite, one- (or more) dimensional integer lattice with one computable real value for each lattice point provides a simple way to represent scalar fields. The number of dimensions for each scalar field is fixed when the grid is created.
A finite, one- (or more) dimensional integer lattice with multiple occupancy and computable real number coordinates for agents provides a simple representation of physical space. The computable real numbered coordinates allow each agent to take on any location within the range supported by the grid. The integer lattice allows agents to find other agents who have similar coordinates (i.e., those agents with the same location when their coordinates are truncated to an integer). As with scalar fields, the number of dimensions for each grid is fixed when the grid is created. This entity will be called a “grid.”
A basic network stored as a weighted graph between agents provides a way to represent connections between agents. Both directed and undirected graphs are supported.
Each model can have zero or more of each kind of interaction space. Generally, the number of interaction spaces is a small constant relative to the number of agents. By default, every agent in each model is present somewhere in each of the model’s interaction spaces.
Random number streams are used to generate reproducible sequences of pseudorandom numbers. Several probability distributions are usually provided, including uniform random sources.
Logging provides a mechanism for recording values within an executing model for later analysis. Data collection is usually performed at regular intervals during model execution both for the overall model and for sets of agents. Data collection is usually performed automatically based on user input. User-programmed logging will be used in this paper.
Agent-based models usually run in one of two modes. The first is an interactive mode that presents the user with a graphical interface. The second is a ‘headless’ batch mode that reads input files, the runs model, and then stores the results into output files. Databases, data warehouses, or clouds may also be used in place of files.
Displaying a GUI often consumes a large amount of computing time and space. Most of these resources are not needed during batch runs. Therefore, batch mode is commonly used to generate large numbers of runs once the model and scenarios are finalized. Batch mode is also typically used for individual model runs with large numbers of agents. Batch mode will be the main focus of this paper because asymptotic performance analysis of agent-based models implies large numbers of agents.
This section provides an abstract machine specification for the modular imperative agent-based modeling architecture identified in the previous section. In this paper, we use the RASP architecture for our abstract machine. In keeping with the implementation-oriented theme discussed earlier, the RASP architecture was selected because it has a closer correspondence to real computer systems than do other typical options, such as Turing machines or the λ-calculus.
A RASP is an enhanced random access machine (RAM) (Cook and Reckhow 1973). Several variations exist (Elgot and Robinson 1964; Cook and Reckhow 1973). This paper uses the formulation by Cook and Reckhow (1973).
A RAM consists of an infinite set of memory registers that are used by a finite program. To better match the real implementations in this paper, a large but finite number of registers will be used instead of an infinite number. Each register can hold an integer. Register i is denoted Xi for a nonnegative integer.
Memory will be managed using a doubly linked free list with a fixed block size combined with a free boundary reference. The free boundary reference points to the first free register beyond which all registers are unallocated. To avoid external memory fragmentation, the block size will be set to be the maximum of any the dynamically allocatable uses of memory. Memory allocation will use the first block in the free list, if one is available. If the list is empty, then a block will be created by using and then incrementing the free boundary reference. Memory deallocation will insert the freed memory at the head of the list. In this case, the free boundary reference will remain the same.
By default, a RASP only processes integers. Finite computable real numbers will also be included in our modified machine. The operations for computable real numbers will work in the same fundamental way as the corresponding integer operations defined later in this section.
Cook and Reckhow (1973) scale the sizes of their registers independently to match the values held in storage. Modern computers rarely allow such variation. Therefore, we will set the register size for each RASP run to be a RASP-wide constant value, w. Naturally, w defines the maximum value of any integer or computable real number that can be directly processed in the given program run. w will vary between runs to reflect the widths of the numbers used in the problems being solved. The size of w is discussed further, once agents are introduced.
Load constant c into AC
ADD X i
Add the value in register Xj to AC
SUB X i
Subtract the value in register Xj from AC
STO X i
Store the value in AC to register Xj
w, if Xj was not allocated else 0
If AC > 0, then set IC to c
If AC ≤ 0, increment IC
RD X i
Load the next input tape value into Xj
w, if Xj was not
allocated else 0
PRI X i
Output the value in Xj to the output tape
-∞ o 0 and 8 to ∞-
For large w and constants ck, all of the operations shown in Table 1 take O(ckw) = O(w) time. In particular, processing integers and computable real numbers requires O(w) time and space. Operations that allocate new registers take O(0) time and O(w) space.
Cook and Reckhow (1973) show that a RASP has higher computing power than a standard multi-tape Turing machine—but only by the square root of the time. The RASP architecture was chosen for this paper because it is amenable to complexity analysis while still retaining an architecture closely resembling commonly used computers.
In the next sections, the abstract machine’s program and memory layout is presented. The outline intentionally uses standard data structures and algorithms to insure that the expected code is straightforward.
Agent storage layout
The first of j registers needed to store the agent attributes.
i + j-1
The last of j registers needed to store the agent attributes.
i + j
The head of a linked list used to store dynamically generated agent behaviors, if any.
i + j + 1
The first of k registers needed to store the heads of doubly linked lists used to store network links for network 1.
i + j + k
The last of k registers needed to store the heads of doubly linked lists used to store network links for network k.
i + j + k + 1
The address of the next agent in the agent list.
i + j + k + 2
The address of the previous agent in the agent list.
Agent definitions are read from input files. The input files have either individual agent descriptions or distributions. If the agents are stored individually, then there will be at least one input per agent. If distributions are used, then the needed agents are created using random draws from the given distributions.
Agents will be stored using the layout shown in Table 2. The default identifier for each agent is its lowest memory address.
Agents can have both statically defined and dynamically generated behaviors. Statically defined behaviors are included in the code for a given RASP instance. Dynamically generated behaviors are stored in an agent-specific linked list as shown in Table 2.
A doubly linked list of agents is maintained by the system. Inserting or removing agents updates this list. This list is used for activities discussed later such as time scheduling.
Basic operations to be provided by the agent-based modeling library are as follows:
Creating an agent requires initializing the agent register storage, as shown in Table 2. This operation has time O(r1⌈ log2(N)⌉) complexity and O(r1⌈ log2(N)⌉) space complexity for r1, the number of registers used by the agent. r1 is a constant relative to N.
Disposing of an agent requires adding the agent’s space back to the free list, which takes O(⌈ log2(N)⌉) time.
Changing the value of an agent attribute for a given agent j uses O(0) space and O(r2⌈ log2(N)⌉) time for r2, the required number of registers. r2 is again a constant relative to N.
Modifying an agent’s behavior involves writing a new routine for the agent. This action has O(r3⌈ log2(N)⌉) time complexity and O(r3⌈ log2(N)⌉) space complexity for r3, the required number of write operations. Statically compiled agent behaviors are stored with the main model program. Dynamically generated agent behaviors are added to an agent-specific linked list, as noted in Table 2. r3 is yet again a constant relative to N.
Executing an agent behavior takes time and space as determined by the contents of the corresponding routine.
The agents are accompanied by information on their surrounding environment. This information includes the statically compiled agent behaviors and other pieces of overall control information stored with the main model program. This information is in addition to a description of the interaction spaces that are present, which are discussed in a later section. The space needed to store information on the surrounding environment is always small and constant compared to that needed to store information about agents for any substantial number of agents. Therefore, environments use O(A⌈ log2(N)⌉) space and take O(B⌈ log2(N)⌉) access time for constants A and B. The need for a large amount of information on the surrounding environment implies that the agent-based model has been designed incorrectly and that agents have been blended into the environment.
Both time-stepped and discrete event scheduling are available. Each model will use one of these options exclusively.
The time-stepped scheduler uses the agent list and an integer time counter. This scheduler simply picks elements sequentially from the agent list and executes the next behavior. Every agent runs for each time step. Each time-stepped agent has a default ‘step’ routine that is called for each time step. A given agent’s step routine can be empty if no behavior is needed for a given time step. This default is taken to be the first element in the linked list of dynamically generated agent behaviors, if any. If an agent’s dynamic procedures list is empty, then a call is made to the first routine in the list of statically compiled functions for the corresponding agent type. Whichever way the step routine is found, it can call other routines as needed.
The discrete scheduler uses a time counter and an event time slot list stored as a B-tree sorted by time stamp. Each event time slot list entry includes a time value and the head pointer of a singly linked list of events. Each event, in turn, contains a time stamp, the address of the routine to be invoked, a single register value that can contain an optional parameter, and a link to the next list element. Decoding the parameter is solely the responsibility of the routine to be invoked. Inserting a new event time slot into the event time slot list, in the worst case, requires O(⌈ log2(N)⌉ log v) time for a list with v unique time slots. Finding an event time in the worst case takes O(⌈ log2(N)⌉ log v). Deleting an event when it is completed in the worst case takes O(⌈ log2(N)⌉ log v). The B-tree will use space O(v⌈ log2(N)⌉). In the worst case inserting, reading, or deleting an event once the corresponding event time has been found or inserted takes O(⌈ log2(N)⌉) time.
A model is said to have asymptotically linearithmica scheduling in time or space when the time or space performance is O(N⌈ log2(N)⌉). Time step scheduling is always asymptotically linearithmic in both time and space. Discrete scheduling is asymptotically linearithmic in time and space when the number of pending unique discrete event time slots, referred to as v previously, is constant with respect to N.
Regardless of the kind of scheduling that is employed, the number of time steps or unique discrete event times is usually independent of N. In other words, models are rarely run for more time steps or unique discrete event times because they have more agents. We thus assume that the length (i.e., time steps or slots) of each run is a constant relative to N, and therefore run length does not affect asymptotic time or space performance. We will briefly return to this assumption in a later section.
Three kinds of interaction spaces are supported. Each model can have any number of these spaces, although in practice the number of different interaction spaces is usually quite small.
Scalar fields will be stored as multidimensional arrays indexed in row major order. Each d-dimensional scalar field with maximum dimension range g will use space O(gd⌈ log2(N)⌉). Each grid point holds a computable real number or an integer. An individual value can be read or written in O(⌈ log2(N)⌉) time.
Grids will also be stored as multidimensional arrays indexed in row major order. Each array element will store the head pointers of doubly linked lists of agent records and a counter of the length of each list. There is one head pointer and counter pair for each agent type. Each agent record holds the reference of the associated agent and the agent’s floating point coordinates. Agents will also keep a reference to their own records. The doubly linked list can be of any length between zero and N. It is up to each modeler to process these lists in an appropriately efficient way. Each d-dimensional grid with width g will use space O(gd⌈ log2(N)⌉). An individual value can be read or written in O(⌈ log2(N)⌉) time.
Networks will be stored using a doubly linked list of edges for each agent. The head references for each agent are shown in Table 2. Each linked list element contains the identifier of the linked agent, a computable real number weight, a reference to the next element, if any, and a reference to the previous element, if any. The use of weights by agent behaviors is optional. Undirected networks contain linked lists with paired references (i.e., if agent A’s list includes agent B, then B’s list will also include A). Directed networks allow lists with asymmetric references. Each network will use O(bN⌈ log2(N)⌉) space for b the maximum number of links per agent. An agent can insert, read, or delete an entry in their list in O(b⌈ log2(N)⌉) time.
A pseudorandom number generation algorithm with O(⌈ log2(N)⌉) asymptotic time and space performance will be used to produce a uniformly distributed random number stream. The Mersenne Twister (Matsumoto and Nishimura 1998) is an example, at least until the number of random draws approaches the algorithm’s period of 219937-1. Non-uniform distributions can be provided by applying appropriate constant time functions to the core uniform random number stream. Also, the random seed used for stochastic execution is an input parameter.
The log stores values to the output tape using the PRI instruction. The log will be unstructured. This will allow users to determine the format of the logs individually for each model. The PRI instruction uses O(⌈ log2(N)⌉) time and O(0) space for each value to be logged.
The abstract machine will not normally use a GUI. As previously discussed, the machine will typically execute in a headless batch mode, since we are analyzing asymptotic (i.e., large-scale) performance. Nonetheless, the performance impact of a GUI will be briefly analyzed.
The abstract machine model can accommodate a GUI by including an optional memory region on startup that represents the graphics buffer. The machine will then include routines to draw agents into the memory locations representing the graphics buffer.
Drawing an agent-based model GUI usually involves rendering the frame and subwindows shown in Figure 1. The complexity of the overall frame and simulation control subwindows are independent of the number of agents. Thus, these components run in constant time and use constant space relative to the number of agents.
Users normally invoke probes manually rather than programmatically. As such, there is a fixed upper bound on the number of agents that can realistically be shown with probes in a GUI. Therefore, probes also run in constant time and use constant space relative to N.
Drawing the interaction spaces usually involves rendering many, if not all, of the agents individually. Generally, it will take O(⌈ log2(N)⌉) time to draw each view of the agents. Optimizations that reduce the number of agents considered for drawing may improve the time complexity. For example, simply not showing interaction spaces reduces the complexity of this task to O(0).
Drawing can be performed on an individual basis with intermediate results accumulating in the graphics buffer (i.e., graphics memory). Graphics buffers have a fixed size that is related to the screen resolution and is independent of the number of agents. Thus, drawing takes constant storage space.
The remainder of this paper will focus on batch mode model runs. The analysis that follows can be augmented using the results in this section, as needed.
There are multiple ways to use parallel computing to improve simulation performance Perumulla (2006), Parker and Epstein (2011) and Collier and North (2012) present examples. Two major paths are parallel parameter sweeps and distributed execution of individual simulations. Obviously, these approaches can be combined. Both paths will be considered in the next sections.
Simultaneously executing each run of a parameter sweep is sometimes called an “embarrassingly parallel” approach because of the relative simplicity of its implementation compared to more sophisticated alternatives (Foster 1995). The speedup factor is just the number of simultaneous runs discounted for any overhead required for job control. The overhead for this type of implementation is generally quite low, as implied by the “embarrassingly parallel” moniker. The major limiting factor is the number of processors, p, available for executing model runs. For even the largest computers, p is constant relative to N. Therefore such runs do not affect the asymptotic time requirements. Similarly, the memory requirements for a parallel parameter sweep will be the size of a model run times the number of simultaneous runs, again with additions for job control requirements and with discounts for possible shared memory. These factors, combined with the constant number of processing nodes, imply that parallel parameter sweeps do not affect the asymptotic space requirements.
Executing a single model using many processing nodes offers the potential to speed up the delivery of individual results. Here we will assume an ideal implementation. In this case, the asymptotic space requirements remain unchanged, given that the same number of agents needs to be tracked as with a sequential model. The best speedup for asymptotic time is 1/p for p processors because no computing work can be ignored. Unfortunately, as previously discussed, p is a constant relative to the number of agents, so there is no asymptotic time speedup.
Agent-based modeling studies often require multiple model runs to cover different scenarios and to account for stochastic variation. The time and space complexity results for individual runs can be used to estimate the requirements for each needed type of run and then multiplied by the corresponding number of runs and summed, as appropriate.
In many situations, even though the number of model runs needed for a given study is a factor of many input variables, it is independent of the number of agents. In these cases, the asymptotic time and space requirements, of course, are the same as for an individual model run.
The abstract machine reads the first input tape value to determine the number of input sets that are present. If more that one input set is present then they are simply concatenated in the desired order of execution.
The abstract machine has constant time routines to reset itself and start the new model runs, as needed. The output from each run is simply appended to the output tape in order of execution. It is the responsibility of modelers to store appropriate delimiters or use other encodings to differentiate output run results.
The abstract machine has an optional provision for executing a routine to aggregate a set of runs after they have completed. The performance of this routine is included in the overall performance of the data aggregation system. In general, if the number of model runs is constant with respect to N and the model-level data aggregation is linearithmic or better in asymptotic time and space performance then the parameter sweep-level data aggregation routine will also be linearithmic or better in performance.
For any model, O(Ttotal) ≥ O(Smax).
For any model, O(Ttotal) ≥ O(Slog).
Two important definitions are presented in this section. These definitions are then used to analyze the best cases for time and space.
A model with N agents is said to be asymptotically thorough when individual values from O(N) agents are needed from at least two different representative time periods to correctly calculate the logged results. Representative means that the span between logged time periods includes typical agent behaviors. Logging a value from each agent for two or more normal time steps is generally sufficient to meet this standard.
A model with N agents is said to be asymptotically incompressible when a minimum of O(N) space is needed to store the agents and recalculating an attribute for an agent takes at least as much space as storing it between uses. In other words, the best compression ratio achievable for agent storage is constant relative to N for the general case for a given model. Agent attributes that can take on a wide range of values are generally sufficient to meet this standard.
We will now consider the best cases for time and space performance for asymptotically incompressible and asymptotically thorough models.
The minimum asymptotic time needed for asymptotically thorough models is in Ω O(N⌈ log2(N)⌉) for variable word size computers.
The minimum asymptotic space needed for asymptotically thorough and incompressible model is in Ω (N⌈ log2(N)⌉) for variable word size computers.
In this section, we will consider the worst cases for time and space for asymptotically thorough and incompressible batch-mode modular imperative agent-based models with large numbers of individual, boundedly rational, decision makers; input parameter ranges and counts that do not increase with the number of decision makers; asymptotically linearithmic scheduling; and output aggregation that is linearithmic or faster in time and space. Obviously, it is assumed that the agent-based model in question is suitable for the problem, correctly written, and efficiently implemented relative to the constraints and requirements of the question to be answered.
The N agents in a model with, at most, s unique event times (i.e., times steps or unique discrete event times) and d operations in the agent routine with the greatest time complexity requires, at most, O(Nsd⌈ log2(N)⌉) time. s does not increase with N. Thus, s is a constant with respect to N. Bounded rationality means in part that the amount of computation that can be completed by any one agent in a single time step is strictly limited. This limitation, in turn, means that d must be a constant relative to N because N is unbounded. All of the agent’s operations are either programmed using the instruction set given in Table 1 or are interaction space access calls. Thus, the agents themselves require, at most, O(N⌈ log2(N)⌉) time plus access time for any interaction spaces that might be used.
As discussed above, environments use O(⌈ log2(N)⌉) time. There is only one environment. Therefore, the total time N agents spend accessing information in the environment is, at most, O(N⌈ log2(N)⌉).
Scalar fields can be accessed in O(⌈ log2(N)⌉) time. The number of scalar field accesses in each agent behavior must be bounded due to bounded rationality. Therefore, the total time N agents spend accessing scalar fields is, at most, O(C1N⌈ log2(N)⌉) = O(N⌈ log2(N)⌉), where C1 is the maximum number of accesses in an agent behavior.
Grids are stored as simple multidimensional arrays. The access time is just the time needed for array indexing, namely, O(⌈ log2(N)⌉) per access. The number of linked list checks and overall grid accesses in each agent behavior must be bounded due to bounded rationality. Therefore, the total time N agents spend accessing grids is, at most, O(C2N⌈ log2(N)⌉) = O(N⌈ log2(N)⌉), where C2 is the maximum number of grid accesses in an agent behavior.
Each network has O(b⌈ log2(N)⌉) access time for b, the maximum number of links per agent. Bounded rationality implies that the number of network links that can be remembered by any one agent is strictly limited. This constraint, in turn, means that b must be a constant relative to N, given that N is unbounded. The number of accesses must also be bounded due to bounded rationality. Therefore, the total time N agents spend accessing networks is, at most, O(C3bN⌈ log2(N)⌉) = O(N⌈ log2(N)⌉), where C3 is the maximum number of network accesses in an agent behavior.
Output aggregation uses linearithmic or less time. The outputs, therefore, require, at most, O(N⌈ log2(N)⌉) time in addition to that used by the rest of the model.
The maximum asymptotic time for studies done with asymptotically thorough and incompressible batch mode modular imperative agent-based models with large numbers of individual, boundedly rational, decision makers; input parameter ranges and counts that do not increase with the number of decision makers; asymptotically linearithmic scheduling; and output aggregation that is linearithmic or better in time and space is Ω (N⌈ log2(N)⌉) for variable word size computers.
Modular imperative agent-based models read all of their agent inputs, create the corresponding agents, and then store them. The combined requirements of asymptotic thoroughness and incompressibility prevent agent data from being recreated for each time step to save space. Thus, O(N⌈ log2(N)⌉) space is required.
Environments use O(C4⌈ log2(N)⌉) space for constant C4. There is one environment. Therefore, environments use, at most, O(⌈ log2(N)⌉) space.
g grows asymptotically faster than N1/d. In this case, the agent density will drop and eventually either the agents will cluster or most agents will be isolated from one another. In either case, the model’s use of the space becomes trivial. The space can then be replaced with either a set of smaller spaces when most of the agents cluster or with a network when most of the agents are isolated from one another. Thus, this case is not allowed.
g grows at the same rate or asymptotically slower than N1/d. The agent density is constant or rising so the agent interactions can continue to be mediated via the field. The overall space usage for the grid is then O(gd⌈ log2(N)⌉) ≤ O(((N/y)1/d)d⌈ log2(N)⌉) = O(((N/y)⌈ log2(N)⌉) ≤ O(N⌈ log2(N)⌉)
The number of scalar fields must be bounded due to bounded rationality. Therefore, scalar fields use O(C5N⌈ log2(N)⌉) = O(N⌈ log2(N)⌉) or less space, for C5 scalar fields.
g grows asymptotically faster than N1/d. In this case, the agent density will drop and eventually either the agents cluster or most agents will be isolated from one another. In either case, the model’s use of the space becomes trivial. The space can then be replaced with either a set of smaller spaces when most of the agents cluster or with a network when most of the agents are isolated from one another. Thus, this case is not allowed.
g grows at the same rate or asymptotically slower than N1/d. The agent density is constant or rising so the agent interactions can continue to be mediated via the field. The overall space usage for the grid is then O(gd⌈ log2(N)⌉) ≤ O(((N/y)1/d)d⌈ log2(N)⌉) = O(((N/y)⌈ log2(N)⌉) ≤ O(N⌈ log2(N)⌉)
The number of grids must be bounded due to bounded rationality. Therefore, grids use, at most, O(C6N⌈ log2(N)⌉) = O(N⌈ log2(N)⌉) or less space, for C6 grids. Of course, agents must be selective in how they access the grid point membership lists to maintain bounded rationality.
Each network requires O(bN⌈ log2(N)⌉) space. b has been previously shown to be a constant relative to N. Thus, each network requires O(N⌈ log2(N)⌉) space. As with the other kinds of spaces, the number of networks must be bounded due to bounded rationality. Therefore, networks use, at most, O(C7N⌈ log2(N)⌉) = O(N⌈ log2(N)⌉) space, for C7 networks.
Output aggregation uses linearithmic or less space. The outputs, therefore, require at most O(N⌈ log2(N)⌉) space in addition to that used by the rest of the model.
The maximum asymptotic space for studies done with asymptotically thorough and incompressible batch mode modular imperative agent-based models with large numbers of individual, boundedly rational decision makers; input parameter ranges and counts that do not increase with the number of decision makers; asymptotically linearithmic scheduling; and output aggregation that is linearithmic or faster in time and space is Ω O(N⌈ log2(N)⌉) for variable word size computers.
Studies with modular imperative agent-based models are computationally optimal in asymptotic time and space performance if the models are asymptotically incompressible; asymptotically thorough; have large numbers of individual, boundedly rational, decision makers; have input parameter ranges and counts that do not increase with the number of decision makers; use batch mode operation; have asymptotically linearithmic scheduling; and have output aggregation that is linearithmic or faster in time and space for variable word size computers.
and (4) show that the best case time and space bounds for any asymptotically incompressible and thorough model are both in Ω (N⌈ log2(N)⌉). We also showed that individual, boundedly rational decision makers in an asymptotically incompressible and thorough agent-based model with individual inputs requires O(N⌈ log2(N)⌉) time and space, plus the time and space needed for accessing the interaction spaces. We additionally showed that the agent-based modeling interaction spaces require, at most, O(N⌈ log2(N)⌉) time and space for each space for N boundedly rational agents. This formulation yields O(N⌈ log2(N)⌉) + O(C8N⌈ log2(N)⌉) = O(N⌈ log2(N)⌉) total asymptotic time and space performance for C8 spaces. Finally, we showed that modeling studies and parallel runs do not change the asymptotic time and space complexity of agent-based models. Therefore, (7) is proven.
Modular imperative agent-based models are computationally optimal in asymptotic time performance if O(Ttotal) = O(Slog).
In this section, we use the formalism to investigate other properties of agent-based models. Here we focus on characterizing the computational generality of modular imperative agent-based modeling.
Modular imperative agent-based models are computationally complete, subject to the correctness of the Church-Turing thesis.
Any computable model can be expressed as a modular imperative agent-based model.
For example, Macal (2010) presents an algorithm to convert any system dynamics model to a modular imperative agent-based model. Of course, result (10) does not mean that modular imperative agent-based modeling should be automatically used to solve all modeling problems. The practical circumstances surrounding a given modeling problem need to be taken into account as well.
ABM = ABMTIME ∩ ABMSPACE
ABMTIME includes modular imperative agent-based models of all complexity classes linearithmic or larger.
ABMSPACE includes modular imperative agent-based models of all complexity classes linearithmic or larger.
In the proceeding sections, we have assumed an abstract model of computation that scales with the size of N. In this section, we will briefly relax this assumption to better approximate real computers. Even in this section, the relaxation will only be partial, since we want the formalism to accommodate the full range of typical computers. The relaxation here will occur along two axes, namely word size and run length.
Studies with modular imperative agent-based models are computationally optimal in asymptotic time and space performance if the models are asymptotically incompressible; asymptotically thorough; have large numbers of individual, boundedly rational, decision makers; have input parameter ranges and counts that do not increase with the number of decision makers; use batch mode operation; have asymptotically linear scheduling; and have output aggregation that is linear or faster in time and space on fixed word size computers.
The performance bounds in the proceeding sections included the observation that the number of time steps or unique discrete event times is generally independent of N. Therefore, these factors do not affect asymptotic time or space performance. For real computers, a substantial constant may still affect performance. In this case, the time performance results should be multiplied by s, the number of time steps or slots. The space performance results remain the same for boundedly rational agents with linear output aggregation on fixed word size computers. Here bounded rationality limits the agent’s ability to accumulate memory, and linear output aggregation storage constrains output aggregation space.
Returning to the cellular-level human tissue growth example discussed in the introduction, if N is the number of cells, each cell’s behavior is boundedly rational, cell density is finite, and the cells exist in three dimensional grid then the model will be O(N) on fixed word size computers.
In the following sections we analyze the asymptotic time and space performance of three example modular imperative agent-based models. The examples were chosen from the set of published agent-based models, so as to cover a range of different designs and a spectrum of varying uses. These examples show how to apply both the formalism and the optimality conditions to several different kinds of real agent-based models. These examples also demonstrate how the formalism is useful for predicting the execution time and space requirements for representations of common CASs.
The Lotka-Volterra (Lotka 1925; Volterra 1926) predator–prey model is a classic differential equations model that is commonly implemented using system dynamics. Here we will consider a three species ‘predator–prey-plant’ variant. In this model, there are predators that eat prey and prey that eat plants. The animals (i.e., the predators and prey) have an energy level and die if their energy goes to zero. Plants regrow at a specified rate. N is the sum of the three species’ populations. By convention, the output is a population count time series for each tracked species or compartment. The input parameter ranges and counts do not increase with N.
The modular imperative agent-based predator–prey-plant implementation has one agent type for each species and is time-stepped. Since it is time-stepped, it has asymptotically linear scheduling. A selected Repast Simphony implementation is used for reference.
For the Repast Simphony implementation, animals reproduce probabilistically using random draws checked against reproduction rate thresholds. The animal agents move on a two dimensional toroidal grid, with plant agents at each point. During each time step, the animals move to a random point near their current location and then eat if the appropriate food is available. This is a simple boundedly rational O(a⌈ log2(a)⌉) time and space behavior for a animals on variable word size computers.
Plants can be living or dead. Live plants grow at a constant rate. Areas with dead plants lie fallow for a period of time and then life returns. Plants die due to excessive consumption by prey. This is a simple boundedly rational O(b⌈ log2(b)⌉) time and space behavior for b plants.
a and b can both be large. With N = a + b, we have N large, as well.
The three species each maintain individual energy levels that can take on any double precision value. As such, they are asymptotically incompressible.
Combining results (5) and (6) with the minimum requirements that were just discussed implies that this model is O(N⌈ log2(N)⌉) in time and space. This version of the agent-based model does not qualify for time or space optimality under result (14) because the output requires only compressible information from each agent (i.e., the population count) rather than specific attributes. In other words, the model’s output aggregation is not asymptotically thorough. Is there a more efficient implementation?
The system dynamics predator–prey-plant implementation has one stock for each species and a set of flows between stocks. On variable word size computers, this model has O(C9⌈ log2(N)⌉) = O(⌈ log2(N)⌉) asymptotic time and space performance for constant C9 measuring the time and space usage for the fixed stocks and flows. Obviously, this model has better time and space performance than the previous agent-based version.
Consider a variation of the model used to study predator and prey migration patterns. Now, the model must output the grid locations of each animal for every time step. This agent-based model is asymptotically thorough. It remains O(N⌈ log2(N)⌉) in time and space but it is now optimal under result (14).
What about the O(⌈ log2(N)⌉) system dynamics implementation? It cannot generate the needed outputs. A scalar field approach is also insufficient, since this only shows net flows, not long distance migrations. Modifications that allow the system dynamics model to track individual animal coordinates and energy levels results in a model with O(N2⌈ log2(N)⌉) terms in each of the animal coordinate and energy level equations. The result is a model that requires O(N2⌈ log2(N)⌉) space and O(N2⌈ log2(N)⌉) evaluation time on variable word size computers. Furthermore, the model has awkward constraints on the range of model execution, since the formulation limits the maximum number of animals allowed in a given run. Wilson (1998) further explores the relationship between agent-based modeling and system dynamics for the two species variant of this model.
For fixed word-size computers, we have O(N⌈ log2(N)⌉) = O(N), which is a linear relationship. As predicted, the test measurements of the predator–prey-plant model execution time are collectively linear versus N with an adjusted R2 of 0.7794 and a p-value less than 2.200 × 10-16. The space measurements are also collectively linear versus N with an adjusted R2 of 0.5687 and a p-value less than 2.200 × 10-16.
Strains of the bacterium community-associated methicillin-resistant Staphylococcus aureus (CA-MRSA), are responsible for potentially life-threatening infections of the skin, soft tissue, blood, bone, and other human tissues. CA-MRSA strains are resistant to standard antibiotics related to penicillins and have a high prevalence in the general community, as well as in healthcare facilities. Macal et al. (2012) have developed two fine-grained, modular imperative agent-based models of CA-MRSA for the Chicago metropolitan area. These hourly time-stepped models feature people as agents. Both models share a common design. We will consider the large-scale Repast HPC version here due to its ability to scale across a wide range of agent population sizes. We will use this ability to compare the theoretical predictions of our time and space performance model to measured results over several orders of magnitude for N. We will also compare this simulation to system dynamics epidemic simulations.
The Repast HPC CA-MRSA modular imperative model has N person agents. The number of agents is constant throughout each simulation run. The number of agents is generally large because the model is used to study major parts or all of the Chicago area. The agents have activity schedules and a list of locations at which to act. The activities are coded by hour, location, and activity type. The agent activities can be interrupted when problems such as hospitalization or incarceration occur.
The model uses time step scheduling with a step size of one hour. Since it is time stepped, it has asymptotically linearithmic scheduling.
The location and activity type for each agent for each simulated hour contribute to the determination of the risk of disease transmission and the likelihood of disease progression. The disease states of the people in a location also contribute to the risks and likelihoods. The locations include residences such as homes or group quarters, workplaces, schools, gyms, hospitals, and jails.
The model tracks three disease states for each agent, namely uncolonized, colonized, and infected. Uncolonized people do not have the CA-MRSA. Colonized people have the disease but do not show symptoms. Infected people have symptoms and are believed to be more likely to spread the disease than are colonized people. Infected people may either treat themselves or seek medical care.
Individual behaviors involve selecting new activities from a personal list that is short and constant compared to N, moving to the selected activity location, and then interacting with the other agents at that place. The number of agents at each place is always small with respect to N. The individual, boundedly rational agent behaviors are thus O(⌈ log2(N)⌉) for each agent.
The people in the model have a disease state that can take on any one of three values for each individual. As such, they are asymptotically incompressible.
The model produces two kinds of outputs. The first kind includes an activity entry for each agent for each time step. This is asymptotically thorough. The second kind consists of a summary line for each time step. There is a fixed number of each kind of output. Both types of outputs use straightforward data collection that is linearithmic or less time and space.
The input parameter ranges and counts do not increase with the number of people in the simulation, since the parameters provide constants for the previously described bounded rational behavior. Therefore, modeling studies do not increase the asymptotic time or space complexity. This model implementation is thus O(N⌈ log2(N)⌉) in time and space. Its optimality depends on which outputs are needed to answer the modeling question at issue. What about alternative techniques?
Epidemics have long been studied using system dynamics modeling (Kermack and McKendrick 1927). Compartments are generally used to track the populations of interest. System dynamics epidemic models usually have a fixed number of stocks, often one for each compartment, and a fixed set of flows between stocks. These models have O(C10⌈ log2(N)⌉) = O(⌈ log2(N)⌉) asymptotic time and space performance for constant C10 measuring the time and space usage for the fixed stocks and flows. Obviously, these models have better time and space performance than the previously discussed agent-based version as long as the number of compartments is constant relative to N and limited compartments are sufficient to answer the question at hand.
Consider the use of the model to study disease contagion networks. The needed model output will be the data needed to create a disease spread dendrogram showing who contracted the tracked disease from whom. Now, the model must output the identities of the interacting parties (e.g., agents) every time the disease spreads from person to person. The first model output previously mentioned, namely hourly activity information, meets this requirement. This agent-based model is asymptotically thorough. It remains O(N⌈ log2(N)⌉) in time and space, but it is now optimal under result (14).
What about the O(⌈ log2(N)⌉) system dynamics implementation? As with the previous predator–prey-plant model, it cannot generate the needed outputs. Modifications that allow the system dynamics model to track individual disease states and contacts result in a model with O(N2⌈ log2(N)⌉) terms in each person’s state equation. The result is a model that requires O(N2⌈ log2(N)⌉) space and O(N2⌈ log2(N)⌉) evaluation time. Furthermore, the formulation fixes the maximum number of people allowed in a given run. Rahmandad and Sterman (2008) further explore the relationship between agent-based and system dynamics disease dispersion models.
The runs in Figures 4 and 5 were completed on the 320-node Argonne National Laboratory Fusion Linux cluster. Each Fusion computing node has two Nehalem 2.6 GHz Pentium Xeon processors with 36 GB of RAM.
For fixed word-size computers, we have O(N⌈ log2(N)⌉) = O(N), which is a linear relationship. As predicted, the test measurements of the CA-MRSA model execution time are collectively linear versus N with an adjusted R2 of 1.000 and a p-value less than 2.200 × 10-16. The space measurements are also collectively linear versus N with an adjusted R2 of 0.9999 and a p-value less than 2.200 × 10-16.
The Virtual Market Learning Lab (North et al. 2010) is a large-scale modular imperative agent-based model of consumer markets co-developed by Argonne National Laboratory and Procter & Gamble (P&G). It represents the shopping behavior of consumer households and the business behavior of retailers and manufacturers in a simulated national consumer market. Argonne and P&G successfully calibrated, verified, and validated the resulting agent-based model using several independent, real-world data sets for multiple consumer product categories with more than 60 comparison tests per data set. First, Repast and then later Repast Simphony were used to implement the model. P&G has successfully applied the model to several challenging business problems, where it has directly influenced managerial decision-making and has produced substantial cost savings. The version of the model analyzed in this paper does not use social networking.
The model uses time step scheduling with a step size of one day. Since it is time stepped, it has asymptotically linearithmic scheduling.
The agents in this model are consumer households (n0), retail stores (n1), retail regions (n2), retailers (n3), and manufacturers (n4) (North et al. 2010). Here, N is the sum of ni for i = 1 to 5. In principle, N scales with the number of any of the agent types. In practice, the number of consumers, n0, is always orders of magnitude greater than the counts of the other agents. Thus, we have N = n0. n0 is generally large, so N is as well.
Each consumer household exists in a local neighborhood, buys products in local retail stores, and then uses those products. Buying products means selecting a store and then selecting a product from that store. Using products means selecting an item from inventory, reducing the stored amount of that item, and then updating the agent’s memory about the product usage experience. These processes are O((⌈ log2(N)⌉) in time and space for each agent.
Each consumer household remembers varying attributes of both stores and products. The Miller (1956) range of seven plus or minus two bounds the sizes of the consumer attribute lists. The store and product selection processes depend on these attribute lists. These boundedly rational processes are O(⌈ log2(N)⌉) in time and space for each agent.
Households are randomly created based on draws from an input set of demographically indexed distributions. This process is O(⌈ log2(N)⌉) in time and space for each agent.
Retail stores stock their shelves; adjust prices; compare their prices to other stores in their neighborhood; and offer promotions including flyers, sales, volume discounts, and in-store displays. Retail stores are initialized using an input list of properties. All of these boundedly rational processes are O(⌈ log2(N)⌉) in time and space for each agent.
Retail regions track sales volumes and profits at their stores and provide feedback to their stores on sales goals. Retail regions are initialized using an input list of properties. All of these boundedly rational processes are O(⌈ log2(N)⌉) in time and space for each agent.
Retailers track sales volumes and profits in their regions; provide feedback to their regions on sales goals; advertise; determine stocking options for regions and stores; and receive, use, and distribute trade support from manufacturers. Retailers are initialized using an input list of properties. All of these boundedly rational processes are O(⌈ log2(N)⌉) in time and space for each agent.
Manufacturers maintain and update brand and product lists, advertise, run promotions, adjust suggested retail prices, and offer trade support incentives to retailers. Manufacturers are initialized using an input list of properties. All of these boundedly rational processes are O(⌈ log2(N)⌉) in time and space for each agent.
The agents in the model have a variety of attributes that can take on any double precision value as well as individualized lists, Boolean values, etc. As such, they are asymptotically incompressible.
The model produces two kinds of outputs. The first kind includes a result for each agent for each time step. The second kind consists of a summary line for each time step. There is a fixed number of each kind of output. Both types of outputs use straightforward data collection that is linearithmic or faster in time and space.
The input parameter ranges and counts do not increase with the number of consumers in the simulation, since the parameters provide constants for the previously described boundedly rational behavior. Therefore, modeling studies do not increase the asymptotic time or space complexity. This model implementation is thus O(N⌈ log2(N)⌉) in time and space.
This model fits into the requirements for result (14). Therefore, the Virtual Market Learning Lab is computationally optimal in asymptotic time and space performance.
For fixed word-size computers, we have O(N⌈ log2(N)⌉) = O(N), which is a linear relationship. As predicted, seven test measurements of the model execution time for a fixed number of time steps relative to N and a range of consumer population sizes were found to be collectively linear with an adjusted R2 of 0.9963 and a p-value of 3.221 × 10-6.
Following Holland (1992,1999,2006), complex adaptive systems (CASs) are collections of interacting, autonomous, learning decision makers embedded in an interactive environment. CASs are common in both nature and society. Modeling CASs is challenging for a variety of reasons. The challenges of modeling CASs can largely be overcome by using the individual-level focus of agent-based modeling. This paper’s contribution is to introduce, analyze, and apply a theoretical formalism for proving findings about modular imperative agent-based models. The use of the formalism is demonstrated with three example models. These examples also show how the formalism is useful for predicting the execution time and space requirements for representations of common CASs. We have proven results (1) to (14), including that modular imperative agent-based modeling studies are asymptotically optimal in computational time and space for a common class of modeling problems. Given that modular imperative agent-based modeling is both computationally optimal and a natural structural match for many modeling problems, it follows that modular imperative agent-based modeling is the best modeling method for these situations.
There are many next steps for future work. First, the theoretical formalism can be used to analyze additional applied models for computational complexity and optimality. Second, the range of modeling problems covered by the computational optimality results in this paper might be expanded. Third, the performance results for modular imperative agent-based models violating the computational optimality criteria might be compared to that of other modeling techniques by directly using the formalism. Fourth, the formalism may be used to prove other properties of modular imperative agent-based models. Fifth, the formalism might be extended as modular imperative agent-based modeling practice evolves.
aThe term “linearithmic” refers to relationships of the form (x log2x).
Community-associated methicillin-resistant Staphylococcus aureus
Complex adaptive system
Discrete Event System Specification
Graphical user interface
Nondeterministic polynomial time
Overview, Design Concepts, and Details
Procter & Gamble
Random access machine
Random access stored-program
Extensible markup language.
The submitted manuscript has been created by UChicago Argonne, LLC, Operator of Argonne National Laboratory (“Argonne”). Argonne, a U.S. Department of Energy Office of Science Laboratory, is operated under contract number DE-AC02-06CH11357. Part of this work was supported by National Science Foundation Division of Information and Intelligent Systems (IIS) award number 1125412. Part of this work was supported by National Institutes of Health National Institute of General Medical Sciences Models of Infectious Disease Agent Study (MIDAS) grant number U01GM087729. The U.S. Government retains for itself, and others acting on its behalf, a paid-up nonexclusive, irrevocable worldwide license in said article to reproduce, prepare derivative works, distribute copies to the public, and perform publicly and display publicly, by or on behalf of the government.
The author wishes to thank Charles Macal, David Sallach, and William Rand for providing insightful reviews of this paper and perceptive suggestions for improvement. The author also wishes to thank the Repast team, the CA-MRSA modeling team, and the Virtual Market Learning Lab team for their contributions.
Any opinions, findings, conclusions, or recommendations are solely those of the author.
This article is published under license to BioMed Central Ltd. This is an open access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.