-
Notifications
You must be signed in to change notification settings - Fork 517
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
Bugfix: FBBT with ExternalFunction expressions #2657
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming tests pass, this looks good to me.
if not node.is_potentially_variable(): | ||
# NPV nodes are effectively constant leaves. Evaluate it | ||
# and return the value. | ||
val = value(node) | ||
self.bnds_dict[node] = (val, val) | ||
return True, None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this :)
if self.tightener is not fbbt: | ||
raise unittest.SkipTest('Appsi FBBT does not support unkown expressions yet') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a ticket to remind ourselves to add ExternalFunctionExpression
to APPSI? I believe the issue is not actually the ExternalFunctionExpression
, but rather that they are allowed (by AMPL and Pyomo) to have str
arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fairly certain an exception would be raised somewhere else if we fixed the str
problem. Yes, we should add a ticket.
Codecov ReportBase: 87.03% // Head: 87.06% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2657 +/- ##
==========================================
+ Coverage 87.03% 87.06% +0.03%
==========================================
Files 754 754
Lines 84051 84362 +311
==========================================
+ Hits 73151 73448 +297
- Misses 10900 10914 +14
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Fixes #2650 .
Summary/Motivation:
This resolves exceptions raised by FBBT for expressions containing
ExternalFunctionExpression
nodes with string arguments. This works by treating External Functions as unbounded leaf nodes in both the root-to-leaf and leaf-to-root walkers.Changes proposed in this PR:
ExternalFunctionExpression
nodesis_potentially_variable
and treat them as constant nodes as opposed to descending into them)Legal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: