1 / 38

Programmed Graph Rewriting with DEVS

Eugene Syriani and Hans Vangheluwe. Programmed Graph Rewriting with DEVS. School of Computer Science. McGill University. Overview. In the context Overview of the Discrete EVent system Specification (DEVS) formalism Building example with AToM 3

yoko-lawson
Download Presentation

Programmed Graph Rewriting with DEVS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Eugene SyrianiandHans Vangheluwe Programmed Graph Rewriting with DEVS School of Computer Science McGill University

  2. Overview • In the context • Overview of the Discrete EVent system Specification (DEVS) formalism • Building example with AToM3 • Graph Rewriting Control Flow (GRCF):Mimic AToM3 and beyond • Summary

  3. In the context • Model transformation: Programmed Graph Rewriting • At least as expressive as: GreAT, VMTS, Fujaba, ProGreS, MOFLON Sequencing, Branching, Looping, Hierarchy, Parallelism • Cleanly tear apart • Transformation entities • Control flow, structure, hierarchy • DEVS gives us time and modularity too

  4. Overview • In the context • Overview of the Discrete EVent system Specification (DEVS) formalism • Building example with AToM3 • Graph Rewriting Control Flow (GRCF):Mimic AToM3 and beyond • Summary

  5. Overview of the devs formalism • Bernard Zeigler, late ‘70s • Basis for compositional modelling and simulation of discrete event systems • Design, performance analysis and implementation

  6. Overview of the devs formalism • Block: Atomic / Coupled • Port: Inport / Outport • Event • Global time

  7. Overview of the devs formalism • Atomic DEVS: • Time Advance • Output Function • Internal Transition • External Transition ATOMIC

  8. Overview of the devs formalism Coupled DEVS C A1 A3 A2

  9. Overview of the devs formalism • Coupled DEVS: • Select Function C A1 A2

  10. Overview of the devs formalism Our implementation: pythonDEVS classCExample(CoupledDEVS): def__init__(self): self.M1 = self.addSubModel(Example()) self.M2 = self.addSubModel(Example()) self.connectPorts(self.M1.out, self.M2.in) def select(self, immList): returnimmList[0] classAExample(AtomicDEVS): def__init__(self): self.state = ExampleState() self.in = self.addInPort() self.out = self.addOutPort() defextTransition(self): X = self.peak(self.in) ... returnself.state defintTransition(self): ... returnself.state defoutputFnc(self): ... self.poke(self.out, Y) deftimeAdvance(self): return 1

  11. Overview • In the context • Overview of the Discrete EVent system Specification (DEVS) formalism • Building example with AToM3 • Graph Rewriting Control Flow (GRCF):Mimic AToM3 and beyond • Summary

  12. Building example with AToM3[1] Simplified PacMan formalism [2] [1] de Lara J., Vangheluwe H., AToM3: A tool for multi-formalism and meta-modelling, LNCS (2002), 174-188 [ 2] Heckel R., Graph Transformation in a nutshell, ENTCS (2006), 187-198

  13. Building example with AToM3 Build the Meta-Model of the PacMan formalism

  14. Building example with AToM3 Build the Graph Grammar

  15. 1 1 Building example with AToM3 4 4 2 2 Build the Graph Grammar 5 pacLink pacLink 3 3 6 foodLink 1: return self.LHS.nodeWithLabel(1).score + 1 P 1 P 2 5 pacLink 1 1 4 2 2 3 3 ghostLink ghostLink

  16. ghostLink ghostLink Building example with AToM3 7 1 2 1 2 6 Build the Graph Grammar 3 3 gridLeft gridLeft 4 4 P 3 pacLink pacLink 6 1 2 P 3 1 2 5 3 3 gridRight 4 gridRight 4

  17. Building example with AToM3

  18. Building example with AToM3 • Capture a trace of execution • Keep log of used rules

  19. Overview • In the context • Overview of the Discrete EVent system Specification (DEVS) formalism • Building example with AToM3 • Graph Rewriting Control Flow (GRCF):Mimic AToM3 and beyond • Summary

  20. Graph rewriting control flow • DEVS blocks • Atomic block: encapsulate the graph rewriting rule • Coupled block: encapsulate the graph grammar • Events • Inport: recieve the host graph • Outport(s): send the transformed graph

  21. Graph rewriting control flow

  22. Graph rewriting control flow Model AToM3’s graph transformation engine User Input Input graph Step Send graph to transform Transformed graph Control Graph Transformation Rules Trace Rules used

  23. Graph rewriting control flow Graph transformation engine User Input out_step g_out done_rcv done_send in_step g_init g_out Controller g_unmodified g_modified GGRules g_in GGRule trace match_succeed g_in g_succeed match_fail g_in match_succeed GGRule g_fail match_fail Trace trace trace

  24. Graph rewriting control flow Managing priorities GGRules Non-determinism:Randomize select function g_in Priority n g_in g_in abort abort GGRule GGRule match_fail match_fail match_succeed match_succeed in_success abort in_fail g_succeed Synchronizer out_success out_fail g_fail Priority n+1 g_in GGRule

  25. Graph rewriting control flow Use compiled version of AToM3’s rule classpacDie: ...

  26. Graph rewriting control flow import compiled rules… classAExample(AtomicDEVS): def__init__(self): self.state = ExampleState() self.in = self.addInPort() self.out = self.addOutPort() defextTransition(self): X = self.peak(self.in) ... returnself.state defintTransition(self): ... returnself.state defoutputFnc(self): ... self.poke(self.out, Y) deftimeAdvance(self): return 1

  27. Graph rewriting control flow Extension of AToM3’s graph transformation engine User out_control done_rcv out_step g_out control_out done_send in_step g_init in_control Controller g_out g_unmodified g_modified g_in g_fail g_fail g_in control_in User controlled Rules Autonomous Rules g_succeed

  28. Graph rewriting control flow Extension of AToM3’s graph transformation engine User controlled Rules control_in g_in g_fail g_succeed key g_in out_fail out_success in_fail Dispatch in_success g_up g_right g_left g_down g_in g_in g_in g_in Down Up Left Right match_fail match_succeed match_fail match_succeed match_fail match_succeed match_fail match_succeed

  29. Graph rewriting control flow Extension of AToM3’s graph transformation engine Autonomous Rules g_in Kill match_succeed match_fail g_in g_in Eat g_succeed match_succeed match_fail g_in Ghost Move match_succeed match_fail g_fail

  30. Overview • In the context • Overview of the Discrete EVent system Specification (DEVS) formalism • Building example with AToM3 • Graph Rewriting Control Flow (GRCF):Mimic AToM3 and beyond • Summary

  31. Summary Control flow structure properties satisfied • Sequence • Branching • Looping • Hierarchy + Modularity • Parallelism

  32. Are we at the right level of abstraction? Is it the way industry should go in model transformation?

  33. “[...] the rule execution semantics is similar to the execution semantics of asynchronous dataflow graphs and DEVS, but with a difference in the hierarchical rule execution. [...] the class diagrams Figs. 14 and 15 introduce the same concepts as found in DEVS.” A. Agrawal et al. The design of a language for model transformations. SoSym, 2006

  34. Conclusion and future work Parallelism • DEVS is a sequential, deterministic formalism • Parallel-DEVS • Kiltera (CSP-like languages)

  35. Conclusion and future work Time • Metric, Statistics • Timed graph transformation • Real-Time DEVS

  36. Conclusion and future work User - Events • Event-driven Graph Rewriting • Modelling of the user

  37. Conclusion and future work Some Extensions • Optimization hints • Information on the flow • Replace python code by... Statechart? • Multi-formalism • Add an AI block in the autonomous rules

  38. Graph rewriting control flow In AToM3 Outside AToM3 classAExample(AtomicDEVS): def__init__(self): self.state = ExampleState() self.in = self.addInPort() self.out = self.addOutPort() defextTransition(self): X = self.peak(self.in) ... returnself.state return 1 e(AtomicDEVS): def___(self): self.state = ExampleState() self.in = self.addInPort() self.out = hsdhfjhb Sdvjvkv Ds v return 1 classself.state = ExampleState() sdvv self.in = self.addInPort() self.out = self.addOutPort() defextTransition(self): X = self.peak(self.in) ... returnsdsdfsdfsdfsfsdfsdf

More Related