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

Bidirectional rules #96

Merged
merged 6 commits into from
Mar 11, 2024

Conversation

mopichalova
Copy link
Collaborator

Bidirectional rules are allowed. Bidirectional rules can be defined with no specified rate, a single rate that applies to both directions, or two distinct rates, where the first rate applies to the rule in its standard direction and the second rate applies when the rule is applied in reverse.

This is how to define bidirectional rule:

#! rules
side1 <=> side2 @ rate1 | rate2

and it is equivalent to these rules:

#! rules
side1 => side2 @ rate1
side2 => side1 @ rate2

Tests for bidirectional rules were added in commits a954518 and f648027.
Changes for parsing bidirectional rules were made in commits 2649431 and ee00206.

Close #30

@xtrojak xtrojak linked an issue Feb 27, 2024 that may be closed by this pull request
@xtrojak
Copy link
Collaborator

xtrojak commented Feb 28, 2024

I'm not convinced about the variant with a single rate. For me, when there is only a single rate, intuitively, it means that the reverse rule has an undefined rate. But that's just my intuition. Let's try to get more opinions - maybe @xsafran1 can comment on this?

EDIT: Perhaps the safest way to avoid any confusion is NOT to allow a single rate in this case. Can that be implemented?

@bmazinng
Copy link
Collaborator

bmazinng commented Feb 29, 2024

I am totally out of context on this, so take it with grain of salt. I understand the intuition like this:

#! rules
side1 <=> side2 @ rate1

would correspond to undefined rate on reversed rule

#! rules
side1 => side2 @ rate1
side2 => side1

How to say that the reverse rule is not even in the model ? Is it possible to have rate of change 0 ?
In that case, if I wanted to bidirectionally write this:

#! rules
side1 => side2 @ rate1

Maybe I would think that this is the equivalence:

`#! rules
side1 <=> side2 @ rate1 | 0

@mopichalova
Copy link
Collaborator Author

I'm not convinced about the variant with a single rate. For me, when there is only a single rate, intuitively, it means that the reverse rule has an undefined rate. But that's just my intuition. Let's try to get more opinions - maybe @xsafran1 can comment on this?

EDIT: Perhaps the safest way to avoid any confusion is NOT to allow a single rate in this case. Can that be implemented?

Right, currently it is based on the previous solutions where only one rate was allowed. It is possible to not allow a single rate, but in my opinion single rate means reverse rule has undefined rate makes more sense.
But both options are available, whatever you prefer.

@mopichalova
Copy link
Collaborator Author

I am totally out of context on this, so take it with grain of salt. I understand the intuition like this:

#! rules side1 <=> side2 @ rate1

would correspond to undefined rate on reversed rule

#! rules side1 => side2 @ rate1 side2 => side1

How to say that the reverse rule is not even in the model ? Is it possible to have rate of change 0 ? In that case, if I wanted to bidirectionally write this:

#! rules side1 => side2 @ rate1

Maybe I would think that this is the equivalence:

`#! rules side1 <=> side2 @ rate1 | 0

I have not really thought about that. It is possible to make the rate 0, but I think if the goal is to exclude the reverse rule from the model, just define the rule unidirectionally rather than bidirectionally. This approach directly conveys the absence of a reverse reaction, therefore there's no necessity to employ a rate of 0, which could complicate interpretations.

@xtrojak
Copy link
Collaborator

xtrojak commented Mar 2, 2024

Since there are multiple ways to interpret a single rate for bidirectional rules, I would not allow it at all to avoid confusion.

@mopichalova
Copy link
Collaborator Author

Since there are multiple ways to interpret a single rate for bidirectional rules, I would not allow it at all to avoid confusion.

Bidirectional rules can be now defined only with no rate or two rates.

eBCSgen/Parsing/ParseBCSL.py Outdated Show resolved Hide resolved
@xtrojak xtrojak merged commit 8f6600a into sybila:improve-parsing Mar 11, 2024
1 of 2 checks passed
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.

Allow bidirectional rules
3 participants