g54sim (spring 2016)pszps/g54sim/2016/g54sim-lec05_2016_full.pdf · case study: experimentation •...

49
G54SIM (Spring 2016) Agent-Based Modelling and Simulation Peer-Olaf Siebers [email protected]

Upload: others

Post on 15-Aug-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

G54SIM (Spring 2016)

Agent-Based Modelling and Simulation

Peer-Olaf Siebers

[email protected]

Page 2: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Motivation

• Introduce the concepts of – Agents

– Agent-Based Modelling (ABM)

– Agent-Based Simulation (ABS)

• Provide some insight into how ABS works internally

• Provide some ideas for defining ABMs

• Provide some insight into the application opportunities of agent-based simulation

G54SIM 2

Page 3: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Simulation Modelling Framework

G54SIM 3

Page 4: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent-Based Modelling and Simulation

Page 5: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent-Based Modelling

• Heroes and Cowards Game [Wilensky and Rand 2013]

5 G54SIM

Page 6: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

G54SIM 6

Page 7: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

• Heroes and Cowards Game : All heroes

Agent-Based Modelling

7 G54SIM

Page 8: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

• Heroes and Cowards Game: All cowards

Agent-Based Modelling

8 G54SIM

Page 9: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent-Based Modelling

9

• Heroes and Cowards Game: Source Code

G54SIM

Page 10: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent-Based Modelling

• Flocking behaviour

G54SIM 10

Page 11: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent-Based Modelling

• Flocking behaviour modelling by Craig Reynolds [url]

G54SIM 11

http://ayearincode.tumblr.com/post/107414487116/this-morning-i-added-some-new-rules-to

Page 12: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent-Based Modelling

• In Agent-Based Modelling (ABM), a system is modelled as a collection of autonomous decision-making entities called agents. Each agent individually assesses its situation and makes decisions on the basis of a set of rules.

• ABM is a mindset more than a technology. The ABM mindset consists of describing a system from the perspective of its constituent units. [Bonabeau 2002]

• ABM is well suited to modelling systems with heterogeneous, autonomous and proactive actors, such as human-centred systems.

G54SIM 12

Page 13: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent-Based Modelling

• Borrowing from Artificial Intelligence: From simple to complex – Simple reflex agent

G54SIM 13

Russell and Norvig (2003)

Page 14: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent-Based Modelling

• Borrowing from Artificial Intelligence: From simple to complex – Learning agent

G54SIM 14

Russell and Norvig (2003)

Page 15: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent-Based Modelling

• What do we mean by "agent"? – Agents are "objects with attitude" [Bradshaw 1997]

• Properties: – Discrete entities

• With their own goals and behaviours

• With their own thread of control

– Autonomous decisions

• Capable to adapt

• Capable to modify their behaviour

– Proactive behaviour

• Actions depending on motivations generated from their internal state

G54SIM 15

Page 16: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent-Based Modelling

• The agents can represent individuals, households, organisations, companies, nations, … depending on the application.

• ABMs are essentially decentralised; there is no place where global system behaviour (dynamics) would be defined.

• Instead, the individual agents interact with each other and their environment to produce complex collective behaviour patterns.

G54SIM 16

Page 17: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent-Based Modelling

• Benefits of ABM – ABM provides a natural description of a system

– ABM captures emergent phenomena

• Emergence – Emergent phenomena result from the interactions of individual

entities. The whole is more than the sum of its parts [Aristotle BC] because of the interactions between the parts.

– An emergent phenomenon can have properties that are decoupled from the properties of the part (e.g. patterns appearing).

– Example: Traffic Jam Dynamics

G54SIM 17

Page 18: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent-Based Modelling

• When to use ABM? [Siebers et al. 2010]

– When the problem has a natural representation as agents - when the goal is modelling the behaviours of individuals in a diverse population

– When agents have relationships with other agents, especially dynamic relationships - agent relationships form and dissipate, e.g., structured contact, social networks

– When it is important that individual agents have spatial or geo-spatial aspects to their behaviours (e.g. agents move over a landscape)

– When it is important that agents learn or adapt, or populations adapt

– When agents engage in strategic behaviour, and anticipate other agents' reactions when making their decisions

– ...

G54SIM 18

Page 19: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent-Based Simulation

• The Sims: Interactive Organisational Agent-Based Simulation

19 G54SIM

