A Simulation Framework for Pervasive Service ... - Semantic Scholar

6 downloads 0 Views 1MB Size Report
[email protected]. Alma Mater Studiorum—Universit`a di Bologna. July 6, 2011. Danilo Pianini (UniBo). Alchemist Simulation Framework. July 6, 2011.
SAPERE

Self-aware Pervasive Service Ecosystems

A Simulation Framework for Pervasive Service Ecosystems Danilo Pianini [email protected] Alma Mater Studiorum—Universit` a di Bologna

July 6, 2011

Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

1 / 19

Outline

...because knowing what we’ll talk about matters!

1

SAPERE background SAPERE The role of simulation in SAPERE Possible simulation approaches

2

Alchemist Taking the best of both approaches Computational model Dynamic Engine Alchemist Architecture

3

Case study A Crowd evacuation scenario Simulation results

Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

2 / 19

SAPERE background

SAPERE

The SAPERE Project

http://www.sapere-project.eu/ SAPERE (Self-aware Pervasive Service Ecosystems) is an EU STREP project under the FP7 FET Proactive Initiative: Self-Awareness in Autonomic Systems (AWARENESS) The objective of SAPERE is the development of a highly-innovative theoretical and practical framework for the decentralized deployment and execution of self-aware and adaptive services for future and emerging pervasive network scenarios

Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

3 / 19

SAPERE background

SAPERE

SAPERE World SAPERE Node eco-law Engine

Software services

LSA Space LSA

SAPERE Node SAPERE Node

LSA

LSA

SAPERE Node

LSA

eco-law activation SAPERE Node

SAPERE Node

SAPERE Node

SAPERE Node SAPERE Node

Danilo Pianini (UniBo)

SAPERE Node

Alchemist Simulation Framework

SAPERE Node

July 6, 2011

4 / 19

SAPERE background

The role of simulation in SAPERE

Simulation of a SAPERE environment The role of simulation No way to assert the emergent properties of the system System must be resilient to changes: it’s hard to plan test the real system in a whole lot of different situations It’s impossible to deploy the whole ecosystem without any warranty Fist class abstractions High dynamic environment composed of different, mobile, communicating nodes Autonomous agents Programmability through a set of chemical-like laws, working with CTMC model

Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

5 / 19

SAPERE background

Possible simulation approaches

Two approaches Classic ABM modelling High flexibility Topology as first-class abstraction Dynamics explicitly modelled No native support for CTMC model Chemical inspired modelling Natively CTMC Monstrously fast engines for stochastic simulation Very limited topology: multicompartment as best No other things than reactions: extremely limited flexibility

Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

6 / 19

Alchemist

Taking the best of both approaches

Alchemist simulation approach Base idea Start from the existing work with stochastic chemical systems simulation Extend it as far as needed to reach desired flexibility SSA Continuous Time Markov Chain (CTMC) Stochastic and precise Complete solution unfeasible for non-trivial problems Approximated solution through series of Monte Carlo simulations Several efficient algorithms

Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

7 / 19

Alchemist

Computational model

Extending the concept of reaction Chemical reaction A set of reactants combine themselves in a set of products The speed of the reactions is function of: the concentration of the reactants a kinetic constant

Alchemist reaction A set of conditions allows the execution of a set of actions A condition associates to each state of the system a boolean value An actions describes a modification of the environment status

The speed of the reactions is function of the current environment status (rate equation)

Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

8 / 19

Alchemist

Computational model

Enriching the environment description Alchemist world Environment which contains Nodes Each Node is programmed with a set of Reactions Nodes contain Molecules Each Molecule in a node is described with a Concentration

Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

9 / 19

Alchemist

Dynamic Engine

Making efficient SSA Algorithms more flexible Existing SSA algorithms Several versions, but same base schema [Gillespie, 1977]: 1 2 3

Select next reaction to execute according to the markovian rates Execute it Update the markovian rates which may have changed

Very efficient versions exist: logarithmic [Gibson and Bruck, 2000] and constant [Slepoy et al., 2008] time scaling with reactions number What they miss is what we added Reactions can be added and removed during the simulation Support for non-exponential time distributed events (e.g. triggers) Dependencies among reactions are evaluated considering their “context”, speeding up the update phase Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

10 / 19

Alchemist

Dynamic Engine

Smart data structures ensure bleeding edge performances A (8, 1.3)

