DEVS as a Semantic Domain for Programmed Graph Transformation
description
Transcript of DEVS as a Semantic Domain for Programmed Graph Transformation
McGill UniversitySchool of Computer Science
Ph.D. Student in the Modelling, Simulation and Design Lab
MSDL’08
DEVS as a Semantic Domain for Programmed
Graph Transformation
Eugene Syriani
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
REFERENCE• GraBaTS 2008 Tool contest
E. Syriani and H. Vangheluwe: Using MoTif for the AntWorld Simulation Tool Contest
• DEVS Book (2008)E. Syriani and H. Vangheluwe: DEVS: A Semantic Domain For Programmed Graph Transformation
2
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
OVERVIEW
Background
In the context
Case Study: The extended AntWorld Simulation
The Modular Timed Graph Transformation language (MoTif)
From DEVS to MoTif
The MoTif solution for the AntWorld case-study
Rules & Control Structure
Real-Time Model Transformation & Deployment
Conclusion and Future Work3
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
IN THE CONTEXT• Model Transformation Graph Transformation
• Controlled Graph Rewriting (rewriting rules)
• Control Primitives :Sequencing, Branching, Looping, Parallelism, Hierarchy
• Time is inherent in our transformation models4
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
CASE STUDY: ANTWORLD SIMULATION [1]
5[1] http://www.fots.ua.ac.be/events/grabats2008/ (2008/07/21)
EXTENDED
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
CASE STUDY: ANTWORLD SIMULATION Domain-specific modelling
6
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
CASE STUDY: ANTWORLD SIMULATION
• Create grid nodes when ant reaches outmost circle
• Differentiate between nodes along main axis
• Ant movement in search mode
• Ant movement in carry mode
• Ant creation, once food is brought back to the hill
• Evaporation of pheromones
Simulation Semantics
7
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
CASE STUDY: ANTWORLD SIMULATION++
• At any moment in time, a human steps on the map– Kills all ants on the five nodes
– The nodes loose food and pheromones
Extended Simulation Semantics
8
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
FROM DEVS TO MOTIF
9
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
DEVS• The Discrete Event System Specification [2]
(DEVS) formalism
• Highly compositional simulation framework
• DEVS:– Blocks
– Ports
– Events
• Semantics: Parallel composition of blocks/models
10[2] Zeigler B.P., Multifacetted Modelling and Discrete Event Simulation/ Academic Press, London (1984)
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
DEVS META-MODEL
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
MoTiF [2]• Blocks– Atomic: encapsulate a graph rewriting rule
– Coupled: encapsulate a set of rules (graph grammar)
• Events– Inport: receive the host graph
– Outport(s): send the transformed graph
12[2] Syriani E. and Vangheluwe H.: Programmed Graph Rewriting with DEVS. AGTIVE 2007, LNCS (2008)
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
MOTIF META-MODEL
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
MOTIF AS A DEVS MODEL
14
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
MOTIF AS A DEVS MODEL
15
• At most one rule will execute
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
MOTIF AS A DEVS MODEL
• Synchronize parallel threads
• Success if at least one thread succeeds16
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
MOTIF AS A DEVS MODEL
17
The select function:1. If the Selector is in the imminent list, choose the Selector.
2. Among all the rules that still have a match, choose a corresponding ARule from the imminent list at random, no matter what depth it is at inside this CRule.
3. At this point no rule has any unprocessed match left, then choose any of the ARule in the imminent list.
4. Finally, the imminent list contains either custom atomic blocks or Synchronizers.
5. Proceed with a first-in-first-out selection.
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
MoTiFMODELLING ENVIRONMENT IN AToM3 [3]
18[3] de Lara J., Vangheluwe H., AToM3: A tool for multi-formalism and meta-modelling. FASE, LNCS 2306 (2002), 174-188
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
MoTiF EXECUTION
COMPILE
GENERATE
IMPORT
SIMULATE
Class Grabfood : def match(): … def execute(): …
class Grabfood(ARule): def __init__(self): ARule.__init__(self, name=‘GF') self.state = ARuleState(Grabfood()) def weightFunction(self): return 1.0
Class Grabfood : def match(): … def execute(): …
class Grabfood: def match(): … def execute(): …
19
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
MOTIF SOLUTION
20
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
ANTWORLD RULES
21
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
SOME ANTWORLD RULES
22
dropFood checkAntOnOutCircle connectNodesInSameCircle
goToSameNodeIn moveTowardsHill grabFood
KillOnNode KillOnNextCircleNodeIn WeakenSameNodeOut
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
MODELLING OF THE TRANSFORMATION: Round CRule
23
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
MODELLING OF THE TRANSFORMATION: AntMovements CRule
24
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
MODELLING OF THE TRANSFORMATION: GenerateCircle CRule
25
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
MODELLING OF THE TRANSFORMATION: EndOfRound CRule
26
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
MODELLING OF THE TRANSFORMATION: HumanStep CRule
27
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
MODELLING OF TRANSFORMATION: SYSTEM
28
• User – Controller – Autonomous loop
• Feed-back to User
• On User interrupt: User Controlled
• Feed-back to User
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
SYNTHESIS OF APPLICATION [4]• Synthesis of a reactive application
• Discard the UserBehavior block
• Runs on a web browser using AJAX and SVG
• Real-time model transformation (RT-DEVS)
29[4] E. Syriani and H. Vangheluwe. Programmed Graph Rewriting with Time for Simulation-Based Design. ICMT 2008. LNCS, vol.5063, pp. 91-106 (2008)
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
CONCLUSIONFormalised MoTif in terms of DEVSProvided solution to the AntWorld case-studyExtended solution with user interruptDeployment of an application
? Pure parallel execution, possibly distributed? Re-use and parametrisation of transformation
models? Allowing variable structure
30
DEVS: A Semantic Domain For Programmed Graph TransformationMSDL’08
31
?