Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
automata-logic-project2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
User expired
automata-logic-project2
Commits
c73d0bd2
Commit
c73d0bd2
authored
3 years ago
by
Valerian Wintner
Browse files
Options
Downloads
Patches
Plain Diff
Remove unnecessary changing of predecessor-set.
parent
539a5f7c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+1
-1
1 addition, 1 deletion
README.md
src/arena.rs
+12
-12
12 additions, 12 deletions
src/arena.rs
with
13 additions
and
13 deletions
README.md
+
1
−
1
View file @
c73d0bd2
...
...
@@ -71,7 +71,7 @@ When done, remove the image:
-
It checks if some successor of the green node is in the winning set.
-
If that is the case, the green node is added to the winning set, and removed from the nodes being iterated on.
-
Any time a node is added to the winning set, any red nodes that are a predecessor of this newly added node have their counter reduced by 1.
-
If the counter of a red node reaches 0, it is added to the winning set
and removed from the predecessor-set of the added node
.
-
If the counter of a red node reaches 0, it is added to the winning set.
-
The loop runs until no new nodes are added in the
`pre`
-step.
# Libraries used
...
...
This diff is collapsed.
Click to expand it.
src/arena.rs
+
12
−
12
View file @
c73d0bd2
...
...
@@ -11,20 +11,18 @@ fn insert_node(
let
mut
to_insert
=
vec!
[
node
];
while
let
Some
(
node
)
=
to_insert
.pop
()
{
additional_winning
.insert
(
node
.clone
());
let
predecessors
=
pred
.entry
(
node
);
predecessors
.and_modify
(|
predecessors
|
{
let
mut
changed_predecessors
=
HashSet
::
new
();
for
predecessor
in
predecessors
.iter
()
{
let
counter
=
predecessor
.counter
.take
()
-
1
;
if
counter
==
0
{
to_insert
.push
(
predecessor
.id
.clone
());
}
else
{
predecessor
.counter
.replace
(
counter
);
changed_predecessors
.insert
(
predecessor
.clone
());
if
let
Some
(
predecessors
)
=
pred
.get
(
&
node
)
{
for
predecessor
in
predecessors
{
let
mut
counter
=
predecessor
.counter
.borrow_mut
();
if
*
counter
>=
1
{
// This is the last successor needed for the red node to get added
if
*
counter
==
1
{
to_insert
.push
(
predecessor
.id
.clone
());
}
*
counter
-=
1
;
}
}
*
predecessors
=
changed_predecessors
});
}
}
}
...
...
@@ -70,6 +68,7 @@ pub fn winning_positions(
"[prestep] Winning positions after adding final positions: {:?}"
,
winning_positions
);
debug!
(
"[prestep] Predecessors: {:#?}"
,
pred
);
}
// Remove green nodes that have already been added to winners due to being final positions
greens
=
greens
...
...
@@ -89,6 +88,7 @@ pub fn winning_positions(
if
additional_winnings
.is_empty
()
{
return
winning_positions
;
}
debug!
(
"[iter] Predecessors: {:#?}"
,
pred
);
greens
=
changed_greens
;
winning_positions
.extend
(
additional_winnings
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment