Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Succession diagram storage #28

Merged
merged 5 commits into from
Feb 21, 2023
Merged

Succession diagram storage #28

merged 5 commits into from
Feb 21, 2023

Conversation

jcrozum
Copy link
Owner

@jcrozum jcrozum commented Feb 6, 2023

No description provided.

@jcrozum
Copy link
Owner Author

jcrozum commented Feb 6, 2023

Will require careful merging with #23, possibly by hand. I am willing to take care of this merger and any complications that arise once this PR and #23 are both approved.

@github-actions
Copy link

github-actions bot commented Feb 6, 2023

Coverage

Coverage Report
FileStmtsMissCoverMissing
nfvsmotifs
   SuccessionDiagram.py41198%64
   interaction_graph_utils.py56689%5–6, 42, 53, 75–76
   motif_avoidant.py104793%16–17, 44–49, 168
   petri_net_translation.py79791%21–23, 48, 59–60, 86
   pyeda_utils.py823952%8, 47–57, 76–102
   space_utils.py77495%11, 25, 135, 151
   state_utils.py38489%11–12, 63, 70
   trappist_core.py902177%8–11, 35, 44, 147–150, 154–156, 173–179, 190–191
TOTAL6008985% 

Tests Skipped Failures Errors Time
149 0 💤 0 ❌ 0 🔥 8.096s ⏱️

@@ -76,18 +76,24 @@ def percolate_space(network: BooleanNetwork, space: dict[str, str]) -> tuple[dic
for var in network.variables():
var_name = network.get_variable_name(var)
expression = aeon_to_pyeda(network.get_update_function(var))

# if the var is already constant, it doesn't count
if expression == PYEDA_TRUE or expression == PYEDA_FALSE:
Copy link
Collaborator

@daemontus daemontus Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a problem for percolation of constants/inputs? Let's have x = true, but as the input space, I provide a dictionary where x does not have a fixed value. Then the value of x never makes it into the result space, even though the percolation should set it to true?

Edit: I'll push a test to demonstrate shortly :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok... I have pushed a test that demonstrates this and fails on my machine.

Now, it may very well be that I don't understand something about the semantics of percolate_space, which would then make this behaviour ok. If that's the case, please update the test to what you believe is the right behaviour for that input :)

Copy link
Owner Author

@jcrozum jcrozum Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a matter of convention, but as you note, it has other implications. It is sometimes useful to distinguish between variables that become fixed as a result of the external override vs as a result of the natural dynamics. I changed it here because it was leading to some inconsistent results regarding driver nodes, etc., but after seeing your comment, I realize I that it would be beneficial to have a flag to determine which behavior is desired. I'll make an issue to track this, and we can discuss it further there if needed.

Edit: see #32

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I don't really have a specific inclination towards either variant. I would just like to have it defined as exactly as possible, because when we just write "percolation", intuitively I see both interpretations as meaningful and don't know which one is the one we actually want.

self.G.add_node(0, fixed_vars={}, depth=depth)
sd_nodes_at_last_depth = {0}

while (sd_nodes_at_last_depth and depth < MAX_DEPTH and self.G.number_of_nodes() < MAX_SIZE):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Off topic question from a (mostly) non-Python user: Are the parenthesis here idiomatic or not? In Rust, automatic format tools would remove them, because they don't serve any semantic purpose (and AFAIK they are redundant here as well, right?).

With that said, I like some extra clarifying parenthesis from time to time and I don't really think they should be removed here. I was just beaten into submission by Rust linters, so I'm asking about the consensus in other languages :D

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right; these should be removed. Usually they are only used if the test condition is so long you need to split it across multiple lines.

@daemontus
Copy link
Collaborator

I have looked at everything :) Aside from the small regression in percolate_space, I think we are good.

Once you fix the failing test, you can merge this, no need to re-review it.

Copy link
Collaborator

@daemontus daemontus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the space_utils discussion is resolved, this can be merged without re-review.

@jcrozum jcrozum mentioned this pull request Feb 8, 2023
@jcrozum
Copy link
Owner Author

jcrozum commented Feb 9, 2023

I have addressed the percolation convention, and updated some tests to account for the convention difference. In some cases I just switched the assertion to the new default convention, in other cases I test both conventions.

@daemontus
Copy link
Collaborator

Awesome! Thank you very much :) Now everything is clear to me.

jcrozum added a commit that referenced this pull request Feb 9, 2023
@jcrozum jcrozum merged commit 021848b into main Feb 21, 2023
@jcrozum jcrozum deleted the succession-diagram-storage branch August 2, 2023 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants