spike - a command line tool for continuous, stochastic ... · [email protected] awpn october...

44
[email protected] AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation of (coloured) Petri nets Jacek Chodak, Monika Heiner (supervisor) Computer Science Institute, Brandenburg University of Technology Cottbus, Germany [email protected], [email protected] http://www-dssz.informatik.tu-cottbus.de/DSSZ/Software/Spike

Upload: others

Post on 25-Jun-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 01

Spike - a command line tool forcontinuous, stochastic & hybrid simulation

of (coloured) Petri nets

Jacek Chodak, Monika Heiner (supervisor)Computer Science Institute, Brandenburg University of Technology

Cottbus, [email protected], [email protected]

http://www-dssz.informatik.tu-cottbus.de/DSSZ/Software/Spike

Page 2: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 02

Agenda

* PetriNuts framework* Why Spike* Spike functionality - Simulation - Conversion - Reduction - Reproducibility* Architecture* Use cases* Present status* Future works

Page 3: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 03

PetriNuts Framework

CHARLIE [1] • Structural analysis • Analyses building on incidence matrix • Reachability graph analysis • Siphon/trap computation • Explicite CTL model checking • Structural reduction

SNOOPY [3, 4]• Modelling• Simulation: - stochastic, - continuous, - hybrid• Animation

MARCIE [2]• Symbolic analysis (PN) - state space analysis - CTL model checking• Symbolic analysis (SPN) - standard numerical analysis, - CSRL model checking• Simulative analysis (SPN) - standard numerical analysis - PLTc model checking • explicit approximative numerical analysis

SPIKE• Distributed simulation: - stochastic, - continuous, - hybrid

PATTY [5]• Web based animation

References:• [1] M Heiner, M Schwarick and J Wegener: PETRI NETS 2015• [2] M Heiner, C Rohr and M Schwarick: PETRI NETS 2013• [3] M Herajy, F Liu, C Rohr and M Heiner: BMC Systems Biology 2017• [4] C Rohr, W Marvan, M Heiner: Bioinformatics 2010• [5] K Schulz, BA thesis, BTU Cottbus, CS department 2008

Page 4: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 04

Why Spike

* Reproducibility

* Simplifying workflow of simulation experiments

* Speedup simulation Models can contain dozens of thousands of nodes. To speed up simulation, a model can be

reduced or divided into modules (spatial decomposition, decomposition by node types) and simulated in a distributed way.

There are many parameters: model parameters (e.g., initial marking, kinetic constants); simulations

parameters(e.g., type of algm, length of trace, number of stochastic runs). Experiments with Spike are documented by configuration files.

CLI controlling multiple simulations without user intervention; typically for different model configurations and/or simulator configurations.

Page 5: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 04

Why Spike

* Reproducibility

* Simplifying workflow of simulation experiments

* Speedup simulation Models can contain dozens of thousands of nodes. To speed up simulation, a model can be

reduced or divided into modules (spatial decomposition, decomposition by node types) and simulated in a distributed way.

There are many parameters: model parameters (e.g., initial marking, kinetic constants); simulations

parameters(e.g., type of algm, length of trace, number of stochastic runs). Experiments with Spike are documented by configuration files.

CLI controlling multiple simulations without user intervention; typically for different model configurations and/or simulator configurations.

Page 6: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 04

Why Spike

* Reproducibility

* Simplifying workflow of simulation experiments

* Speedup simulation Models can contain dozens of thousands of nodes. To speed up simulation, a model can be

reduced or divided into modules (spatial decomposition, decomposition by node types) and simulated in a distributed way.

There are many parameters: model parameters (e.g., initial marking, kinetic constants); simulations

parameters(e.g., type of algm, length of trace, number of stochastic runs). Experiments with Spike are documented by configuration files.

CLI controlling multiple simulations without user intervention; typically for different model configurations and/or simulator configurations.

Page 7: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 05

Simulation

* CPN - Continuous Petri Net (ODEs)* HPN - Hybrid Petri Net

SPN CPN

HPN

<=>

<=>

<=>

Supported (coloured) PN classes:* SPN - Stochastic Petri Net (CONTINUOUS TIME MARKOV CHAINS)

Page 8: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 05

Simulation

* SPN - Stochastic Petri Net (CONTINUOUS TIME MARKOV CHAINS)* CPN - Continuous Petri Net (ODEs)* HPN - Hybrid Petri Net

SPN CPN

HPN

<=>

<=>

<=>

Supported (coloured) PN classes:

Page 9: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 06

Simulation

* Stochastic

* Continuous

* Hybrid

time

time

time

CPN, HPN => SPN

SPN, HPN => CPN

SPN, CPN => HPN

Page 10: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 06

Simulation

* Stochastic

* Continuous

* Hybrid

time

time

time

CPN, HPN => SPN

SPN, HPN => CPN

