Commit 3229179e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent bd2d1550
...@@ -54,19 +54,22 @@ EdgeQQ(e) == LET x == CHOOSE x \in e : TRUE ...@@ -54,19 +54,22 @@ EdgeQQ(e) == LET x == CHOOSE x \in e : TRUE
IN IN
{<<x,y>>, <<y,x>>} {<<x,y>>, <<y,x>>}
\* All n->m and m<-n queues
Queues == {e \in Nodes \X Nodes : {e[1],e[2]} \in Edges}
(******** (********
--algorithm Route { --algorithm Route {
variables ZZdepth \* node -> depth variables
= [[n \in Nodes |-> Inf] EXCEPT ![root] = 0], \* msgs[<<n,m>>] is message queue for n->m
ZZparent \* node -> parent node \* msgs = [q \in (UNION {EdgeQQ(e) : e \in Edges}) |->
= [[n \in Nodes |-> NoRoute] EXCEPT ![root] = root], msgs = [q \in Queues |->
IF q[1] = root THEN <<0>> \* start with root sending initial messages
\* msgs[<<n,m>>] is message queue for n->m ELSE << >>];
msgs = [q \in (UNION {EdgeQQ(e) : e \in Edges}) |-> << >>];
fair process (RT \in Nodes) fair process (RT \in Nodes)
variables depth = IF self = root THEN 0 ELSE Inf, variables depth = IF self = root THEN 0 ELSE Inf,
parent = IF self = root THEN root ELSE NoRoute; parent = IF self = root THEN root ELSE NoRoute;
{ {
loop: while (TRUE) { loop: while (TRUE) {
skip; skip;
...@@ -74,23 +77,23 @@ EdgeQQ(e) == LET x == CHOOSE x \in e : TRUE ...@@ -74,23 +77,23 @@ EdgeQQ(e) == LET x == CHOOSE x \in e : TRUE
} }
}; };
********) ********)
\* BEGIN TRANSLATION (chksum(pcal) = "65933661" /\ chksum(tla) = "ff5ab133") \* BEGIN TRANSLATION (chksum(pcal) = "c4d34ca9" /\ chksum(tla) = "7195f9d9")
VARIABLES ZZdepth, ZZparent, msgs, depth, parent VARIABLES msgs, depth, parent
vars == << ZZdepth, ZZparent, msgs, depth, parent >> vars == << msgs, depth, parent >>
ProcSet == (Nodes) ProcSet == (Nodes)
Init == (* Global variables *) Init == (* Global variables *)
/\ ZZdepth = [[n \in Nodes |-> Inf] EXCEPT ![root] = 0] /\ msgs = [q \in Queues |->
/\ ZZparent = [[n \in Nodes |-> NoRoute] EXCEPT ![root] = root] IF q[1] = root THEN <<0>>
/\ msgs = [q \in (UNION {EdgeQQ(e) : e \in Edges}) |-> << >>] ELSE << >>]
(* Process RT *) (* Process RT *)
/\ depth = [self \in Nodes |-> IF self = root THEN 0 ELSE Inf] /\ depth = [self \in Nodes |-> IF self = root THEN 0 ELSE Inf]
/\ parent = [self \in Nodes |-> IF self = root THEN root ELSE NoRoute] /\ parent = [self \in Nodes |-> IF self = root THEN root ELSE NoRoute]
RT(self) == /\ TRUE RT(self) == /\ TRUE
/\ UNCHANGED << ZZdepth, ZZparent, msgs, depth, parent >> /\ UNCHANGED << msgs, depth, parent >>
Next == (\E self \in Nodes: RT(self)) Next == (\E self \in Nodes: RT(self))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment