Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
KTLA Study
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
KTLA Study
Commits
31931cdd
Commit
31931cdd
authored
Feb 11, 2022
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e3c492c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
25 deletions
+31
-25
Route.tla
Route.tla
+31
-25
No files found.
Route.tla
View file @
31931cdd
...
@@ -72,33 +72,35 @@ QueuesTo(n) == {q \in Queues : q[2] = n}
...
@@ -72,33 +72,35 @@ QueuesTo(n) == {q \in Queues : q[2] = n}
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;
m = -1; \* XXX must be temp.only (LET ... IN ...)
{
{
loop: while (TRUE) {
loop: while (TRUE) {
with (q \in {r \in QueuesTo(self) : msgs[r] /= << >>}) {
with (q \in {r \in QueuesTo(self) : msgs[r] /= << >>}) {
m := Head(msgs[q]);
with (m = Head(msgs[q])) {
msgs[q] := Tail(msgs[q]);
with (msgs_ = [msgs EXCEPT ![q] = Tail(msgs[q])]) {
x:
if (m < depth - 1) {
if (m < depth - 1) {
depth := m + 1;
depth := m + 1;
parent := q[1];
parent := q[1];
\* send m further to all neighbours except from whom we received it
\* send m further to all neighbours except from whom we received it
msgs :
= [t \in Queues |->
with (msgs__
= [t \in Queues |->
IF t \in QueuesFrom(self) \ {<<self, parent>>}
IF t \in QueuesFrom(self) \ {<<self, parent>>}
THEN Append(msgs[t], depth)
THEN Append(msgs_[t], depth)
ELSE msgs[t] ]
ELSE msgs_[t] ])
}
msgs := msgs__;
}
else {
msgs := msgs_
}
}}
}
}
}
}
}
}
};
};
********)
********)
\* BEGIN TRANSLATION (chksum(pcal) = "
1b3e9734" /\ chksum(tla) = "76d3f42
5")
\* BEGIN TRANSLATION (chksum(pcal) = "
ef4913a" /\ chksum(tla) = "2e68ab6
5")
VARIABLES msgs, depth, parent
, m
VARIABLES msgs, depth, parent
vars == << msgs, depth, parent
, m
>>
vars == << msgs, depth, parent >>
ProcSet == (Nodes)
ProcSet == (Nodes)
...
@@ -109,16 +111,20 @@ Init == (* Global variables *)
...
@@ -109,16 +111,20 @@ Init == (* Global variables *)
(* 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]
/\ m = [self \in Nodes |-> -1]
RT(self) == \E q \in {r \in QueuesTo(self) : msgs[r] /= << >>}:
RT(self) == \E q \in {r \in QueuesTo(self) : msgs[r] /= << >>}:
/\ m' = [m EXCEPT ![self] = Head(msgs[q])]
LET m == Head(msgs[q]) IN
/\ msgs' = [msgs EXCEPT ![q] = Tail(msgs[q])]
LET msgs_ == [msgs EXCEPT ![q] = Tail(msgs[q])] IN
/\ IF m'[self] < depth[self] - 1
IF m < depth[self] - 1
THEN /\ depth' = [depth EXCEPT ![self] = m'[self] + 1]
THEN /\ depth' = [depth EXCEPT ![self] = m + 1]
/\ parent' = [parent EXCEPT ![self] = q[1]]
/\ parent' = [parent EXCEPT ![self] = q[1]]
ELSE /\ TRUE
/\ LET msgs__ == [t \in Queues |->
/\ UNCHANGED << depth, parent >>
IF t \in QueuesFrom(self) \ {<<self, parent'[self]>>}
THEN Append(msgs_[t], depth'[self])
ELSE msgs_[t] ] IN
msgs' = msgs__
ELSE /\ msgs' = msgs_
/\ UNCHANGED << depth, parent >>
Next == (\E self \in Nodes: RT(self))
Next == (\E self \in Nodes: RT(self))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment