MAS 2011 Lecture 1

Embed Size (px)

Citation preview

  • 7/28/2019 MAS 2011 Lecture 1

    1/42

    Agent-Based Simulation

    Agent-Based Simulation

    Principles of simulation and the Multi-Agent approach

    Federico Pecora

    School of Science and Technologyrebro [email protected]

    Federico Pecora Agent-Based Simulation Part 1 1 / 37

    http://localhost/var/www/apps/conversion/tmp/scratch_8/[email protected]://localhost/var/www/apps/conversion/tmp/scratch_8/[email protected]://find/http://goback/
  • 7/28/2019 MAS 2011 Lecture 1

    2/42

    Agent-Based Simulation

    Outline

    1 Goals and structure of this course

    2 What is simulation?

    3 The Multi-Agent approach

    4 Principles of simulation design and implementation

    Federico Pecora Agent-Based Simulation Part 1 2 / 37

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    3/42

    Agent-Based Simulation

    Goals and structure of this course

    Outline

    1 Goals and structure of this course

    2 What is simulation?

    3 The Multi-Agent approach

    4 Principles of simulation design and implementation

    Federico Pecora Agent-Based Simulation Part 1 3 / 37

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    4/42

    Agent-Based Simulation

    Goals and structure of this course

    Goals of this course

    Learn about Multi-Agent simulation and its advantages

    Understand concepts of simulation engineering

    Learn how to perform a Multi-Agent simulation study

    Experience practical development in Multi-Agent simulation

    environments

    Federico Pecora Agent-Based Simulation Part 1 4 / 37

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    5/42

    Agent-Based Simulation

    Goals and structure of this course

    Structure of the course

    Principles of simulation and the Multi-Agent approach

    Cellular Automata

    Lab assignment 1 (Golly)

    Behavioral Models for Coordinated Motion

    Lab assignment 2 (Crossroads)

    Lab assignment 3 (WildLife)

    Swarm Intelligence and Ant Colony OptimizationAdvanced topics, Review, Q&A

    Federico Pecora Agent-Based Simulation Part 1 5 / 37

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    6/42

    Agent-Based Simulation

    Goals and structure of this course

    Evaluation criteria and exam

    This course is composed of labs and theory

    For labs, you get either G (passed) or U (failed)

    For theory, you are graded in the system you are registered with

    (U,3,4,5), (U,G,VG) or (F,E,D,C,B,A)Theory is assessed through an exam

    80 points in total

    40 points required to pass

    the 80 points are mapped to grades as follows:

    (U,3,4,5) ([0,39], [40,54], [55,70], [71,80])(U,G,VG) ([0,39], [40,69], [70,80])(F,E,D,C,B,A)

    ([0,39], [40,47], [48,55], [56,63], [64,71], [72,80])

    Federico Pecora Agent-Based Simulation Part 1 6 / 37

    A t B d Si l ti

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    7/42

    Agent-Based Simulation

    Goals and structure of this course

    Labs

    Labs are semi-supervised by Federico Pecora and Jonas Ullberg

    They all require programming

    in Python or Perl for Cellular Automata

    in C++ for Behavioral Models for Coordinated Motion

    All your programs will be developed within a pre-existing

    framework or API

    Labs are individual

    you must submit all labs by email to teacher and TA within two

    weeks from the completion of your exam

    you are strongly advised to submit every assignment before the

    next one starts, and the last assignment before you take the exam

    Federico Pecora Agent-Based Simulation Part 1 7 / 37

    Agent Based Sim lation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    8/42

    Agent-Based Simulation

    Goals and structure of this course

    Theoretical exam

    The theoretical exam is divided into four sections

    the first gives a maximum of 20 points: you must reply true/false to

    theoretical questions spanning the entire course

    the other three are relevant to selcted topics and require a morein-depth answer

    e.g., Swarm intelligence (20 points), Behavioral models (10

    points), Cellular automata (20 points)

    questions can be composed of sub-questions

    You have 5 hours to complete the examduring which I will come by to answer questions approximately

    one hour after start

    Federico Pecora Agent-Based Simulation Part 1 8 / 37

    Agent Based Simulation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    9/42

    Agent-Based Simulation

    Goals and structure of this course

    Theoretical exam: whats important?

    The theoretical exam is based on the lectures

    The material is the lecture slides, your notes, and any papers that

    the are handed out and/or referenced in the slides. . . plus the experience you have gained from the labs!

    Everything in the course is important for the exam

    this course has a relatively limited scope, but in-depth knowledge

    is expected to pass the exam

    you are always absolutely free to come to my office if anything isunclear!

    Federico Pecora Agent-Based Simulation Part 1 9 / 37

    Agent-Based Simulation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    10/42

    Agent-Based Simulation

    What is simulation?

    Outline

    1 Goals and structure of this course

    2 What is simulation?

    3 The Multi-Agent approach

    4 Principles of simulation design and implementation

    Federico Pecora Agent-Based Simulation Part 1 10 / 37

    Agent-Based Simulation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    11/42

    Agent Based Simulation

    What is simulation?

    What is simulation?

    We want to examine a part of the real world which

    is not accessible

    is difficult to experiment with

    evolves over loo long or too short time scales

    does not exist anymore/yet

    Modeling as a tool for understanding, verifying hypotheses,

    predicting, . . .

    Federico Pecora Agent-Based Simulation Part 1 11 / 37

    Agent-Based Simulation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    12/42

    Agent Based Simulation

    What is simulation?

    What is simulation?

    We want to examine a part of the real world which

    is not accessible

    is difficult to experiment with

    evolves over loo long or too short time scales

    does not exist anymore/yet

    Modeling as a tool for understanding, verifying hypotheses,

    predicting, . . .

    Federico Pecora Agent-Based Simulation Part 1 11 / 37

    Agent-Based Simulation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    13/42

    g

    What is simulation?

    What is simulation?

    System: an actual or theoretical system in which distinct entities

    interact

    Simulation: designing a model of a system, executing the model on

    a computer, and analyzing the execution output

    Model: a reproduction of the system at an appropriate level of

    granularity

    Federico Pecora Agent-Based Simulation Part 1 12 / 37

    Agent-Based Simulation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    14/42

    What is simulation?

    Model design, execution and analysis

    Three sub-fields in simulation:

    Model

    design

    Model

    execution

    Execution

    analysis

    Model design

    Model execution

    Execution analysis

    Federico Pecora Agent-Based Simulation Part 1 13 / 37

    Agent-Based Simulation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    15/42

    What is simulation?

    Types of simulation (1)

    Simulation approaches can be categorized according to various

    criteria, e.g., dicrete vs. continuous time:

    Discrete event simulation

    Model: finite state machines, queues, petri nets, . . . ; Execution:

    read the queue of events and trigger new events as each event is

    processed; Applications: logic-test and fault-tree simulations.

    Continuous dynamic simulation

    Model: partial or ordinary differential equations; Execution: periodic

    numerical resolution of equations; Applications: flight simulators,

    electrical circuits.

    Federico Pecora Agent-Based Simulation Part 1 14 / 37

    Agent-Based Simulation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    16/42

    What is simulation?

    Types of simulation (2)

    Simulation approaches can be categorized according to various

    criteria, e.g., stochastic vs. deterministic:

    Monte-Carlo simulation

    Model: can be almost anything; Execution: generate inputsrandomly from the domain, and perform a deterministic computation

    on them; Applications: largely used in computational physics and

    engineering (e.g., designing heat shields and aerodynamic forms).

    Cellular automataModel: designing heat shields and aerodynamic for; Execution:

    periodic application of rules which determine state of a cell as a

    function of neighboring cells; Applications: see next lecture!

    Federico Pecora Agent-Based Simulation Part 1 15 / 37

    Agent-Based Simulation

    http://goforward/http://find/http://goback/
  • 7/28/2019 MAS 2011 Lecture 1

    17/42

    What is simulation?

    Types of simulation (3)

    Simulation approaches can be categorized according to various

    criteria, e.g., macrosimulation vs. microsimulation:

    Macrosimulation

    Model: complete system is modeled as one monolithic entity

    populations are averaged togetherand the model attempts tosimulate changes in these averaged characteristics for the whole

    population; Execution: periodically update the state variables

    describing the system; Applications: naturally applies to systemsthat can be modeled centrally and and in which the dynamics are

    dominated by physical laws.

    Federico Pecora Agent-Based Simulation Part 1 16 / 37

    Agent-Based Simulation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    18/42

    What is simulation?

    Types of simulation (3)

    Simulation approaches can be categorized according to various

    criteria, e.g., macrosimulation vs. microsimulation:

    MicrosimulationModel: explicitly attempts to model specific behaviors of specificindividuals; Execution: periodic interaction/communication betweenindividuals; Applications: most appropriate for domains

    characterized by a high degree of localization and distribution and

    dominated by discrete decision.

    Multi-Agent simulation is a special form of Microsimulation

    Federico Pecora Agent-Based Simulation Part 1 17 / 37

    Agent-Based Simulation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    19/42

    What is simulation?

    Types of simulation (3)

    Simulation approaches can be categorized according to various

    criteria, e.g., macrosimulation vs. microsimulation:

    MicrosimulationModel: explicitly attempts to model specific behaviors of specificindividuals; Execution: periodic interaction/communication betweenindividuals; Applications: most appropriate for domains

    characterized by a high degree of localization and distribution and

    dominated by discrete decision.

    Multi-Agent simulation is a special form of Microsimulation

    Federico Pecora Agent-Based Simulation Part 1 17 / 37

    Agent-Based Simulation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    20/42

    What is simulation?

    Time advance function

    Whatever the model, execution consists in steping through time while

    updating the variables in the model

    There are many ways to step through time

    In continuous-time models (e.g., differential equations) time steps

    can be reduced idefinitely

    In discrete-time models time is quantized somehow

    leap through time using event scheduling

    employ small time increments using time slicingsimulate the program on a massively parallel computer

    Federico Pecora Agent-Based Simulation Part 1 18 / 37

    Agent-Based Simulation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    21/42

    What is simulation?

    Goal of simulation

    Why use simulation?

    There are at least the following two reasons

    Prediction: model should produce quantitatively correct

    predictions depending on its input values

    Explanation: qualitatively significant results are sufficient for

    understanding the reaction of the system to input

    valuesThe goal of virtually all forms of simulation falls within this

    spectrum (including Multi-Agent simulation)

    Federico Pecora Agent-Based Simulation Part 1 19 / 37

    Agent-Based Simulation

    Th M lti A t h

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    22/42

    The Multi-Agent approach

    Outline

    1 Goals and structure of this course

    2 What is simulation?

    3 The Multi-Agent approach

    4 Principles of simulation design and implementation

    Federico Pecora Agent-Based Simulation Part 1 20 / 37

    Agent-Based Simulation

    The Multi Agent approach

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    23/42

    The Multi-Agent approach

    Some examples

    Ant colony optimization

    Physics simulation

    Biological system simulation

    Flocking/Herding

    Cellular automata

    . . . the real thing

    Federico Pecora Agent-Based Simulation Part 1 21 / 37

    Agent-Based Simulation

    The Multi Agent approach

    http://videos/Starlings_Flocking.avihttp://videos/computational-CA.avihttp://videos/the_Hilton_turns_into_birds.avihttp://videos/Artificial_life_and_multiagent_system.avihttp://videos/temperature-CA.avihttp://videos/Ant_Colony_Optimization_of_truss.avihttp://find/
  • 7/28/2019 MAS 2011 Lecture 1

    24/42

    The Multi-Agent approach

    Multi-Agent simulation

    Model concept based on Multi-Agent Systems

    Fundamental entities can sense the environment and act in the

    environment (environment = other agents + simulated world)

    Modeling a real Multi-Agent System as a Multi-Agent System

    in the model, i.e., using the concept of multi-agent systems in con-

    ceptualization, specification and implementation of the model

    Interaction among agents is the central point

    Simulation data: emerging behavior of the agents

    Federico Pecora Agent-Based Simulation Part 1 22 / 37

    Agent-Based Simulation

    The Multi-Agent approach

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    25/42

    The Multi-Agent approach

    Why Multi-Agent simulation?

    A paradigm that allows appropriate modeling capabilities in a

    number of imporant disciplines

    Social science, Biology

    Modeling socio-technical systems and test environments for

    agent-based software

    Allows to simulate systems that are particularly difficult to treat

    with traditional approaches

    Emergent phenomena, models with variable structure

    Can afford more detail in models

    more realism and micro-validity

    Provides an intuitive way of modeling

    Facilitates communication with other fields and enables more

    researchers to use simulation

    Federico Pecora Agent-Based Simulation Part 1 23 / 37

    Agent-Based Simulation

    The Multi-Agent approach

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    26/42

    The Multi Agent approach

    Charateristics of Multi-Agent simulation

    Agents are autonomous entities that react to environmental

    change and proactively change their behavior

    Typically one agent

    Perception and action is localVariable structure models

    models that entail in their description the possibility to change

    their own structure, i.e., their constitutive components as well as

    the relations that exist among them

    Flexible interactions between agents

    Non-linear feedback loops

    Adaptive agents

    Federico Pecora Agent-Based Simulation Part 1 24 / 37

    Agent-Based Simulation

    The Multi-Agent approach

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    27/42

    The Multi Agent approach

    Simulating Multi-Agent Systems

    Multi-Agent Models are used as substitutes for another system,

    the original multi-agent system

    Multi-Agent Simulations mostly use virtual time

    Simulated Multi-Agent Systems live a in a simulated

    environment

    social space

    virtual 2D/3D space

    = time and environment are controllable by the modeler

    Federico Pecora Agent-Based Simulation Part 1 25 / 37

    Agent-Based Simulation

    The Multi-Agent approach

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    28/42

    g pp

    Applications of Multi-Agent simulation

    Biological systems: active and heterogeneous entities exert influenceson their local environment reacting on local stimuli

    Traffic simulation: microscopic models represent sophisticated

    intelligent entities (simulated drivers)

    Social science simulation: artificial societies are created to testscientific hypotheses (e.g., gossip)

    Industrial simulation: there are non-artificial (e.g., human) agents

    involved, or where parts of the system contribute to an

    overall difficult to model emerging behavior

    Simulation for entertainment: large multitudes of agents (e.g.,

    animals, armies, . . . ) move in 3D space (see Lord of the

    Rings)

    Testbeds: for complex control systems

    Federico Pecora Agent-Based Simulation Part 1 26 / 37

    Agent-Based Simulation

    The Multi-Agent approach

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    29/42

    Multi-Agent simulation vs. Macrosimulation

    Pitfalls of Macrosimulation

    Assumes homogeneous space and population

    No representation of the individual and its locality, i.e., no

    conditional behavior, no adaptive behavior, no flexible interaction

    Can only observe the system as a whole, not its parts

    Advantages of Macrosimulation

    Differential equations: a well understood, established

    mathematical framework

    Easy to document

    Low number of parameters, global input-output behaviour

    Simulation experiments can be very fast

    Federico Pecora Agent-Based Simulation Part 1 27 / 37

    Agent-Based Simulation

    The Multi-Agent approach

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    30/42

    Multi-Agent simulation vs. Macrosimulation

    Pitfalls of Multi-Agent simulation

    Development of complex models can be very costly

    Difficult to determine minimal model

    Established formalism is missing, difficult to document

    Calibration problem

    finding the best parameter setting for a model (given a

    structurally valid model)

    Sensitivity problemeven small changes may have a large effect

    Federico Pecora Agent-Based Simulation Part 1 28 / 37

    Agent-Based Simulation

    The Multi-Agent approach

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    31/42

    Multi-Agent simulation vs. Macrosimulation

    Advantages of Multi-Agent simulation

    Can deal with multi-agent systems directly:

    real agent simulated agent

    Facilitates structural validation

    Elegant treatment of variable structures

    Allows to model adaptation and evolution

    Easy to model heterogeneous space and population

    Provides different levels of observation

    Federico Pecora Agent-Based Simulation Part 1 29 / 37

    Agent-Based Simulation

    The Multi-Agent approach

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    32/42

    Bevaior- vs. Goal-oriented agent models

    Agents in the study can be modeled in two ways

    Behavior-oriented modeling: agents are described by modeling their

    behaviors

    Goal-oriented modeling: agents are capable of planning and the

    modeler described their goal

    Choice of modeling startegy strongly depends on application

    context

    Federico Pecora Agent-Based Simulation Part 1 30 / 37

    Agent-Based Simulation

    The Multi-Agent approach

    http://goforward/http://find/http://goback/
  • 7/28/2019 MAS 2011 Lecture 1

    33/42

    Bevaior- vs. Goal-oriented agent models

    Agents in the study can be modeled in two ways

    Behavior-oriented modeling: agents are described by modeling their

    behaviors

    Goal-oriented modeling: agents are capable of planning and the

    modeler described their goal

    Choice of modeling startegy strongly depends on application

    context

    Federico Pecora Agent-Based Simulation Part 1 30 / 37

    Agent-Based Simulation

    The Multi-Agent approach

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    34/42

    Behavior-oriented models

    The modeler describes agent status and dynamics

    Example formalisms: activity graphs, crisp/fuzzy rules,

    constraints, . . .

    Reactions to perceptions/status changes are defined by themodeler

    Can easily accommodate Reinforcement Learning and

    Evolutionary Concepts

    The agents goal(s) are are treated implicitlyVery intuitive mapping with simple biological systems (e.g.,

    insects)

    Federico Pecora Agent-Based Simulation Part 1 31 / 37

    Agent-Based Simulation

    The Multi-Agent approach

    http://find/http://goback/
  • 7/28/2019 MAS 2011 Lecture 1

    35/42

    Goal-oriented models

    The modeler identifies goals of the agents

    Agents select a goal and execute actions as a consequence

    Reactions are not predefined, but goal dependent

    Explicit treatment of goals in the agent behaviour, but

    execution of goal-dependant actions can be error-prone

    leads to significantly more complex model (see

    Belief-Desire-Intention agent simulations)

    We do not deal with goal-oriented models in this course

    Federico Pecora Agent-Based Simulation Part 1 32 / 37

    Agent-Based Simulation

    Principles of simulation design and implementation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    36/42

    Outline

    1 Goals and structure of this course

    2 What is simulation?

    3 The Multi-Agent approach

    4 Principles of simulation design and implementation

    Federico Pecora Agent-Based Simulation Part 1 33 / 37

    Agent-Based Simulation

    Principles of simulation design and implementation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    37/42

    Main steps in a simulation study [Klgl, 2004]

    1 Defining the question addressed by the model

    2 Conceptualizing the model

    3 Specifying the model

    4 Implementing the model [and the simulation environment]

    5 Calibrating, bug-fixing

    6 Experimentation

    7 Analysis of the results

    Federico Pecora Agent-Based Simulation Part 1 34 / 37

    Agent-Based Simulation

    Principles of simulation design and implementation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    38/42

    Model validation and verification

    Validation: crucial for guaranteeing that output of simulation will say

    something meaningful!

    Verification: making sure the model is correctly translated from one

    representation to another (e.g., from concept to

    specification)

    Concept

    model

    Specified

    model

    Implemented

    model

    Simulation

    output data

    Original system

    Validation Validation Validation Validation

    Verification

    Verification

    Verificatio

    n

    Validation and verification between all steps!

    Federico Pecora Agent-Based Simulation Part 1 35 / 37

    Agent-Based Simulation

    Principles of simulation design and implementation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    39/42

    Model validation and verification

    Validation: crucial for guaranteeing that output of simulation will say

    something meaningful!

    Verification: making sure the model is correctly translated from one

    representation to another (e.g., from concept to

    specification)

    Concept

    model

    Specified

    model

    Implemented

    model

    Simulation

    output data

    Original system

    Validation Validation Validation Validation

    Verification

    Verification

    Verificatio

    n

    Validation and verification between all steps!

    Federico Pecora Agent-Based Simulation Part 1 35 / 37

    Agent-Based Simulation

    Principles of simulation design and implementation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    40/42

    Potential pitfalls

    Failure to have a well-defined set of objectives at the beginning

    of the simulation study

    Inappropriate level of model detail

    need to identify a minimal model given the objective

    Treat simulation simply as programming exercise

    Failure to collect appropriate data from the original system

    Inappropriate simulation software

    this can account for 80% of development time!

    Failure to account correctly for sources of randomness

    Inappropriate output data analysis

    Federico Pecora Agent-Based Simulation Part 1 36 / 37

    Agent-Based Simulation

    Principles of simulation design and implementation

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    41/42

    Principles of simulation and the Multi-Agent approach

    Thank you!

    Federico Pecora Agent-Based Simulation Part 1 37 / 37

    Agent-Based Simulation

    References

    http://find/
  • 7/28/2019 MAS 2011 Lecture 1

    42/42

    References

    Klgl, F. (2004).

    Multi-Agent Simulation.

    Lecture at the Sixth European Agents Systems Summer School, Liverpool.

    Federico Pecora Agent-Based Simulation Part 1 37 / 37

    http://find/