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

Fix bug related to maximum/minimum saturation values and uniqueness test for rules #213

Merged
merged 4 commits into from
Jun 3, 2024

Conversation

heberlr
Copy link

@heberlr heberlr commented Feb 21, 2024

In the previous implementation, the last rule determined the maximum or minimum response of the behavior. In the current update, the behavior now checks for the maximum and minimum response in all rules. In cases where the minimum or maximum values do not exist, the system defaults to using the base value.

Bug fixed: Previously in a scenario with multiple rules in the same response (increase or decrease) the last rule defined the max/min response value of behavior. Right now, it checks the min/max response value for all rules of the same behavior.
In the previous implementation, the last rule determined the maximum or minimum response of the behavior. In the current update, the behavior now checks for the maximum and minimum response in all rules. In cases where the minimum or maximum values do not exist, the system defaults to using the base value.
@drbergman
Copy link
Contributor

I think this is something we want to address. It never feels right to assign a parameter value that is used only when the stars align. So, this seems like a good step in that direction. It looks like changes were not made for v0? I can't say I'm well-versed in that version, so not sure if that's an issue. It looks like v0 will use the last signal to set the min/max behaviors as well as the base_value?

On a similar note, I think a more longterm solution is to move to an XML-based rules specification. I have a branch with this implemented: https://github.com/drbergman/PhysiCell/tree/feature-xml-rules Happy to make a PR on this to MathCancer:development if others agree.

Adjust to the V0
@heberlr
Copy link
Author

heberlr commented Feb 21, 2024

Thanks for pointing that out. I've incorporated tests into the v0 rules as well. During testing, I experimented with the rules listed below within the template project, making order changes, and selectively including or removing rules. I also checked the behavior by printing the values of min, base, and max in the evaluate() method of the Hypothesis_rules class, using an old-school debugging style.

rules v0:
default,cycle entry,0.00333333333333333333333333,0.00333333333333333333333333,0.033,pO2,increases,21.5,4,0
default,cycle entry,0.00333333333333333333333333,0.00333333333333333333333333,0.022,estrogen,increases,0.5,3,0
default,cycle entry,0,0.00333333333333333333333333,0.00333333333333333333333333,pressure,decreases,0.25,3,0

rules v1:
default,pO2,increases,cycle entry,0.00333333333333333333333333,0.033,21.5,4,0
default,estrogen,increases,cycle entry,0.00333333333333333333333333,0.022,0.5,3,0
default,pressure,decreases,cycle entry,0.00333333333333333333333333,0,0.25,3,0

rules v2:
default,pO2,increases,cycle entry,0.033,21.5,4,0
default,estrogen,increases,cycle entry,0.022,0.5,3,0
default,pressure,decreases,cycle entry,0,0.25,3,0

print code:

std::cout << "Min: " << min_value << "  Base: " << base_value << "  Max: " << max_value << std::endl;
	for( int j=0; j < signal_values.size(); j++ ){
		std::cout << "\tSignal: " << signal_values[j] << "  Response: " << responses[j] << std::endl;

P.S.: I believe that having the option to include rules in the XML could be very interesting.

As discussed, the rule is defined as unique if the cell, behavior, signal, and response are equal. Previously, the test only included the signal; in this pull request, we have added the response test.
@heberlr
Copy link
Author

heberlr commented Apr 26, 2024

As discussed, the rule is defined as unique if the cell, behavior, signal, and response are equal. Previously, the test only included the signal; in this pull request, we have added the response test. I test it with these rules:

default,substrate,increases,cycle entry,0.003333,0.2,10,0
default,substrate,decreases,cycle entry,0,0.5,10,0

This figure show that the rules is working (xml attached).
snapshot

@heberlr heberlr changed the title Update PhysiCell_rules.cpp Fix bug related to maximum/minimum saturation values and uniqueness test for rules Apr 26, 2024
@drbergman
Copy link
Contributor

Can you confirm that these cells are using the Live Cell model?

@heberlr
Copy link
Author

heberlr commented Apr 26, 2024

Yes, they are using live cell model. I will send you the xml and IC by slack.

std::endl;

return;
exit(-1);
Copy link
Contributor

Choose a reason for hiding this comment

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

I like that we're now throwing an error on this. Don't want to quietly disregard faulty user input

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.

None yet

3 participants