310 likes | 455 Views
DEVS as a Semantic Domain for Programmed Graph Transformation. Eugene Syriani. Reference. GraBaTS 2008 Tool contest E. Syriani and H. Vangheluwe : Using MoTif for the AntWorld Simulation Tool Contest
E N D
DEVS as a Semantic Domain for Programmed Graph Transformation Eugene Syriani
Reference • GraBaTS 2008 Tool contestE. 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
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 Work
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 models
Case Study: AntWorld Simulation [1] EXTENDED [1] http://www.fots.ua.ac.be/events/grabats2008/ (2008/07/21)
Case Study: AntWorld Simulation Domain-specific modelling
Case Study: AntWorld Simulation Simulation Semantics • 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
Case Study: AntWorld Simulation++ Extended Simulation Semantics • At any moment in time, a human steps on the map • Kills all ants on the five nodes • The nodes loose food and pheromones
DEVS • The Discrete Event System Specification [2] (DEVS) formalism • Highly compositional simulation framework • DEVS: • Blocks • Ports • Events • Semantics: Parallel composition of blocks/models [2] Zeigler B.P., Multifacetted Modelling and Discrete Event Simulation/ Academic Press, London (1984)
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 [2] Syriani E. and Vangheluwe H.: Programmed Graph Rewriting with DEVS. AGTIVE 2007, LNCS (2008)
MoTif as a DEVS Model • At most one rule will execute
MoTif as a DEVS Model • Synchronize parallel threads • Success if at least one thread succeeds
MoTif as a DEVS Model The select function: • If the Selector is in the imminent list, choose the Selector. • 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. • At this point no rule has any unprocessed match left, then choose any of the ARule in the imminent list. • Finally, the imminent list contains either custom atomic blocks or Synchronizers. • Proceed with a first-in-first-out selection.
MotifModelling Environment in AToM3 [3] [3] de Lara J., Vangheluwe H., AToM3: A tool for multi-formalism and meta-modelling. FASE, LNCS 2306 (2002), 174-188
Motif Execution Class Grabfood : def match(): … def execute(): … Class Grabfood : def match(): … def execute(): … class Grabfood: def match(): … def execute(): … COMPILE IMPORT SIMULATE class Grabfood(ARule): def __init__(self): ARule.__init__(self, name=‘GF') self.state = ARuleState(Grabfood()) def weightFunction(self): return 1.0 GENERATE
Some AntWorld Rules dropFood checkAntOnOutCircle connectNodesInSameCircle goToSameNodeIn moveTowardsHill grabFood KillOnNode KillOnNextCircleNodeIn WeakenSameNodeOut
Modelling of transformation: System • User – Controller – Autonomous loop • Feed-back to User • On User interrupt: User Controlled • Feed-back to User
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) [4] E. Syriani and H. Vangheluwe. Programmed Graph Rewriting with Time for Simulation-Based Design. ICMT 2008. LNCS, vol.5063, pp. 91-106 (2008)
Conclusion • Formalised MoTif in terms of DEVS • Provided solution to the AntWorld case-study • Extended solution with user interrupt • Deployment of an application • Pure parallel execution, possibly distributed • Re-use and parametrisation of transformation models • Allowing variable structure