agent-based modelling using matlab modelling using matlab outline outline of topics concepts about...

23
Agent-based modelling using MATLAB Agent-based modelling using MATLAB Shan He School for Computational Science University of Birmingham Module 06-23836: Computational Modelling with MATLAB

Upload: vunhi

Post on 07-May-2018

229 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

Agent-based modelling using MATLAB

Shan He

School for Computational ScienceUniversity of Birmingham

Module 06-23836: Computational Modelling with MATLAB

Page 2: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

Outline

Outline of Topics

Concepts about Agent-based Modelling

Modelling process of agent-based modelling

A detailed example: BOIDs

Conclusion

Page 3: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

Concepts about Agent-based Modelling

What is Agent-based Modelling (ABM)?

I Other names: Agent-based simulation, Individual-basedmodelling.

I A new modelling method: not equation-based, but based on apopulation of agents.

I An agent:I A discrete entity with its own goals and behavioursI Autonomous: with a capability to adapt and modify its

beahaviours

I A new research field: have been widely applied to biology,social sciences and other scientific fields and business.

Page 4: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

Concepts about Agent-based Modelling

Some examples

I Agent-Based Models in Biology and Medicine

I Agent-based computational economics

I The Economist: Agents of change

I Nature: Meltdown modelling

I Managing Business Complexity: Discovering StrategicSolutions with Agent-Based Modeling and Simulation

Page 5: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

Concepts about Agent-based Modelling

The assumptions behind ABM

I Some key aspect of behaviours can be described.

I Mechanisms by which agents interact can be described.

I Complex behaviours are emerged from simple, usually localinteractions.

I The model is built “from the bottom up”.

Page 6: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

Modelling process of agent-based modelling

Modelling process

SimulationDefinitionIdentification

ValidationAnalysis Satisfied?

No

Yes

Page 7: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

Modelling process of agent-based modelling

Definition

I Step 1: Define the agent types and other objects along withtheir attributes.

I Step 2: Define the environments the agent will live in andinteract with

I Step 3: Define agent method for updating the agent’sattribute in response to their interactions with other agentsand the environment.

I Step 4: Define behavioural rules to specify which agentsinteract, when they interact and how they interact. This canbe changed to other methods, e.g., ANN as we shall seeshortly.

Page 8: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

A detailed example: BOIDs

Animal swarming behaviour

Pictures from NY Times

Starlings flocking video

Page 9: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

A detailed example: BOIDs

BOIDs: ABM of animal schooling/flocking behaviour

I Invented in 1986 by Craig Reynolds to simulate coordinatedanimal motion such as bird flocks and fish schools.

I A giant step forward in computer animation: animation‘emerges’ from complex system

I First film: Stanley and Stella in: Breaking the Ice

I Used in Tim Burton’s film Batman Returns: bat swarms and”army” of penguins marching through the streets of GothamCity.

I Winner of technical Oscar: 1997 Sci-Tech Awards fromAcademy of Motion Pictures and Science.

Page 10: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

A detailed example: BOIDs

Batman Returns

Page 11: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

A detailed example: BOIDs

How BOIDs is developed?

I Assumption: the global patterns are the emergingphenomena from interaction of birds or BOIDs.

I Let’s follow the definition steps:

I Step 1: Identify the agent types and other objects along withtheir attributes.

I Agent: only Birds, or BOIDs

I Agent attributes: position and velocity

Page 12: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

A detailed example: BOIDs

How BOIDs is developed?

I Step 2: Define the environments the agent will live in andinteract with

I A simple 2D or 3D world, no other objects.

Page 13: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

A detailed example: BOIDs

How BOIDs is developed?

I Step 3: Specify agent method for updating the agent’sattributes in response to their interactions with other agentsand the environment.

I Only consider interactions between BOIDs:- update a BOID’sattribute, e.g., position and velocity in response to theirinteractions with other BOIDs.

Page 14: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

A detailed example: BOIDs

How BOIDs is developed?

I Step 4: Define behavioural rules to specify which agentsinteract, when they interact and how they interact.

I The most difficult step: usually done by trail-and-error.

I Sometimes obtestation can be used to derive the behaviouralrules and then validate by experiments.

I Ideally, the rules should be derived based on experimentaldata – data-driven modelling.

I It is possible to automatically generate/evolve behaviouralrules by computer, e.g., Artificial Neural Network andEvolutionary Computation.

Page 15: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

A detailed example: BOIDs

BOIDs: three simple rules

I Repulsion: steer to avoid crowding local flockmates

I Alignment: steer towards the average heading of localflockmates

I Cohesion: steer to move toward the average position of localflockmates

Page 16: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

A detailed example: BOIDs

BOIDs: reaction zones

Page 17: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

A detailed example: BOIDs

BOIDs: Repulsion

Repulsion zone

Page 18: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

A detailed example: BOIDs

BOIDs: Alignment

Alignment zone

Page 19: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

A detailed example: BOIDs

BOIDs: Attraction

Attraction zone

Page 20: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

A detailed example: BOIDs

Implementing BOIDs in MATLAB

I First question: What data structures should we used?

I Requirement: Can easily store/retrive data, ideally should bedifferent types of data, e.g., integer, string or even a datastructure.

I Cell Array or Structure Array or Object?

I Cell Array is more convenient for coding, e.g, number asindex, but bad for code clarity.

I Object stores data in named fields and also encapsulates theoperations perform on data, but comes with complexity forcoding.

I Structure Array stores data in named fields and relativelyconvenient for coding, therefore it is more suitable for ourBOID model.

Page 21: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

Conclusion

Advantages

I It captures emergent phenomena, therefore, it is a better toolfor modelling complex systems.

I It provides a natural description of a system. The behaviouralrules can be expressed by natural language, which is easy tobe understood.

I It is flexible, e.g., heterogeneous agents and theadaptive/evolving rules.

Page 22: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

Conclusion

Disadvantages

I Models too simple: it is very easy to introduce too manyassumptions to oversimplified the model.

I Models too complicated: it is also very easy to introduce toomany rules to overcomplicate the model.

I Solution: Use the modelling principle and process in the 2ndLecture.

I Error-prone: many lines of code – very easy to make mistakewhen coding.

I Difficult to determine model parameters.

Page 23: Agent-based modelling using MATLAB modelling using MATLAB Outline Outline of Topics Concepts about Agent-based Modelling Modelling process of agent-based …

Agent-based modelling using MATLAB

Conclusion

Other agent-based modelling tools

I MATLAB is limited in 2D/3D animation.

I Other tools are more powerful:

I Netlogo

I SWARM

I Repast

I MASON

I Processing