This is part 65 of a series of articles featuring the book Beyond Connecting the Dots, Modeling for Meaningful Results.
To this point our primary modeling tool has been the stock and flow diagram. This type of diagram is useful for summarizing systems from a high-level viewpoint. The stock is a primitive that can model entities that take on a range of values. Flows are well suited for specifying the changes in stocks.
In addition to representing aggregate systems, stock and flow diagrams are also used to model things on an individual level. For instance, a model of a person’s motivations could be represented using a stock and flow diagram. The strength or importance of each type of motivation – money, family, etc… – could be represented as stocks, with flows modulating the strength of these motivations over time.
When looking at the individual scale however, we oftentimes find ourselves wanting to define characteristics of the individual using simple on/off logic. For instance, take the issue of an individual’s sex. We can represent this using two categories: Male or Female (leaving aside transgendered individuals for the sake of simplicity). Similarly, when constructing a model of a disease, we might want to say a person is either sick or not sick (with no nuances such as “slightly sick” or “highly sick”). You can attempt to represent these different categories using stocks, but the formulation and equations to do so will be overly complicated.
Where the stock and flow diagram is used to model changing systems with continuous stocks, the state transition diagram is used to model systems with discrete on/off states. Within Insight Maker, state transition diagrams are constructed in almost the same way as stock and flow diagrams. The key difference is that all stocks are replaced with State primitives and all flows are replaced with Transition primitives. State primitives can be added to the model by right-clicking on the model diagram and selecting . Transition primitives will automatically be created when you connect two state primitives using the standard “Flow” connection type.
A state primitive is possibly the simplest primitive available, as it can only take on one of two values: true or false. When the state value is true, the state is active. When the state value is false, the state is not active and the agent does not occupy that state. When configuring a state primitive, you only need to specify whether the state is initially active or not at the start of the simulation. This initial condition can simply be true or false, but it can also be a logical equation that depends on the values of other primitives in the agent. For example, suppose you had a variable in the agent called Size and you wanted a state to be initially active if the value of Size was greater than 5. You could use the following as the initially active property for the state: [Size] > 5.
A transition primitive moves an agent between states. For instance, if you had two states in your model – Healthy and Sick – you could have one transition primitive moving agents from the healthy state to the sick state (simulating infection) and another transition primitive moving them the other way (simulating recovery).
There are three ways a transition from one state to another can be triggered:
- Timeout: In this mode the transition will be triggered a specific amount of time after the first state becomes active. For instance, if we had a disease model where the disease lasted 10 days, we could have a transition from the sick to healthy state using a timeout trigger with a period of 10 days.
- Probability: In this mode there is a probability of the transition happening each time period. For instance, in the disease model if the disease only lasted 10 days on average but could randomly last longer or shorter, you could use a probability transition with a daily probability of 0.1.
- Condition: In this mode you create an equation that will trigger the transition when it becomes true. For instance, if we had a stock, Infection Level in our agent indicating how sick the agent was, we could have them transition out of the sick state once that stock fell to zero. The trigger condition to enable this could be something like: [Infection Level] = 0.
|Specify a transition trigger type and value for the following types of transition:
|Create a state transition diagram for a model of a person with three states: Child, Adult, Retired. The person starts in the Child state, transitions to the Adult state when they are 18 years old, and has a 2% chance of transitioning to the Retired state each year.|
A model illustrating the use of state transition diagrams to model a simple disease can be found in Chapter 10 of Beyond Connecting the Dots.
Next edition: Modeling With Agents: Creating Agents.