Skip to content

Resolve writer performance degradation #3343

Merged
jsiirola merged 5 commits intoPyomo:mainfrom
jsiirola:writer-constraint-perf
Aug 13, 2024
Merged

Resolve writer performance degradation #3343
jsiirola merged 5 commits intoPyomo:mainfrom
jsiirola:writer-constraint-perf

Conversation

@jsiirola
Copy link
Copy Markdown
Member

Fixes # .

Summary/Motivation:

#3293 introduced a performance degradation into the main writers: because we no longer store the preprocessed lb / body / ub on constraints, separate calls to lower, body, and upper (and has_lb / has_ub) performed repeated constraint expression standardization.

This PR recovers most of the degradation by making use of a single call to ConstraintData.to_bounded_expression()

image

Changes proposed in this PR:

  • add an evaluate_bounds option to to_bounded_expression()
  • update writers (LP, NL, BAR, and GMS) to make use of to_bounded_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:

  1. I agree my contributions are submitted under the BSD license.
  2. 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.

Comment on lines +259 to +261
r_o_eqns = {}
c_eqns = {}
l_eqns = {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I know this isn't an artifact of this PR, but what do r_o, c, and l stand for?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

See

if not _skip_trivial(constraint_data):
if constraint_type.lower() == 'relaxationonly':
r_o_eqns[constraint_data] = info
elif constraint_type.lower() == 'convex':
c_eqns[constraint_data] = info
elif constraint_type.lower() == 'local':
l_eqns[constraint_data] = info
else:

  • r_o: relaxationonly
  • c: convex
  • l: local

@jsiirola jsiirola merged commit a777d7a into Pyomo:main Aug 13, 2024
@jsiirola jsiirola deleted the writer-constraint-perf branch August 13, 2024 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

2 participants