Modelling Complex Software Systems

Complex Systems

Complex Systems

What is a system?

What makes a system complex?

What is a complex system?

Properties

Emergence

Self-organisation

Decentralisation

Feedback

What is a model?

Why build models?

Mathematical models

Macro-Equations

Computational Models

No macro-equations

Agent-based models (ABMs)

Steps in modelling complex system

  1. define key questions
  2. identify structure - parts and interactions - of system
  3. define possible states for each part
  4. define how state of each part changes over time through interactions
  5. verify, validate, evaluate model: simplicity, correctness, robustness
  6. define, run experiments to address key questions

Questions in complex system modelling

Dynamical systems and Chaos

Summary of Dynamic Behavious

What is a dynamical system?

Functions and iteration

Population growth

Fox population

Model refinement: logistic model of population growth

Logistic Map

\(x_{t+1} = rx_t(1-x_t)\)

$r \in [0,1]$

r = 0.9

$r \in [1,3)$

r = 1.5

$r \ge 3$

r = 3.84

$r = 4.0$: Chaotic attractor

r = 4

Chaos

A system is chaotic if it displays all of the following properties

  1. deterministic update rule: not random; given same starting conditions, get same result
  2. aperiodic system behaviour: trajectory does not repeat
  3. bounded system behaviour: exponential never repeats but aperiodicity is not interesting; logistic map bounded between 0 and 1
  4. sensitivity to initial conditions: butterfly effect; wildly varying outputs with only small modification to inputs

Bifurcation Diagrams

bifurcation diagram of logistic map

Numerical solution of ODEs

Euler method

for the system $y’(t) = f(t, y(t))$

\(y_{n+1} = y_n + \Delta t .f(t_n, y_n)\) \(t_{n+1} = t_n + \Delta t\)

euler

Runge-Kutta

Matlab

ODE Models: Predator-Prey

Lotka-Volterra Model

Assumptions

Building our model

\[P_{t+1} = rP_t\]

Decompose growth rate $r$ into birth rate $B$ and death rate $D$

\[P_{t+1} = (B-D)P_t = BP_t - DP_t\]

For rabbits, define

Then we have:

\[R_{t+1} = \alpha R_t - \beta R_t F_t\]

Similarly for the fox population, define:

Then we have:

\[F_{t+1} = \delta R_t F_t - \gamma F_t\]

This was done for discrete time. Converting to continuous time

Formulation

Prey (rabbits): \(\frac{dR}{dt} = \alpha R - \beta RF\) Predators (foxes): \(\frac{dF}{dt} = \delta RF - \gamma F\)

Behaviour

Numerical solution of Lotka-Volterra

lotka-volterra

phase plane

Analysis

Long term behaviour

\(R(\alpha-\beta F) = 0\) \(F(\delta R - \gamma) = 0\)

Dependence on initial conditions

Lotka-Volterra with intraspecies competition

\(\frac{dR}{dt} = \alpha R - \beta RF - aR^2\) \(\frac{dF}{dt} = \delta RF - \gamma F - bF^2\)

lotka-volterra intraspecies competition

Other considerations

Lotka-Volterra with multiple species

\[\frac{dx_i}{dt} = r_i x_i(1 - \frac{\sum_{j=1}^N{\alpha_{ij}x_j}}{K_i})\] \[\frac{dx_i}{dt} = x_i(r_i + \sum_{j=1}^N A_{ij}(1-x_j))\]

Lynxes and Hares

lynx-hare

Applicability of Lotka-Volterra

ODE Models: Epidemics

Questions for models

Infectious Disease Models

SIR model

Implementation 1

Probabilistic events

Running the model

Turning the knobs

How does contact scale with population size?

contact scaling

