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

Pyomo.DoE version 2 #2794

Merged
merged 89 commits into from
May 23, 2023
Merged

Pyomo.DoE version 2 #2794

merged 89 commits into from
May 23, 2023

Conversation

jialuw96
Copy link
Contributor

@jialuw96 jialuw96 commented Apr 3, 2023

Fixes

Reference #2610

Main fixes include:

  • Remove scenario index with block
  • Remove the flatenning functions, use a naming class for objects with more than 2 indexes
  • Deprecate sipopt
  • Use TicTocTimer
  • Replace string options with Enum
  • Documentation and tutorial enhancements
  • Add more tests

Summary/Motivation:

Update version 2 for doe. This version accomplishes enhancements in issue2610.

Tasks to complete before merging:

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.

@jialuw96
Copy link
Contributor Author

@blnicho Thank you for the reviews! I addressed them and saved a few of unsolved ones in #2610. The tests are passing now. Thank you!

@codecov
Copy link

codecov bot commented May 19, 2023

Codecov Report

Patch coverage: 88.97% and project coverage change: +0.14 🎉

Comparison is base (2b51e1c) 87.17% compared to head (5c0405a) 87.32%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2794      +/-   ##
==========================================
+ Coverage   87.17%   87.32%   +0.14%     
==========================================
  Files         764      767       +3     
  Lines       88270    90240    +1970     
==========================================
+ Hits        76949    78801    +1852     
- Misses      11321    11439     +118     
Flag Coverage Δ
linux 84.38% <88.97%> (+0.15%) ⬆️
osx 74.28% <40.42%> (+0.42%) ⬆️
other 84.56% <88.97%> (+0.15%) ⬆️
win 81.93% <88.97%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pyomo/contrib/doe/scenario.py 73.91% <70.00%> (-16.29%) ⬇️
pyomo/contrib/doe/result.py 31.72% <77.14%> (-2.75%) ⬇️
pyomo/contrib/doe/doe.py 83.13% <86.60%> (+15.84%) ⬆️
pyomo/contrib/doe/measurements.py 93.82% <93.82%> (+11.84%) ⬆️
pyomo/contrib/doe/examples/reactor_compute_FIM.py 95.00% <95.00%> (ø)
pyomo/contrib/doe/examples/reactor_optimize_doe.py 95.23% <95.23%> (ø)
pyomo/contrib/doe/examples/reactor_grid_search.py 95.83% <95.83%> (ø)
pyomo/contrib/doe/examples/reactor_kinetics.py 98.80% <98.80%> (ø)
pyomo/contrib/doe/__init__.py 100.00% <100.00%> (ø)

... and 23 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

design_set_iter
)[i]
for i, names in enumerate(design_dimension_names):
# names = design_dimension_names[i]
Copy link
Contributor

Choose a reason for hiding this comment

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

Leftover comment?

Copy link
Member

Choose a reason for hiding this comment

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

I removed this.


Return:

Return
-------
m: the DOE model
Copy link
Contributor

Choose a reason for hiding this comment

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

Outdated: should be mod

But on that note, this is a nitpick: Is there an issue with just calling it model? Explicit variable names are a general preference.

Copy link
Member

Choose a reason for hiding this comment

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

I changed these to model.

j: model responses
p: model parameters
t: timepoints
p: parameter
Copy link
Contributor

Choose a reason for hiding this comment

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

m is missing from docstring.

"""
Calculate FIM elements
p: parameter
Copy link
Contributor

Choose a reason for hiding this comment

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

m missing from docstring.

Copy link
Contributor

Choose a reason for hiding this comment

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

Comment for all examples in general:

It would be nice to either have a README to explain the different examples or a small comment blurb in each example to explain what each example is showing (or, if the example is from a paper/book, a referencing to that paper/book).

for index_instance in all_variable_indices:
var_name_index_string = var_name + "["
for i, idx in enumerate(index_instance):
var_name_index_string += str(idx)
Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is a lot going on in this file that is not tested. Highly recommend adding tests.

Copy link
Member

@adowling2 adowling2 left a comment

Choose a reason for hiding this comment

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

Added a comment

for index_instance in all_variable_indices:
var_name_index_string = var_name + "["
for i, idx in enumerate(index_instance):
var_name_index_string += str(idx)
Copy link
Member

Choose a reason for hiding this comment

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

This is on the todo list here: #2610

@adowling2
Copy link
Member

@jialuw96 I need you to merge this PR on your fork (jialuw96#16). I made the requested changes from @mrmundt but I do not have permission to write to your fork. Alternately, you can give me permission to write to your fork.

@mrmundt @blnicho I made the changes and opened a PR into @jialuw96's branch. The catch is that I did this on a computer that does not have a Pyomo development environment setup. I made the changes in the GitHub web browser. I checked them twice and I am relying on the tests to pass as an extra check. (These changes were to doc strings and renaming mod to model in one function which I triple-checked.)

@mrmundt The 👍 on your comments means I either addressed them in more fork or added them to our running todo list.

@blnicho
Copy link
Member

blnicho commented May 23, 2023

@adowling2 I have push access and took care of merging your changes.

@blnicho blnicho requested a review from mrmundt May 23, 2023 02:17
@adowling2
Copy link
Member

@blnicho. Awesome. I also got the tests passing on my fork, so fingers crossed, they should be here too.

@jialuw96
Copy link
Contributor Author

@adowling2 Thank you for taking care of this! I just sent an invitation for you to collaborate on this fork.

@blnicho blnicho dismissed mrmundt’s stale review May 23, 2023 03:52

The requested changes have been made

@blnicho blnicho merged commit e147a37 into Pyomo:main May 23, 2023
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.

6 participants