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

Improve performance of pyomo.dae #1727

Merged
merged 1 commit into from
Nov 26, 2020
Merged

Conversation

blnicho
Copy link
Member

@blnicho blnicho commented Nov 26, 2020

Summary/Motivation:

This PR removes unnecessary calls to sorted in Pyomo.DAE and replaces usage of <list>.index() with <ContinuousSet>.ord(). With these two minor changes the time to apply the discretization transformation is nearly halved on some large test problems. These changes were motivated by the profiling data in #1157.

Changes proposed in this PR:

  • remove calls to sorted in Pyomo.DAE
  • use ord instead of index for locating elements in a ContinuousSet

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.

@codecov
Copy link

codecov bot commented Nov 26, 2020

Codecov Report

Merging #1727 (7782d0d) into master (b00dc2b) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1727   +/-   ##
=======================================
  Coverage   71.28%   71.29%           
=======================================
  Files         631      631           
  Lines       91056    91047    -9     
=======================================
  Hits        64909    64909           
+ Misses      26147    26138    -9     
Impacted Files Coverage Δ
pyomo/dae/contset.py 98.95% <100.00%> (ø)
pyomo/dae/misc.py 93.75% <100.00%> (ø)
pyomo/dae/plugins/colloc.py 99.14% <100.00%> (+2.20%) ⬆️
pyomo/dae/plugins/finitedifference.py 96.15% <100.00%> (ø)
pyomo/network/foqus_graph.py 90.54% <0.00%> (+0.23%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b00dc2b...7782d0d. Read the comment docs.

Copy link
Contributor

@michaelbynum michaelbynum left a comment

Choose a reason for hiding this comment

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

Nice! That was fast.

@michaelbynum michaelbynum merged commit 6d698d3 into Pyomo:master Nov 26, 2020
@blnicho blnicho deleted the dae-performance branch August 17, 2022 14:56
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.

2 participants