extending the gillespie's stochastic simulation algorithm for integrating discrete-event and...

22
Extending the Gillespie’s Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation Sara Montagna , Andrea Omicini, Danilo Pianini {sara.montagna, andrea.omicini, danilo.pianini}@unibo.it Alma Mater Studiorum—Universit` a di Bologna a Cesena The XVI International Workshop on Multi-Agent Based Simulation May 5, 2015 - Istanbul, Turkey Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 1 / 22

Upload: danilo-pianini

Post on 06-Aug-2015

169 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

Extending the Gillespie’s Stochastic SimulationAlgorithm for Integrating Discrete-Event and

Multi-Agent Based Simulation

Sara Montagna, Andrea Omicini, Danilo Pianini{sara.montagna, andrea.omicini, danilo.pianini}@unibo.it

Alma Mater Studiorum—Universita di Bologna a Cesena

The XVI International Workshop on Multi-Agent Based SimulationMay 5, 2015 - Istanbul, Turkey

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 1 / 22

Page 2: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

Outline

1 BackgroundDiscrete Event Simulation (DES)Agent Based Modelling (ABM) and Simulation (MABS)

2 Motivation

3 A Unified Stochastic Computational ModelModelSimulation algorithm

4 Tools: The ALCHEMIST Platform

5 Conclusion

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 2 / 22

Page 3: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

Background Discrete Event Simulation (DES)

DES

. . . The most used approach in the simulation mainstream

Instantaneous events responsible for the changes in the system state

In between events, no change to the system is assumed to occur

All events are ordered (even if they happen at the exact same time)

It is normally very efficient since it allows to jump in time from onerelevant event

Defining a DES means to model the behaviour of a system as an orderedsequence of non-continuous events, by specifying for each of them theperturbations in the system state it provokes, and the exact point in timewhen it has to be triggered.

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 3 / 22

Page 4: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

Background Agent Based Modelling (ABM) and Simulation (MABS)

MABS I

MABS (Multi-Agent Based Simulation) was introduced as a novel andalternative approach to Discrete Event Simulation (DES) and to SystemsDynamic (SD)

Rather than a simulation method, it is a simulation paradigm

ABM models the system at the micro-level

active entity are autonomous and interacting agentdynamic environmentglobal system-level behaviour as a result of the agent-to-agentinteractions

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 4 / 22

Page 5: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

Background Agent Based Modelling (ABM) and Simulation (MABS)

MABS II

The simulation platform

Various platforms were developed for the purpose [All10],

tools for developing, editing, and executing ABM, as well as forvisualising the simulation dynamic.

How do they operate over a timeline?

How are agents and environment behaviours coupled and scheduled?

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 5 / 22

Page 6: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

Background Agent Based Modelling (ABM) and Simulation (MABS)

Crucial Issue: Time

How to deal with the evolution of time?

Continuous approaches

Rare

Specifically used for modelling the endogenous dynamic of theenvironment coupled with discrete agent internal processes.

Discrete approaches

Time-driven

most widely usedfixed time steps

Event-driven

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 6 / 22

Page 7: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

Motivation

Motivation: Why not Time-driven?

Efficiency

Time passes fixed time steps

even if no action changes the state happen in between

Carefully choice of temporal granularity

low granularity may ruin resultshigh granularity may lead to a waste of computational resources

Accuracy, validity, coherency

All the events happening in the same ∆t are executed together

possible loss of order and changes on the system outcometo be as close as possible to the MAS paradigm, actions andinteractions should be conducted concurrently

Congruence

Simultaneous updates of system entities is far from reality

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 7 / 22

Page 8: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

Motivation

From the Time-driven Drawbacks to Our Contribution

Based on two intuitions

a unified conceptual framework [Omi15]

coherent interpretation of event-driven and multi-agent systems

powerful simulation framework [Mey14]

from the integration of DES and MABS

. . . and one observation

Gillespie’s SSA [Gil77] as an event-driven algorithm

Our proposal

A computational model integrating DES and MABS based on an extensionof the Gillespie’s stochastic simulation algorithm.

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 8 / 22

Page 9: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

A Unified Stochastic Computational Model

Gillespie’s SSA as an Event-driven Algorithm

Gillespie’s algorithm

Gillespie first proposed an event driven stochastic simulation algorithm(SSA) for the exact stochastic simulation of chemical systems

Gibson and Bruck [GB00] improved its performance

Next reaction selection not by propensity (function of concentration ofreagents and a markovian rate) but by generated putative timesDependency graph meant to update only the events whose schedulingtime might have changed because of other events

Building on their work, we extended the algorithm in order to be ableto shift from the world of chemistry to the richer MABS world

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 9 / 22

Page 10: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

A Unified Stochastic Computational Model Model

Generalised Chemistry

Pure chemistry vs. agent-based systems

Single, static compartment versus multiple, possibly mobile, andinterconnected agents whose ability to communicate may depend onenvironmental and technological factors

Molecules are described by concentrations (an integer), agents maycarry and process any kind of data

Reactions “scheduling” in nature follows a Poisson distribution whoserate equation depends on reagents’ concentration [Gil77]. Events inan agent-based simulation may be influenced by any of theenvironment components and follow any probability distribution(triggers, timers, events with memory)

Agents live in an environment, such abstraction is absent in chemistry

A huge leap, indeed

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 10 / 22

Page 11: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

A Unified Stochastic Computational Model Model

Close the Gap: Environment

ReactionA proactive behaviour

Linking RuleA function of the environment

that decides wether or nottwo nodes are connected

Moleculetoken representing a

chunk of data(think of it as a pointer)

ConcentrationActual data associated

with a "molecule"

EnvironmentRiemannian manifold

where nodes live

NodeA container of reactionsand molecules situated

in the environment

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 11 / 22

Page 12: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

A Unified Stochastic Computational Model Model

Close the Gap: Reactions

Number of

neighbors<3

Node

contains

something

Any other

condition

about this

environment

Rate equation: how conditions

influence the execution speed

Conditions Probability distribution Actions

Any other

action

on this

environment

Move a node

towards...

Change

concentration

of something

Reaction

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 12 / 22

Page 13: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

A Unified Stochastic Computational Model Model

Flexibility and Data Types

Abstract Concentration

Concentration can be any data type

Pick integers, the result is a simulator for (bio)chemistry, with multipleintercommunicating compartments situated in an environment[MPV12]Pick “set of tuples matching a tuple template”, the result is asimulator of network of programmable tuple spacesPick “any object”, the result is flexibile enough to simulate a networkof devices running their own program [PVB15]

For each type of concentration, a specific set of legal conditions andactions can (must) be defined

All the other entities can be defined in a generic fashion, and reused

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 13 / 22

Page 14: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

A Unified Stochastic Computational Model Simulation algorithm

Extended SSA—Phase 1: Pick the Next Event

How to select the next event?

Most high-performance SSAs presume an underlying model that onlyincludes memoryless events [STP08]

Gibson/Bruck’s “next reaction” uses putative times instead

We extended it adding support for addition and removal of events atruntime

Agents may join and leave the system at runtime, new agents may beequipped with novel behaviours

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 14 / 22

Page 15: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

A Unified Stochastic Computational Model Simulation algorithm

Extended SSA—Phase 2: Dependency Management

How to select the next event?

The dependency graph is key for the high performance of SSAs[STP08]

In general, it is very hard to build a dependency graph in an openenvironment composed of multiple entities

We extended the original concept of (static) dependency graph with:

Events can be added and removed at runtime, the graph is dynamicallyupdatedExecution contexts: local, neighborhood, globalSeparation of influencing context and context of influence (input andoutput)Overall, the dependency graph is greatly pruned, with positive impacton performance

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 15 / 22

Page 16: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

Tools: The ALCHEMIST Platform

The ALCHEMIST Platform as a Tool 1

ALCHEMIST: A chemistry-inspired meta-simulator

Based on the machinery already described

Java written

Provides out of the box support for simulating distributedprogrammable tuple spaces and Protelis [PVB15] devices

Supports mobility and complex environments, both indoor andoutdoor (with data from OpenStreetMap)

Available as Maven artifact (it.unibo.alchemist:alchemist)

1http://alchemist.apice.unibo.itMontagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 16 / 22

Page 17: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

Tools: The ALCHEMIST Platform

Architecture of ALCHEMIST

Dynamic Dependency Graph

Dynamic Reaction Manager

Discrete Event Engine

Core

Environment(model)

ReportingGraphical Output

Logging System

Interactive UI

XML Bytecode

Environment Builder

LanguageChain

DSL to XML Compiler

Domain Specific Language

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 17 / 22

Page 18: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

Tools: The ALCHEMIST Platform

Case Study: Crowd-sensitive User Steering in London

(a) Initial (b) Ongoing (c) Near-end

Figure: Three snapshots of the simulation. Our altered distance metric (thegradient) goes from green (most favourable and close to destination) to red(unpleasant or far from destination). Agents (in black) climb this structuretowards greener values.

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 18 / 22

Page 19: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

Tools: The ALCHEMIST Platform

Case Study: Crowd-sensitive User Steering in London

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 19 / 22

Page 20: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

Conclusion

Conclusion

Integration of DES and MABS

We adopted an extension of Gillespie’s SSA as stochastic event-drivenalgorithm

We extended it to support the inherent complexity of multiagentsystems, still retaining the performance optimisations

We extended the chemical model towards higher flexibility,introducing the environment, generalising the concept of reaction andallowing arbitrary data to be a “concentration”

We implemented those concepts inside the ALCHEMIST framework

A non-trivial example was provided: crowd steering in London

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 20 / 22

Page 21: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

References

References I

Rob Allan.Survey of agent based modelling and simulation tools.Technical Report DL-TR-2010-007, Computational Science and Engineering Department,October 2010.

Michael A. Gibson and Jehoshua Bruck.Efficient exact stochastic simulation of chemical systems with many species and manychannels.J. Phys. Chem. A, 104:1876–1889, 2000.

Daniel T. Gillespie.Exact stochastic simulation of coupled crfreactions.The Journal of Physical Chemistry, 81(25):2340–2361, December 1977.

Ruth Meyer.Event-driven multi-agent simulation.In Electronic Proceedings of the Fifteenth International Workshop on Multi-Agent-BasedSimulation, 2014.

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 21 / 22

Page 22: Extending the Gillespie's Stochastic Simulation Algorithm for Integrating Discrete-Event and Multi-Agent Based Simulation

References

References II

Sara Montagna, Danilo Pianini, and Mirko Viroli.A model for drosophila melanogaster development from a single cell to stripe patternformation.In Proceedings of the 27th Annual ACM Symposium on Applied Computing, SAC ’12,pages 1406–1412, New York, NY, USA, 2012. ACM.

Andrea Omicini.Event-based vs. multi-agent systems: Towards a unified conceptual framework.In 2015 19th IEEE International Conference on Computer Supported Cooperative Work inDesign (CSCWD2015). IEEE Computer Society, May 2015.

Danilo Pianini, Mirko Viroli, and Jacob Beal.Protelis: Practical aggregate programming.In 30th Symposium On Applied Computing (SAC 2015). ACM, 2015.

Alexander Slepoy, Aidan P. Thompson, and Steven J. Plimpton.A constant-time kinetic monte carlo algorithm for simulation of large biochemical reactionnetworks.The Journal of Chemical Physics, 128(20):205101, 2008.

Montagna, Omicini, Pianini (UNIBO) Gillespie’s SSA to Integrate DES and MABS 2015-05-15 MABS 22 / 22