Transcript Slide 1

MSDL’08
Eugene Syriani
Ph.D. Student in the Modelling, Simulation and Design Lab
School of Computer Science
McGill University
MSDL’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
MSDL’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 Work
3
MSDL’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 models
4
MSDL’08
CASE STUDY: ANTWORLD SIMULATION [1]
EXTENDED
[1] http://www.fots.ua.ac.be/events/grabats2008/ (2008/07/21)
5
MSDL’08
CASE STUDY: ANTWORLD SIMULATION
Domain-specific modelling
6
MSDL’08
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
7
MSDL’08
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
8
MSDL’08
FROM DEVS TO MOTIF
9
MSDL’08
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)
10
MSDL’08
DEVS META-MODEL
MSDL’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
[2] Syriani E. and Vangheluwe H.: Programmed Graph Rewriting with DEVS. AGTIVE 2007, LNCS (2008)
12
MSDL’08
MOTIF META-MODEL
MSDL’08
MOTIF AS A DEVS MODEL
14
MSDL’08
MOTIF AS A DEVS MODEL
• At most one rule will execute
15
MSDL’08
MOTIF AS A DEVS MODEL
• Synchronize parallel threads
• Success if at least one thread succeeds
16
MSDL’08
MOTIF AS A DEVS MODEL
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.
17
MSDL’08
MoTiF
MODELLING 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 18
MSDL’08
MoTiF EXECUTION
COMPILE
Class Grabfood :
Class
defGrabfood
match(): :
def
match():
class …
Grabfood:
def def
execute():
…match():
def…execute():
…
def…execute():
…
IMPORT
SIMULATE
GENERATE
class Grabfood(ARule):
def __init__(self):
ARule.__init__(self, name=‘GF')
self.state =
ARuleState(Grabfood())
def weightFunction(self):
return 1.0
19
MSDL’08
MOTIF SOLUTION
20
MSDL’08
ANTWORLD RULES
21
MSDL’08
SOME ANTWORLD RULES
dropFood
goToSameNodeIn
KillOnNode
checkAntOnOutCircle
moveTowardsHill
KillOnNextCircleNodeIn
connectNodesInSameCircle
grabFood
WeakenSameNodeOut
22
MSDL’08
MODELLING OF THE TRANSFORMATION: Round CRule
23
MSDL’08
MODELLING OF THE TRANSFORMATION: AntMovements CRule
24
MSDL’08
MODELLING OF THE TRANSFORMATION: GenerateCircle CRule
25
MSDL’08
MODELLING OF THE TRANSFORMATION: EndOfRound CRule
26
MSDL’08
MODELLING OF THE TRANSFORMATION: HumanStep CRule
27
MSDL’08
MODELLING OF TRANSFORMATION: SYSTEM
• User – Controller –
Autonomous loop
• Feed-back to User
• On User interrupt:
User Controlled
• Feed-back to User
28
MSDL’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)
[4] E. Syriani and H. Vangheluwe. Programmed Graph Rewriting with Time for Simulation-Based Design. ICMT 2008. LNCS, vol.5063,
pp. 91-106 (2008)
29
MSDL’08
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
30
MSDL’08
31