Ver código fonte

petri net formalism: add inhibitor arc

Joeri Exelmans 11 meses atrás
pai
commit
6571d8556c

+ 3 - 0
examples/petrinet/metamodels/mm_design.od

@@ -7,5 +7,8 @@ arc:Association (PNConnectable -> PNConnectable)
 PNPlace:Class
 PNTransition:Class
 
+# inhibitor arc
+inh_arc:Association (PNPlace -> PNTransition)
+
 :Inheritance (PNPlace -> PNConnectable)
 :Inheritance (PNTransition -> PNConnectable)

+ 13 - 0
examples/petrinet/operational_semantics/r_fire_transition_nac2.od

@@ -0,0 +1,13 @@
+# A place with tokens:
+
+p:RAM_PNPlace
+ps:RAM_PNPlaceState {
+  RAM_numTokens = `get_value(this) > 0`;
+}
+:RAM_pn_of (ps -> p)
+
+# An incoming inhibitor arc from that place to our transition:
+
+t:RAM_PNTransition
+
+:RAM_inh_arc (p -> t)

+ 1 - 1
examples/petrinet/renderer.py

@@ -42,5 +42,5 @@ def render_petri_net(od: ODAPI):
         src_name = od.get_name(od.get_source(arc))
         tgt_name = od.get_name(od.get_target(arc))
         dot += f"{src_name} -> {tgt_name};"
-    show_graphviz(dot, engine="dot")
+    show_graphviz(dot, engine="neato")
     return ""

+ 3 - 1
examples/semantics/translational/rules/.gitignore

@@ -1,2 +1,4 @@
 # Let's not accidently add the solution to assignment 5...
-r_*.od
+r_*.od
+
+snapshot_after_*.od

Diferenças do arquivo suprimidas por serem muito extensas
+ 11 - 10
examples/semantics/translational/merged_mm.od


+ 2 - 1
transformation/rewriter.py

@@ -61,7 +61,8 @@ def rewrite(state, lhs_m: UUID, rhs_m: UUID, pattern_mm: UUID, lhs_match: dict,
         if "GlobalCondition" not in k and not k.endswith("_condition") and not k.endswith(".condition")
         and (not k.endswith("_name") or k.endswith("RAM_name")) and (not k.endswith(".name")))
 
-    print('filtered out:', set(k for k in bottom.read_keys(rhs_m) if k.endswith(".name") or k.endswith("_name")))
+    # See which keys were ignored by the rewriter:
+    # print('filtered out:', set(k for k in bottom.read_keys(rhs_m) if k.endswith(".name") or k.endswith("_name")))
 
     common = lhs_keys & rhs_keys
     to_delete = lhs_keys - common