Page 20: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

• Alternative (e.g. Ecology)

Agent-Based Simulation

• Building an ABS model (OR/MS) – Identify active entities (agents)

– Define their states and behaviour

– Put them in an environment

– Establish connections

– Test the model

• Validating an ABS model – System behaviour is an emergent property

– Validation on a micro level

G54SIM 20

Grimm and Railsback (2005)

AnyLogic Help (2013)

Page 21: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent-Based Simulation – Updating Information

• Synchronous approach [Macal 2013]

– Loop over time horizon

• Loop over randomised list of agents. For each agent A in list:

– Execute agent A behaviour

– Update state of agent A (based on agent A's state, the states of agents that interact with agent A, and the state of the environment).

– Update other agents states and the environment (if appropriate)

• End loop over randomized list of agents

– Increment t in time loop and repeat until end of simulation time horizon

21 G54SIM

Page 22: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent-Based Simulation – Updating Information

• Asynchronous approach [openABM.org 2014]

– Event driven

• An action of one agent may trigger the updating of another agent

– Example: An agent A sending messages to an agent B

22 G54SIM

Page 23: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Object Oriented ABM Using UML for ABM

Page 24: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Unified Modelling Language (UML)

24 G54SIM

Page 25: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Defining Behaviour Using State Charts

• Typical elements of a state chart diagram – States

• Represents a location of control with a particular set of reactions to conditions and/or events

• Examples

– Cup can be in state full or empty

– Person can be in state idle or busy

– Transitions

• Movement between states, triggered by a specific event

25 G54SIM

Page 26: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Defining Behaviour Using State Charts

• Typical elements of a state chart diagram

26 G54SIM

Page 27: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Simple Agent-Based Example

27 G54SIM

Page 28: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Building a Simple State Chart Step-by-Step

• Office workers – Who are the actors?

– What are the key locations you can find them?

– What are key time consuming activities they get involved in?

28 G54SIM

Page 29: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Building a Simple State Chart Step-by-Step

• What is the principal difference between these solutions?

29 G54SIM

Page 30: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent Oriented DES

Page 31: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent Oriented DES in OR/MS

• Facts about Simulation Studies in different disciplines

31

after Robinson (2010)

G54SIM

Page 32: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent Oriented DES in OR/MS

• Hybrid solution for OR/MS – In OR/MS we often have combined DES/ABS models where we

represent the process flow as a DES model and then add some active entities (to replace the passive DES entities) that are autonomous and can display proactive behaviour.

G54SIM 32

Page 33: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

33 SSIG Meeting 24/03/2011 (Surrey)

Direct interactions Network activities

Active entities Behavioural state

charts

Passive entities Queues

Processes Resources

DES layer

Agent layer

Communication layer

Replace passive entities by active ones

Let entities interact + communicate

G54SIM

Page 34: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Agent Oriented DES in OR/MS

• Agent Oriented DES version of the booking clerk model? – Might respond flexible when too many phone callers are in the line

– Customers might remember previous experience and act accordingly

– Modelling word of mouth regarding service quality - how much impact does the reputation of the clerk have on the business?

– Booking clerk might show symptoms of fatigue during a long shift and therefor vary in service speed

G54SIM 34

Page 35: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Case Study

Office Energy Consumption

(For more details see Zhang et al 2010)

Page 36: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Case Study: Context

• Office building energy consumption – We focus on modelling electricity consumption

– Organisational dilemma

• Need to meet the energy needs of staff

• Need to minimise its energy consumption through effective organisational energy management policies/regulations

• Objective – Test the effectiveness of different electricity management strategies,

and solve practical office electricity consumption problems

G54SIM 36

Page 37: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Case Study: Modelling

• Electricity consumption (case study) – Base electricity consumption: security devices, information displays,

computer servers, shared printers and ventilation systems.

– Flexible electricity consumption: lights and office computers.

• Current electricity management technologies (case study) – Each room is equipped with light sensors

– Each floor is equipped with half-hourly metering system

• Strategic questions to be answered (case study) – Automated vs. manual lighting management

– Local vs. global energy consumption information

G54SIM 37

Page 38: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Case Study: Modelling

• We distinguishing base appliances and flexible appliance – Examples for base appliances

• Security cameras

• Information displays

• Computer servers

• Refrigerators

– Examples for flexible appliances

• Lights

• Desktop computers

• Printers

G54SIM 38

Page 39: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Case Study: Modelling

• The mathematical model – Ctotal = Cbase + Cflexible

• where Cflexible = β1*Cf1+ β2*Cf2+ … + βn*Cfn

• and Cf1 …Cfn = maximum electricity consumption of each flexible appliance

• and β1 … βn = parameters reflecting the behaviour of the electricity user

– β close to 0 = electricity user switches flexible appliances always off

– β close to 1 = electricity user leaves flexible appliances always on

– Ctotal = Cbase + (β1*Cf1+ β2*Cf2+ … + βn*Cfn)

G54SIM 39

Page 40: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Case Study: Modelling

• Knowledge gathering – Consultations with the school's director of operations and the

university estate office

– Survey amongst the school's 200 PhD students and staff on electricity use behaviour (response rate 71.5%)

• User stereotypes – Working hour habits

• Early birds, timetable compliers, flexible workers

– Energy saving awareness

• Environment champion; energy saver; regular user; big user

G54SIM 40

Page 41: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Case Study: Modelling

• Conceptual model

G54SIM 41

Page 42: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Case Study: Modelling

G54SIM 42

Page 43: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Case Study: Implementation

G54SIM 43

Page 44: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Case Study: Experimentation

G54SIM 44

Page 45: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Case Study: Experimentation

• Validation – Comparing simulation and empirical results

G54SIM 45

0

10

20

30

40

50

60

70

80

Ele

ctri

city

co

nsu

mp

tio

n [

kWh

]

Day of the week

Automated operation: Base scenario (simulation) Automated operation: Empirical data

Page 46: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Case Study: Experimentation

• Scenario #1 – Comparing automated and manual operation (low user interaction)

G54SIM 46

0

10

20

30

40

50

60

70

80

Ele

ctri

city

co

nsu

mp

tio

n [

kWh

]

Day of the week

Automated operation: Base scenario (simulation) Manual operation: High user interaction (simulation)

Monday Tuesday Wednesday Thursday Friday Saturday Sunday

Page 47: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

Questions and Comments

G54SIM 47

Page 48: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

References

• AnyLogic (2015). AnyLogic Online Help [http://www.anylogic.com/anylogic/help/]

• Aristotle (BC). Aristotle quotes [http://www.online-literature.com/aristotle/]

• Bonabeau (2002). Agent-based modeling: Methods and techniques for simulating human systems. In: Proceedings of the National Academy of Science of the USA. 99:7280-7287

• Bradshaw (1997). Software agents

• Grimm and Railsback (2005). Individual-Based Modeling and Ecology (Princeton Series in Theoretical and Computational Biology)

• Macal (2013). SimSoc Newsgroup post "Re: Execution algorithm for agent-based simulation" [https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=simsoc;d0153e87.1302]

• openabm.org (2015). OpenABM website [https://www.openabm.org/]

• Perkins et al (2015). Modelling and Simulation of Rail Passengers to Evaluate Methods to Reduce Dwell Times. In: Proceedings of the 14th International Conference on Modeling and Applied Simulation (MAS2015), 21-23 Sep, Bergeggi, Italy

• Robinson (2010). Modelling Service Operations: A Mixed Discrete-Event and Agent Based Simulation Approach. Presentation given at the Western OR Discussion Society on 27 April

• Russell and Norvig (1995). Artificial intelligence: A modern approach

G54SIM 48

Page 49: G54SIM (Spring 2016)pszps/g54sim/2016/G54SIM-Lec05_2016_full.pdf · Case Study: Experimentation • Validation –Comparing simulation and empirical results G54SIM 45 0 10 20 30 40

References

• Russell and Norvig (1995). Artificial intelligence: A modern approach

• Siebers et al. (2010). Discrete-event simulation is dead, long live agent-based simulation! Journal of Simulation, 4(3) pp. 204-210

• Shannon (1975). Systems simulation: The art and science. Prentice-Hall: Englewood Cliffs, NJ

• Wilensky and Rand (2013) Introduction to agent-based modeling: Modeling the natural, social and engineered complex systems with NetLogo

• Zhang et al (2010). Modelling office energy consumption: An agent based approach. In: Proceedings of the 3rd World Congress on Social Simulation (WCSS2010), 5-9 September, Kassel, Germany

A special thanks goes to Jamie Rodgers for finding a long lost reference for me.

G54SIM 49