-
Notifications
You must be signed in to change notification settings - Fork 68
Poorly formulated constraint in MCAS model #1547
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
Comments
@andrewlee94 I've started to look into this. What "issues with scaling methods" does addressing the potential division by zero bring up? I've made this change locally, but I can't seem to find any issues. |
@MarcusHolly The If we look only at the new Scaling tools this issue goes away, but there is the need to keep backward compatibility and thus the old-style methods would need to be updated. |
And by breaking, do you mean that it's silently breaking? From what I can tell, all the tests and flowsheets appear to be running fine after reformulating the Also, I'm not sure how well this utility function was really working in the first place. When I use |
Oh, no, it was very vocal for me. However, I might have done the following for the reformulation:
Try doing this - if this does trigger a lot of warnings then it means there are two issues that need to be addressed. The first being that the function requires the form |
The above formulation does not break any flowsheets or tests for me locally either. Perhaps I should create a fresh environment to see if I see the warnings then. |
Description
The MCAS property model has the following constraint formulation (line 1464):
This leads to a potential division by zero as flow goes to zero and thus would be better reformulated as:
However, doing this results in issues with the scaling methods, primarily due to the
transform_property_constraints
function which assumes that all constraints are written in the form ofproperty = function()
. I suspect that this might have further reaching effects than just this.Motivation
Generally, constraints should be formulated in ways to avoid potential singularities, such as avoiding divisions where possible (unless the denominator is a simple constant). Doing so helps avoid numerical issues during solving and will generally make models more robust (and often better scaled).
Possible Implementation
This issue effectively has two parts:
transform_property_constraints
function). However, given the current push to using the newScaler
classes this hopefully becomes much easier (or at least can be done at the same time).Additional Context
No response
The text was updated successfully, but these errors were encountered: