Model Transformation for Systematic Development of Actor Models
description
Transcript of Model Transformation for Systematic Development of Actor Models
http://chess.eecs.berkeley.edu/
February 21, 2008 Center for Hybrid and Embedded Software Systems
Motivation
Model Transformation for Systematic Development of Actor Models
Thomas H. Feng
Edward A. Lee
Traffic Light ModelHierarchical
HeterogeneousMoCs (Models of Computation)
NAOMI ProjectLockheed Martin ATL UC Berkeley
UIUC Vanderbilt
Demos in Ptolemy 7.0Const OptimizationDemonstrate model transformation for behavior-preserving optimization.
Modes
First Transform the first match
Random Transform a random match
Repeated
Transform until inapplicable
Advanced
Let user to manually control
Model TransformationGoalFacilitate the design of complex actor models.
SpecificationA TransformationRule actor contains an atomic transformation designed by the user. For example:
ReplacementPattern Correspondence Pattern Replacement Correspondence
Start with<Rule, Source>
Redex found?
YesNot applicable
No
Constraints satisfied?
Remove deleted objects
Yes
No
Exit withresult model
Add new objects
Perform operations
Subgraph isomorphism(an extension to the backtracking
algorithms by Ullmann)
Generated XML change requests:<deleteEntity name=“actor1”/><deleteRelation name=“relation1”/>
Generated XML change requests:<entity name=“C” class=
“ptolemy.actor.lib.Const”><property name=“value”
class=“ptolemy.data.expr.Parameter”value=“1”/>
</entity>
ReplacementPattern Correspondence Pattern Replacement Correspondence
Input
Output
ReplacementPattern Correspondence Pattern Replacement Correspondence
A hierarchical Ptolemy model for U.S. traffic light. The light cycles through 3 stages:
red (3 time units) → green (2) → yellow (1)
2) Add a pedestrian light to either the U.S. model or the European model:
(Here, entities in Pattern implicitly correspond to those in Replacement with the same name.)
Algorithm
Atomic Transformation Actor
Statically evaluate arithmetic operations on pairs of Const actors to reduce model size, until no further optimization is possible.
Dining PhilosophersDemonstrate model generation and higher-order composition.
1. ModelGenerator outputs an empty model.
2. The CreateFirst transformation rule generates the first philosopher and the first fork.
3. The CreateOne transformation rule is applied n-1 times, generating one philosopher and one fork each time.
Hierarchy FlatteningDemonstrate pattern searching, replacing and model
refactoring.
Match a level of the model hierarchy, and flatten it by moving the contents within the matched CompositeActor to the outside.
1) To create a European traffic light, we need a traffic controller with 4 stages instead:
red (2) → red & yellow (1) → green (2) → yellow (1)