McGill University School of Computer Science Ph.D. Student in the Modelling, Simulation and Design Lab Eugene Syriani Hans Vangheluwe
McGill University School of Computer Science Ph.D. Student in the Modelling, Simulation and Design Lab Eugene Syriani Hans Vangheluwe
OVERVIEW Background In the context The Modular Timed Graph Transformation (MoTiF) language Case Study: Reactive PacMan Game Modelling, Simulation and Synthesis Modelling of transformation and its environment Simulation for optimization Synthesis of application Conclusion and Future Work 3
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 Modelling, Simulation and Synthesis 4
IN THE CONTEXT 5
MoTiF: SEMANTIC DOMAIN The Discrete Event System Specification [1] (DEVS) formalism Highly compositional simulation framework DEVS: – Blocks – Ports – Events Semantics: Parallel composition of blocks/models 6 [1] Zeigler B.P., Multifacetted Modelling and Discrete Event Simulation/ Academic Press, London (1984)
MoTiF: SEMANTIC DOMAIN Atomic DEVS: – Time Advance – Output Function – Internal Transition –External Transition ATOMIC 7
MoTiF: SEMANTIC DOMAIN Coupled DEVS 8 C1 A1 A2 C2
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 9 [2] Syriani E. and Vangheluwe H.: Programmed Graph Rewriting with DEVS. AGTIVE 2007, LNCS (2008)
MoTiF MODELLING ENVIRONMENT IN AToM 3 [3] 10 [3] de Lara J., Vangheluwe H., AToM 3 : A tool for multi-formalism and meta-modelling. FASE, LNCS 2306 (2002),
MoTiF EXECUTION COMPILE GENERATE IMPORT SIMULATE class Pacmaneat: def match(): … def execute(): … class Pacmaneat: def match(): … def execute(): … class Kill(ARule): def __init__(self): ARule.__init__(self, name=Kill') self.state = ARuleState(Pacdie()) def weightFunction(self): return 1.0 class Kill(ARule): def __init__(self): ARule.__init__(self, name=Kill') self.state = ARuleState(Pacdie()) def weightFunction(self): return 1.0 class Pacmanmoveri: def match(): … def execute(): … class Pacmanmoveri: def match(): … def execute(): … class Pacmandie: def match(): … def execute(): … class Pacmandie: def match(): … def execute(): … 11
CASE STUDY: REACTIVE PACMAN GAME Simplified PacMan formalism [4] [4] Heckel R., Graph Transformation in a nutshell. FoVMT, ENTCS 148 (2006),
CASE STUDY: REACTIVE PACMAN GAME Build the Graph Rewriting Rules pacLink 3 ghostLink 3 1: Match[1].score pacLink foodLink 6 4 pacLink
CASE STUDY: REACTIVE PACMAN GAME Build the Graph Rewriting Rules gridLeft ghostLink gridLeft ghostLink gridRight pacLink gridRight pacLink 3 3
15
MODELLING OF THE TRANSFORMATION: SYSTEM User – Controller – Autonomous loop Feed-back to User On User interrupt: User Controlled Feed-back to User Autonomous User Controlled 16
MODELLING OF THE TRANSFORMATION: AUTONOMOUS CRule Priorities 17
MODELLING OF THE TRANSFORMATION: GHOSTMOVE CRule Decider finds the next move for the ghost Decider consumes time 18
MODELLING OF TRANSFORMATION: SYSTEM Autonomous User Controlled 19
MODELLING OF THE TRANSFORMATION: USERCONTROLLED CRule Conditional rule execution 20
MODELLING OF THE TRANSFORMATION: SYSTEM Autonomous User Controlled 21
MODELLING OF ENVIRONMENT: USER CoupledBlock User Behavior User Interaction Customization Modularity 22
MODEL OF THE PLAYER: STRATEGY 23 Random
MODELLING OF ENVIRONMENT: USERBEHAVIOR CoupledBlock Back-tracking Collector consumes time 24
MODELLING OF ENVIRONMENT: TRYMOVE CRule gridRight pacLink gridRight pacLink ghostLink 25 Non-determinism
MODEL OF THE PLAYER: SPEED Player reaction time [5]: – Thinking time – Motorics time 26 [5] Zaitev A.V., Skorik Y.A., Mathematical description of sensorimotor reaction time distribution, Human Psychology 28(4) (2002), Slow Normal Fast Very Fast
27
WHY DO WE NEED SIMULATION? A.I. Strategy Random – Smart – Very Smart Speed Too Slow – … – Too Fast Very Smart Fix Strategy: Very Smart Find optimal speed We want to build a playable game 28
SIMULATION RESULTS Finding the optimal game speed 29
30
SYNTHESIS OF APPLICATION Synthesis of a reactive game Discard the UserBehavior block Runs on a web browser using AJAX and SVG Real-time model transformation 31 User Interaction User Behavior User Interaction
SUMMARY MoTiF MoTiF allows for Modelling and Simulation-Based Design – Graph transformation rules – Timed transformation system – User Synthesis of applications – Reactive – Real-time 32 Autonomous User Controlled
FUTURE WORK Model A.I. behavior: backtracking Re-use and parametrisation of transformation models MORE COMPLEX EXAMPLES 33
34 ?