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
293e533a
Commit
293e533a
authored
Feb 10, 2022
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3229179e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
10 deletions
+35
-10
Route.tla
Route.tla
+35
-10
No files found.
Route.tla
View file @
293e533a
...
...
@@ -57,10 +57,13 @@ EdgeQQ(e) == LET x == CHOOSE x \in e : TRUE
\* All n->m and m<-n queues
Queues == {e \in Nodes \X Nodes : {e[1],e[2]} \in Edges}
QueuesFrom(n) == {q \in Queues : q[1] = n}
QueuesTo(n) == {q \in Queues : q[2] = n}
(********
--algorithm Route {
variables
variables
\* msgs[<<n,m>>] is message queue for n->m
\* msgs = [q \in (UNION {EdgeQQ(e) : e \in Edges}) |->
msgs = [q \in Queues |->
...
...
@@ -69,18 +72,33 @@ Queues == {e \in Nodes \X Nodes : {e[1],e[2]} \in Edges}
fair process (RT \in Nodes)
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) {
skip;
with (q \in {r \in QueuesTo(self) : msgs[r] /= << >>}) {
m := Head(msgs[q]);
msgs[q] := Tail(msgs[q]);
x: if (m < depth - 1) {
depth := m + 1;
parent := q[1];
\* send m further to all neighbours except from whom we received it
msgs := [t \in Queues |->
IF t \in QueuesFrom(self) \ {<<self, parent>>}
THEN Append(msgs[t], depth)
ELSE msgs[t] ]
}
}
}
}
}
};
********)
\* BEGIN TRANSLATION (chksum(pcal) = "
c4d34ca9" /\ chksum(tla) = "7195f9d9
")
VARIABLES msgs, depth, parent
\* BEGIN TRANSLATION (chksum(pcal) = "
1b3e9734" /\ chksum(tla) = "76d3f425
")
VARIABLES msgs, depth, parent
, m
vars == << msgs, depth, parent >>
vars == << msgs, depth, parent
, m
>>
ProcSet == (Nodes)
...
...
@@ -91,16 +109,23 @@ Init == (* Global variables *)
(* Process RT *)
/\ depth = [self \in Nodes |-> IF self = root THEN 0 ELSE Inf]
/\ parent = [self \in Nodes |-> IF self = root THEN root ELSE NoRoute]
/\ m = [self \in Nodes |-> -1]
RT(self) == /\ TRUE
/\ UNCHANGED << msgs, depth, parent >>
RT(self) == \E q \in {r \in QueuesTo(self) : msgs[r] /= << >>}:
/\ m' = [m EXCEPT ![self] = Head(msgs[q])]
/\ msgs' = [msgs EXCEPT ![q] = Tail(msgs[q])]
/\ IF m'[self] < depth[self] - 1
THEN /\ depth' = [depth EXCEPT ![self] = m'[self] + 1]
/\ parent' = [parent EXCEPT ![self] = q[1]]
ELSE /\ TRUE
/\ UNCHANGED << depth, parent >>
Next == (\E self \in Nodes: RT(self))
Spec == /\ Init /\ [][Next]_vars
/\ \A self \in Nodes : WF_vars(RT(self))
\* END TRANSLATION
\* END TRANSLATION
(*
TypeOK ==
...
...
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