\[\lambda = (\text{\# contacts})(\text{prob. of transmission})(\text{prob. a contact is infectious}) = cq\frac{I}{N}\] \[\lambda = \beta I\]

Implementation 2

Sampling from a distribution

Running the model

Comparison to implementation 1

Large population outbreak

outbreak

Stochastic Models

Basic reproduction number

reproduction

Behaviour when $R_0$ near 1

Stochastic models

Implementation 3: Deterministic SIR

Deterministic models

Deterministic SIR

det-sir

Recovery rate and duration of infection

Running Det SIR

det-sir

Differential equations

\(\frac{dS}{dt} = - \beta SI\) \(\frac{dI}{dt} = \beta SI - \gamma I\) \(\frac{dR}{dt} = \gamma I\)

Basic reproduction number and outbreak size

final attack rate

Examples

Measles

Chicken pox

Mumps

Smallpox

Fitting SIR to data

Vaccination

vaccination

\[v \ge 1 - \frac{1}{R_0}\]

R0 and vaccination

vaccine coverage

Extensions: Demography

deterministic SIR with demography

\(\frac{dS}{dt} = mN - \beta SI - mS\) \(\frac{dI}{dt} = \beta SI - \gamma I - mI\) \(\frac{dR}{dt} = \gamma I - mR\)

sir demographics

Extensions: Demography + Vaccination

det sir with dem + vacc

SIR Summary

Cellular Automata

Mathematical, top down models

Computational models

Spatial Model

Cellular Automata

ca

Properties

Applications

Formal definition

1D CA

1d ca

Rule 30

rule 30

Rule 110

rule 110

Discrete Time Dynamics

discrete time dynamics

Wolfram classes

  1. Fixed homogeneous state: system freezes into a fixed state after a short time
  2. Fixed inhomogeneous state: system develops periodic/limit cycle behaviour
  3. Chaotic/aperiodic behaviour: system continuously changes in unpredictable ways, and in some cases has sensitive dependence on initial conditions
  4. Evolve to complex localised structures: evolves in highly patterned but unstable ways; complex interactions between local structures; focus of study for computational properties

wolfram classes

2D CAs

von Neumann vs Moore neighbourhoods

Conway’s Game of Life

life

life turing

CA Model Implementation

Design Decisions

Space

Time

Information

State Update

CA Lotka-Volterra

CA SIR

Model 2

Exploring model behaviour

Extensions to basic CA

Pros/cons of CAs

Agent-based Models

Flocking behaviour

Agent

Environment

boid neighbourhood

Rules

boid sep

boid cohesion

boid align

Agent Characteristics

Environment

Interactions

Foraging in an Ant Colony

Experiment 1: Equal length bridge

Experiment 2: Unequal length bridge

Ant rules

Environment

Agent decision making

Decision making strategies

Choice of strategy depends on purpose of model Ranges from simple to complex: usually best to keep it as simple as possible until complicated rules necessary

Agent Types

Reflexive agents

reflexive agent

Reflexive agents with internal state

reflexive-internal

Goal driven agents

goal-driven

Utilitarian agents

utilitarian

Learning agent

Summary

ABM Development and Applications

Parcel delivery

Travelling salesman problem (TSP)

Ant colony optimisation

aco

Ant colony optimisation algorithm

  1. distribute $N$ ants at random among nodes
  2. each ant randomly choose new node to travel to, based on
    • pheromone concentration on edge to that node, weighted by $\alpha$
    • distance to that node, weight by $\beta$
    • must not have visited the node previously
  3. repeat 2 until each ant has visited all nodes
  4. calculate total route length for each ant
  5. ant with shortest route deposits pheromone along edges in their route, with concentration inversely proportional to route length, making this edge more likely to be chosen in the future
  6. pheromones evaporate at rate $\rho$

Networks: Theory and Models

Research

Euler’s 7 bridges, 1735

Milgram’s small world experiments, 1960s

Other research

Examples

Internet

Why networks?

Properties

Network type by nodes

Network type by edges

Initial Assumptions

Density

\[D = \frac{2E}{N(N-1)}\]

density

Degree

Distance

\[L = \frac{1}{N(N-1)} \Sigma_{i\not = j}{d_{ij}}\]

distance

Clustering

clustering

\[C = \frac{T_c}{T_c+T_o}\] \[C_i = \frac{2E_i}{k_i(k_i-1)}\]

Centrality

centrality

Assortativity

Network Types

Regular Lattices

degree distribution

regular lattice

circular lattice

Random Networks

random network

Small World Networks

small world

Rewiring in small world networks

$C(p)/C(0)$: average clustering coefficient of a lattice with proportion $p$ edges rewired relative to $0$ edges rewired $L(p)/L(0)$: average shortest path of a lattice with proportion $p$ edges rewired relative to $0$ edges rewired

rewiring

Scale free networks

degree distribution

scale free network

Constructing Scale Free network

  1. start with small number of randomly connected nodes
  2. add a new node to the network
  3. connect the new node to $m$ existing nodes with a probability proportional to the current degree of those nodes
  4. repeat steps 2 and 3.

Properties of Scale free networks

Summary

Network Dynamics and ABMS

Network Dynamics

Dynamics on Networks: SIR Disease Model

sir revisiion

STI Transmission

sexual partner network

SARS 2002-2003

sars

Dynamics of Networks

Adaptive networks

adaptive networks

Networks and ABMs

Petri Nets

Constructs

Places $P$

place

Transitions $T$

transition

Arcs $F$

arc

Net Structures

net structure

\(N = (P, T, F)\) \(P = \{A,B,C,D,E,F,G,H\}\) \(T = \{a, b, c, d, e\}\) \(F = \{(a,B), (a,E), (a,F), (A,a), (E,a), (G,a),...\}\)

Tokens

token

Marking

Elementary net systems

cookie vending machine

Markings can be represented in one of the following ways: \(M_0 = \{(A,0),(B,0),(C,0),(D,1),(E,5),(F,0),(G,1),(H,5)\}\) \(M_0 = DEEEEEGHHHHH\)

Pre- and Post-set

Transition Enablement

enabled transition

Step rule

step rule

vending machine steps

Hot and Cold Transitions

Interleaving Semantics

Reachable Markings

For a net system $S = (N, M_0)$ a marking $M$ of $N$ is a reachable marking of $S$ if $\exists$ sequence of stops \(M_0 \xrightarrow{t_1}M_1 \xrightarrow{t_2}...\xrightarrow{t_n}M_n\)

petri eg

Sequential Runs/Occurrence Sequences

petri eg-2

Interleaving semantics

Marking Graphs/Reachability Graphs

marking graph

Marking graphs and LTS

Concurrency Semantics

Actions

Action

Distributed Runs/Causal Nets

distributed run

Concurrency semantics

Sequential vs Distributed Runs

systems

distributed runs

Causality and Concurrency Relations

concurrency relations

Petri nets and Software Engineering

program

Summary

Petri nets:


Edit this page.