-
Notifications
You must be signed in to change notification settings - Fork 526
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 refactor #3317
Pyomo doe refactor #3317
Conversation
First commit for DoE refactor. Skeleton functions added for development.
Mid-way through updating the scenario generation for the finite difference of the sensitivity matrix. Added an example file from the refactor hack-a-thon in November 2023.
Worked around Block construction. Pass-by-reference issues with with Experiment object requires some sort of cloning of the model for each block. Still working through global connecting constraints for design variables.
Finished some more edits. Will check back in tomorrow to clean and make sure the scenario generator is working properly. Need to work on whether the full model should be present or not for the central case. Could use the "global model" to be "case 0" and reassign the values to be one of the cases.
Add functionality to test if the labeled model has the expected labels for the DoE model to be created.
Added FiniteDifferenceStep initialization to the constructor. Removed and cleaned some defunct commenting/documentation.
Significant development in create_doe_model. Modernized to new methodology. Tests to follow.
Added size checks to make sure everything is consistent before being automatically generated by the create_model function.
Made the Jacobian representation consistent with the paper as well as sources on what the sensitivity matrix should be (i.e., (n_experiment_outputs x n_parameters) such that Q^T @ Q is (n_parameters x n_parameters).
Changed how the tree is traversed so the parameter location starts after the "base_model" or "scenario_blocks[0]" keyword. This way, an arbitrary block structure should be support. This will help for making multiple instances of the DoE model (i.e., multiple simultaneous estimations or stochastic-based experiment implementation).
Also updated the test build, result.json, and experiment class example to be well-posed DoE models.
Also added documentation for the inputs.
Seems to work based on comparison to old code. Will look into this more later.
Also updated the test files and results file to match and generate the same optimal point.
Matches the old interface
Objective cons block are deactivated for the square solve as they can sometimes cause convergence issues.
Will add back before pushing
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3317 +/- ##
==========================================
+ Coverage 88.56% 88.60% +0.04%
==========================================
Files 877 873 -4
Lines 99276 99133 -143
==========================================
- Hits 87920 87840 -80
+ Misses 11356 11293 -63
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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 the Jenkins tests pass, I think this is ready
outputs = [k.name for k, v in model.measurement_error.items()] | ||
except: | ||
raise RuntimeError( | ||
"Experiment model does not have suffix " + '"measurement_error".' |
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.
This is weird?
plt.pyplot.rc("ytick", labelsize=font_tick) | ||
ax = fig.add_subplot(111) | ||
params = {"mathtext.default": "regular"} | ||
# plt.rcParams.update(params) |
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.
Leftover?
plt.pyplot.rc("ytick", labelsize=font_tick) | ||
ax = fig.add_subplot(111) | ||
params = {"mathtext.default": "regular"} | ||
# plt.rcParams.update(params) |
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.
Leftover?
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.
There are a couple of lines that I think need to be removed, but they aren't essential, so approve.
Fixes
Pyomo.DoE interface was made more intuitive and some bugs were removed.
Summary/Motivation:
Pyomo.DoE was refactored to coincide with the new "experiment-based" structure of ParmEst. In this way, the packages should overlap with syntax and workflows using both tools should be easier to implement. Also, the existing interface was clunky and required a few bugfixes.
Changes proposed in this PR:
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: