Difference between revisions of "Modeling in Numerus"

From Numerus
Jump to navigation Jump to search
Line 8: Line 8:


[[File:capsule_hierarchy.png|thumb]]
[[File:capsule_hierarchy.png|thumb]]
This figure shows a possible relationship among a set of 4 capsules. In (a) we observe that Capsule '''Main''' requires Capsules '''C1''' and '''C2'''. '''C1''' also requires '''C2''' and '''C3'''. In (b) we see that the actual structure is complicated by the fact that '''Main''' has 2 instances of '''C1''', and so there is a total of 3 instances of '''C2''' and 2 instances of '''C3'''.
<br clear=all>


==Dynamical Systems Models in Numerus==
==Dynamical Systems Models in Numerus==

Revision as of 22:08, 25 January 2018

In Modeling 101 you were introduced to the various paradigms and concepts of computational modeling. Here we discuss how these are realized in Numerus.

Basic Model Design in Numerus

It is important to understand the structure of the Numerus platform in order to implement powerful and complex dynamical system and spatial, agent-based and network models. Numerus provides an impressive range and versatility of components to effectively design and execute models. In addition, Numerus has the capability to implement designs using specialized components. To utilize Numerus's capabilities we must first understand the basics of Numerus's capsule-based architecture.

Capsule, Chip, Submodel

Numerus introduces a modular design feature called a capsule. A capsule is a model space containing interacting components such as Stocks, Flows, Terms, Commands, etc. Each Numerus model is comprised of one or more capsule instances[1] in a hierarchical relationship. A capsule instance called main (which can only have one instance) is at the root of this hierarchy. Instances of other capsules can be inserted into the model space of a given capsule using special container components. The simplest of these is called a chip and it contains a single instance of another capsule. The entire hierarchy of capsules rooted at the chip is called a submodel [2]. Other containers are used to create spatial, agent-based and network architectures and will be discussed below.

Capsule hierarchy.png

This figure shows a possible relationship among a set of 4 capsules. In (a) we observe that Capsule Main requires Capsules C1 and C2. C1 also requires C2 and C3. In (b) we see that the actual structure is complicated by the fact that Main has 2 instances of C1, and so there is a total of 3 instances of C2 and 2 instances of C3.

Dynamical Systems Models in Numerus

Numerus implements several different types of state component. These are distinguished by the fact that they maintain their values across time steps, as opposed to functional components like Terms, which recompute their values at each step. The four state components are:

Stock
The standard DS state component to which one or more Flows can be attached. The Stock's value is updated at each time step based on the values of its Flows.
Stock+Flow
A version of the Stock component with a single incoming Flow. Appropriate for translating a differential equation into a model element.
Sequence
A special type of Stock with a single incoming Flow. The Flow value replaces rather than adds to the Sequence's value.
Store
A container for a value that is modified by code. No state change takes place unless required by the code. A Store acts like a global variable for the model.

Flows in Numerus follow standard rules for system dynamics: they control the movement of value to and from Stocks.

Numerus Terms play several roles, all of which involve computing or delivering a value. A pure Term simply computes a value using the values of other components in the model. A constant Term computes this value only once and maintains it throughout the simulation. A Graph Function Term is derived from a user-defined graph. In Pins and Out Pins are used with capsule chips and described elsewhere. A Spy displays its value on the runtime dashboard. An External Term is derived from input data and is also described in detail elsewhere.

Spatial Models in Numerus

Spatial models in Numerus use a CellMatrix component to represent the landscape of the simulation. The Cell is the fundamental unit of analysis. A CellMatrix maintains an array of cells in either a Cartesian or Hexagonal lattice topology, in which individual cells are aware of both their location and their neighborhoods. Conway's Game of Life [citation] is an example of such a model, with the cells “alive” and “dead” depending on the state of each individual cell's neighbors. Each cell's behavior is individually programmed as a Capsule, which is then assigned to the CellMatrix.

Agent Based Models in Numerus

Agent based models in Numerus are models that make use of an AgentVector. The AgentVector contains the population of Agents, as well as their location. In addition, Numerus includes Simworlds and Networlds. A SimWorld combines an AgentVector with a CellMatrix that provides a landscape. The Networld component uses a NodeNetwork for the same purpose. The SIR model is an example of an agent vector, with agents moving about an open space in three possible states, Susceptible, Infected, and Recovered. The Antz model is a more complicated model that uses both an agent vector and a cell matrix in order to simulate how ants collect food and leave a path for other ants to follow in order to find the same food.

Numerus has a lot of tools that make agent based models simpler and more robust. In particular, it is very easy to have access to all agents and cells from each individual agent, and to incorporate a wide variety of local and global effects. It also makes it simple to set up multiple Sim Worlds in order to see various outcomes simultaneously. It is also built on arrays and methods, which makes it simple to work on a small level to tweak the model to the user’s liking. On the other hand, the visual side of Numerus makes it so that it is easy to quickly and efficiently set up the shell of an agent based model and immediately get down to the more important details involved in the model. A savvy Numerus programmer will begin an agent based model visually and slowly transition over to handling the methods and functions in a more programming heavy reference frame.

Network Based Models in Numerus

Chip Basics

As the Numerus Glossary states, a Chip is a Container component which contains a single Capsule instance. A Capsule is a prototype for a simulation unit. It contains base components and may contain other chips, inputs, and / or outputs. These definitions may appear a bit vague or broad, however, that is simply because Chips and Capsules are widely used in a variety of ways within Numerus.

Chip structure and usage in Numerus may best be understood through example. Click here for an example of using a preexisting model (from the Model Library) and manipulating the ideas of model layers and chips.

Population Model 101

See the Simple Population Model tutorial in the Model Library. This tutorial demonstrates fundamental Numerus usage, including how to operate the Graphical User Interface, or GUI, and its algorithmic and mathematical design. You will see basic usage of the Modeling Canvas and the Dashboard as well as Numerus's intuitive mathematical design.


  • Get a run through of NumerusMB's GUI here.

Notes

  1. Note the distinction between capsule and capsule instance. A capsule describes a model space containing interacting components. A capsule instance represents one specific use of that capsule. A capsule may have many instances in a project. Capsule and capsule instance may be used interchangeably when there is no possible ambiguity.
  2. The only restriction is on circularity: no submodel can contain a capsule that contains that submodel.