SPN, CPN => HPN

Page 11: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 07

Conversion

ANDL

CANDL

SBML

PNML

ERODE

human readable formats for Petri nets and Coloured Petri nets, respectively, used internally by the PetriNuts framework

(the Systems Biology Markup Language) - an XML-based representation format designed to exchange computational models of biological processes

a tool for the evaluation and reduction of chemical reactionnetworks readed as ordinary differential equations (ODEs)

an XML-based interchange format for Petri nets (no time)

Page 12: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 08

Conversion

ANDL

CANDLSBML

PNML

ERODE

SPIKE ANDL

ERODE

Import Export

Page 13: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 09

ReductionModel

Reduced Model

Reduction* Clean siphons* Constant places* ERODE Further reductions may be

applied by converting a model to the ERODE format, if the model is to be read as ordinary differential equations (ODEs).

* further general reduction rules under consideration

Page 14: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 09

ReductionModel

Reduced Model

Reduction* Clean siphons* Constant places* ERODE Further reductions may be

applied by converting a model to the ERODE format, if the model is to be read as ordinary differential equations (ODEs).

* further general reduction rules under consideration

Page 15: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 10

Reproducibilityconfiguration: { model: { constants: { ... } places: { ... } observers: { ... } }

* model configuration** constants

** observers** initial states(arc weights, initial markings, kinetic constants)

* simulation configurations** exports

simulation : { ... export: { ... } } ...}

Page 16: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 10

Reproducibilityconfiguration: { model: { constants: { ... } places: { ... } observers: { ... } }

* model configuration** constants

** observers** initial states(arc weights, initial markings, kinetic constants)

* simulation configurations** exports

simulation : { ... export: { ... } } ...}

Page 17: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 11

Reproducibility