B (1, 4.2)

D (9, 7.3)

H (5, 9.1)

E (4, 5.5)

I (10, 10.1) B 1

F 2

J 3

A+B→C

C (6, 2.0)

E 4

F (2, 3.7)

G (7, 8.9)

B+C→D

E+G→A

D+E→E+F

F→D+G

J (3, ∞) H 5

C 6

G 7

A 8

D 9

I 10

Next Reaction efficient structures made dynamic Dynamic Indexed Priority Queue Allow to access the next reaction to execute in O(1) time Worst case update in log2 (N) (average case a lot better) Extended to ensure balancing with insertion and removal

Dynamic Dependency Graph Allows to smartly update only a subset of all the reaction Extended with the concept of input and output context Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

11 / 19

Alchemist

Alchemist Architecture

Alchemist is fully modular Core Engine Reaction Manager

Reporting System

Simulation Flow

Interactive UI

Dependency Graph

Environment

Language Parser Environment Instantiator

XML Bytecode

Application-specific Alchemist Bytecode Compiler

Environment description in application-specific language

Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

12 / 19

Case study

A Crowd evacuation scenario

Run away from the burning hall! Scenario description A big hall containing a lot of people and a sensor network Two exit doors, reachable through a corridor A fire sets up in a point Everybody must be guided to safeness, avoiding crowded paths

Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

13 / 19

Case study

A Crowd evacuation scenario

Eco-laws for this scenario

hsource, T , M, Ai

Rinit 7−−−→

hgrad, T , V , M, Ai

Rs 7− − →

hgrad, T , V , M, Ai, hgrad, T , W , M, Ai hgrad, T , V , M, Ai hinfo, attr, A, TSi, hinfo, attr, A2 , TS+T i

hgrad, exit, E , Me, Aei,

→ Rann (A) 7− −−−−− → →

Ratt 7− −− →

hgrad, fire, F , Mf , Af i,

+hinfo, attr, A+∆, TS2i

Danilo Pianini (UniBo)

hgrad, T , min(V , W ), M, Ai hgrad, T , V +1, M, Ai hinfo, attr, A2 , TS+T i

hgrad, exit, E , Me, Aei, hgrad, fire, F , Mf , Af i, hinfo, crowd, CR, TSi,

hinfo, crowd, CR, TSi

hinfo, escape, Li, hinfo, attr, A, TSi,

hsource, T , M, Ai, hgrad, T , 0, M, Ai hgrad, T , V , M, Ai, +hgrad, T , min(V +#D, M), M, Ai

hinfo, attr, (Me − E )/(1 + (Mf − F ) + k × (Mc − C )), #T i

Rdisp (∆) 7− −−−−− →

hinfo, escape, #Oi, hinfo, attr, A, TSi, +hinfo, attr, A + ∆, TS2i

Alchemist Simulation Framework

July 6, 2011

14 / 19

Case study

Simulation results

Follow the gradient

Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

15 / 19

Case study

Simulation results

Videos & demo session

I have some nice videos A SAPERE-oriented scenario: the crowd evacuation A biology-oriented application: simple morphogenesis See you at the demo session I’ll let Alchemist run, showing two more examples Falling back to classic ABM: synchronizing fireflies Crowd steering in a slightly more complex scenario

Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

16 / 19

Questions

Questions?

Feel free to ask :)

Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

17 / 19

References

References Gibson, M. A. and Bruck, J. (2000). Efficient Exact Stochastic Simulation of Chemical Systems with Many Species and Many Channels. The Journal of Physical Chemistry A, 104(9):1876–1889. Gillespie, D. T. (1977). Exact stochastic simulation of coupled chemical reactions. Journal of Physical Chemistry, 81(25):2340–2361. Slepoy, A., Thompson, A. P., and Plimpton, S. J. (2008). A constant-time kinetic Monte Carlo algorithm for simulation of large biochemical reaction networks. The Journal of Chemical Physics, 128(20):205101+.

Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

18 / 19

SAPERE

Self-aware Pervasive Service Ecosystems

A Simulation Framework for Pervasive Service Ecosystems Danilo Pianini [email protected] Alma Mater Studiorum—Universit` a di Bologna

July 6, 2011

Danilo Pianini (UniBo)

Alchemist Simulation Framework

July 6, 2011

19 / 19