sybila / eBCSgen

eBCSgen - BioChemical Space Language support tool.
https://ebcsgen.readthedocs.io/
MIT License
2 stars 4 forks source link

Bidirectional rules #96

Closed mopichalova closed 5 months ago

mopichalova commented 6 months ago

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 a954518f and f648027. Changes for parsing bidirectional rules were made in commits 2649431 and ee00206.

Close #30

xtrojak commented 6 months ago

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 commented 6 months ago

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 commented 6 months ago

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 commented 6 months ago

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 commented 6 months ago

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

mopichalova commented 6 months ago

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.