* Definition of constantsconstants: { // name of a group all: { /∗ if constant does not exist ∗ then it will be created and ∗ can be used in the configuration , ∗ for example in defining a place marking ∗/ M: ”D/2 + 1” }}

Page 18: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 12

Reproducibility

places: {// example of use of the newly created constant MP: "1000`(M,M)"P_2_2: 500

}

* Set marking for places

Page 19: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 13

Reproducibility

observers: {place: {OP01: {function: "P_1_1 + P_2_3"

}}

}

* Definition of auxiliary variables (observers) which allow for extra measures by defining numerical functions; depending on the type of observer, it can be defined for places, transitions or simultaneously for places, transitions and constants

Page 20: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 14

Reproducibility

simulation: { name: "Diffusion" // Name of a simulation type: stochastic // [continuous, stochastic, hybrid] solver: direct // [BDF, classic, direct, delta-leaping, static, staticAcc] threads: 0 // 0 - try to get the number of concurrent threads supported by the hardware interval: 1:1:1000// start : step : end (startTimePoint : intervalSize : endTimePoint) runs: 10 // Applicable only for stochastic sim // continues conf iniStep: 0.1 linSolver: CVDense //[CVDense, CVSpgmr, CVDiag, CVSpbcg, and CVSptfqmr] relTol: 1.0e-5 absTol: 1.0e-10 // Export export: { places: [] // Array of places to save (if empty export all) transitions: [] to: "testCase-diffusion-stochastic.csv" }}

* Defining multiple simulation configurations, which permits to run multiple experiments for one model configuration

//simulation: { ...}

Page 21: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 15

Reproducibility

export: {// Array of places to save,// including colored places like P// in this example (if empty, export all)places: ["P_1_1", "OP01", "Grid.*", "D", "P"]// Array of transitions to save,// including colored transitionstransitions: ["t3_1_1_1_2", "t3", "t3" ]// Array of observers to save (if empty, export all)observers: ["M01", "OT01"]to: "sim01-file01.csv"

}export: {...}

* Defining multiple exports of simulation results by use of regular expressions over the nodes; any combination of places, transitions and observers, coloured and uncoloured, in one file

Page 22: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 16

Architecture

* Modularity Module | Command | Description------------------------------------------------------------------------- Main | version | display version of Spike CLI | help | display help for a given command Configuration | exe | execute configuration script Converter | load | load a model from a given file | save | save a model to a given file | prune | prune a model | eval | evaluate constants and places | unfold | unfold a coloured model Simulation | sim | run a simulation of the model

Page 23: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 17

Architecture

* Command queue, a typical use case

Page 24: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 17

Architecture

* Command queue, a typical use case

Command queue

Page 25: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 17

Architecture

* Command queue, a typical use case

CLICommand queueexe

user cmd: spike exe -f confFile

Page 26: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 17

Architecture

* Command queue, a typical use case

CLI exeCommand queueexe

user cmd: spike exe -f confFile

Page 27: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 17

Architecture

* Command queue, a typical use case

CLI exeCommand queue

Configurationexe exe-

user cmd: spike exe -f confFile

Page 28: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 17

Architecture

* Command queue, a typical use case

CLI exeload

Command queueConfiguration

exe exeload-

user cmd: spike exe -f confFile

Page 29: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 17

Architecture

* Command queue, a typical use case

CLI exeload

unfold

Command queueConfiguration

exe exeunfold-

user cmd: spike exe -f confFile

Page 30: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 17

Architecture

* Command queue, a typical use case

CLI exeload

unfoldeval

Command queueConfiguration

exe exeeval-

user cmd: spike exe -f confFile

Page 31: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 17

Architecture

* Command queue, a typical use case

CLI exeload

unfoldevalsim

Command queueConfiguration

exe exesim-

user cmd: spike exe -f confFile

Page 32: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 17

Architecture

* Command queue, a typical use case

CLI exeload

unfoldevalsim

Command queueConfigurationload, unfold, eval, sim

Converter

exe exe

load

--

user cmd: spike exe -f confFile

Page 33: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 17

Architecture

* Command queue, a typical use case

CLI exeload

unfoldevalsim

Command queueConfigurationload, unfold, eval, sim

Converter

exe exe

unfold---

user cmd: spike exe -f confFile

Page 34: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 17

Architecture

* Command queue, a typical use case

CLI exeload

unfoldevalsim

Command queueConfigurationload, unfold, eval, sim

Converter

exe exe

eval----

user cmd: spike exe -f confFile

Page 35: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 17

Architecture

* Command queue, a typical use case

CLI exeload

unfoldevalsim

Command queueConfigurationload, unfold, eval, sim

ConverterSimulation

load, unfold, eval

exe exe

sim

-----

user cmd: spike exe -f confFile

Page 36: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 18

Use case

1 Load model2 Set model configuration3 Determine set of simulation configurations4 For( each simulation configuration ) {5 Run simulation6 Save results of the simulation7 }

Compare how a model behaves under different types of simulation algorithms or under different configurations of a given simulation algorithm.

Page 37: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 19

Present status

Mode

l a

nd simulation configuration

Model

Reduced Model

Deco

mpos

ition

Reduction

Components

Finding

interface

nodes

Distribution

Distributed model

synchronization

Simulation

Co

mponen

ts with interfaces

Traces

Reproduciblesimulation

Export

Redu

ction

TraceAnalysis

Page 38: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 19

Present status

Mode

l a

nd simulation configuration

Model

Reduced Model

Deco

mpos

ition

Reduction

Components

Finding

interface

nodes

Distribution

Distributed model

synchronization

Simulation

Co

mponen

ts with interfaces

Traces

Reproduciblesimulation

Export

Redu

ction

TraceAnalysis

Page 39: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 19

Present status

Mode

l a

nd simulation configuration

Model

Reduced Model

Deco

mpos

ition

Reduction

Components

Finding

interface

nodes

Distribution

Distributed model

synchronization

Simulation

Co

mponen

ts with interfaces

Traces

Reproduciblesimulation

Export

Redu

ction

TraceAnalysis

Page 40: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 19

Present status

Mode

l a

nd simulation configuration

Model

Reduced Model

Deco

mpos

ition

Reduction

Components

Finding

interface

nodes

Distribution

Distributed model

synchronization

Simulation

Co

mponen

ts with interfaces

Traces

Reproduciblesimulation

Export

Redu

ction

TraceAnalysis

Page 41: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 20

Future works

Mode

l a

nd simulation configuration

Model

Reduced Model

Deco

mpos

ition

Reduction

Components

Finding

interface

nodes

Distribution

Distributed model

synchronization

Simulation

Co

mponen

ts with interfaces

Traces

Reproduciblesimulation

Export

Redu

ction

TraceAnalysis

X

Page 42: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 20

Future works

Mode

l a

nd simulation configuration

Model

Reduced Model

Deco

mpos

ition

Reduction

Components

Finding

interface

nodes

Distribution

Distributed model

synchronization

Simulation

Co

mponen

ts with interfaces

Traces

Reproduciblesimulation

Export

Redu

ction

TraceAnalysis

X

X

X

Page 43: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 20

Future works

Mode

l a

nd simulation configuration

Model

Reduced Model

Deco

mpos

ition

Reduction

Components

Finding

interface

nodes

Distribution

Distributed model

synchronization

Simulation

Co

mponen

ts with interfaces

Traces

Reproduciblesimulation

Export

Redu

ction

TraceAnalysis

X

X

XX

Page 44: Spike - a command line tool for continuous, stochastic ... · jacek.chodak@b-tu.de AWPN October 2018 01 Spike - a command line tool for continuous, stochastic & hybrid simulation

[email protected] AWPN October 2018 21

Thank you for your attention

http://www-dssz.informatik.tu-cottbus.de/DSSZ/Software/Spike

Any questions are welcome