This PR changes the internal data store for Constraint to only store the original (relational) expression and not break it apart into (lower, body, and upper). Those attributes are preserved as properties (and the expression rearrangement happens dynamically when they are called). Most clients who need the expression "standardized" should use the new normalize_constraint() method (which is more efficient, as it avoids duplicate work and unnecessary calls to as_numeric()).
While this would appear to be strictly cosmetic, this change is the first part of the templatized LP writer.
Changes proposed in this PR:
remove _lower, _body, and _upper ConstraintData attributes
enforce the use of .args as the only public API for getting at an expression's arguments
update persistent interfaces to look at the expr (and not body ) to detect changed expressions
update FBBT to use the same relational expression handling logic as compute_bounds_on_expression
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:
I agree my contributions are submitted under the BSD license.
I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.
Fixes # .
Summary/Motivation:
This PR changes the internal data store for Constraint to only store the original (relational) expression and not break it apart into (
lower
,body
, andupper
). Those attributes are preserved as properties (and the expression rearrangement happens dynamically when they are called). Most clients who need the expression "standardized" should use the newnormalize_constraint()
method (which is more efficient, as it avoids duplicate work and unnecessary calls toas_numeric()
).While this would appear to be strictly cosmetic, this change is the first part of the templatized LP writer.
Changes proposed in this PR:
_lower
,_body
, and_upper
ConstraintData attributes.args
as the only public API for getting at an expression's argumentsexpr
(and notbody
) to detect changed expressionscompute_bounds_on_expression
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: