Skip to content

Implementing multistart version of theta_est using multiple sampling methods - #3575

Open
sscini wants to merge 68 commits into
Pyomo:mainfrom
sscini:multistart-in-parmest
Open

sscini wants to merge 68 commits into
Pyomo:mainfrom
sscini:multistart-in-parmest

Conversation

@sscini

@sscini sscini commented Apr 23, 2025 •

Copy link
Copy Markdown
Member

Fixes # .

Summary/Motivation:

Currently, the optimization is only done from a single initial value. This implementation adds the ability to specify multiple initial values using selected sampling techniques: from a random uniform distribution, using Latin Hypercube Sampling, or using Sobol Quasi-Monte Carlo sampling.

Changes proposed in this PR:

  • All changes made adding pseudocode in comments
  • Added inputs needed for multistart simulation
  • Added a function to generate points using the selected method
  • Added theta_est_multistart to work for the multistart process

TODO before converting from draft:

  • Receive feedback from collaborators on logical setup
  • Convert finalized pseudocode
  • Test and debug
  • Confirm function with examples

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.

@sscini

sscini commented Apr 23, 2025

Copy link
Copy Markdown
Member Author

@djlaky @adowling2 Please provide early feedback.

@sscini

sscini commented Apr 30, 2025

Copy link
Copy Markdown
Member Author

Dynamic saving using flush, add.

@adowling2 adowling2 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Notes from our in-person discussion/informal code review

Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
@sscini

sscini commented Apr 30, 2025

Copy link
Copy Markdown
Member Author

Extend existing tests for parmest to include multistart, add.

@sscini

sscini commented Apr 30, 2025

Copy link
Copy Markdown
Member Author

Models provided need to include bounds, add exception

@adowling2 adowling2 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here are some more comments for you to consider are you continue to refine this.

Comment thread pyomo/contrib/parmest/parmest.py Outdated
upper_bound = np.array([parmest_model.find_component(name).ub for name in theta_names])
# Check if the lower and upper bounds are defined
if np.any(np.isnan(lower_bound)) or np.any(np.isnan(upper_bound)):
raise ValueError(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You probably already know this, but you will need to check all the errors are raised when expected.

Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
Comment thread pyomo/contrib/parmest/parmest.py Outdated
@blnicho blnicho changed the title [Depends on #3789] Implementing multistart version of theta_est using multiple sampling methods Implementing multistart version of theta_est using multiple sampling methods May 15, 2026
@sscini

sscini commented May 19, 2026

Copy link
Copy Markdown
Member Author

Now that _Q_opt has been finalized and merged, going to revisit this, make adjustments as needed from final _Q_opt and regularization revisions, and then will make a regular PR.

@blnicho
blnicho marked this pull request as ready for review August 25, 2026 18:33
@sscini sscini moved this from Development to Ready for design review in ParmEst & Pyomo.DoE Development Sep 17, 2026
@sscini

sscini commented Sep 22, 2026

Copy link
Copy Markdown
Member Author

@mrmundt Hi Miranda! I had a quick testing question if you can help clarify something. It looks like if a test has been marked expensive, it does not count as covered (according to coverage reports from individual checks). If this is as intended, is the goal to change those tests long-term? Curious your thoughts. Thanks!

@mrmundt

mrmundt commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

@mrmundt Hi Miranda! I had a quick testing question if you can help clarify something. It looks like if a test has been marked expensive, it does not count as covered (according to coverage reports from individual checks). If this is as intended, is the goal to change those tests long-term? Curious your thoughts. Thanks!

HELLO! Okay so, yes, expensive tests aren't run in the standard suite. We have a specific nightly job that exercises them on Jenkins (which does then upload a coverage report), but it only runs on main. The purpose behind that is, because they are expensive and we already have such a large test suite, we don't turn those on for individual PR testing in order to speed up the suite.

@jsiirola

Copy link
Copy Markdown
Member

(@mrmundt: actually, the Jenkins PR tests do run the expensive tests ... we need to have the main and PR tests run the same things in order to get meaningful coverage information)

@mrmundt

mrmundt commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

(@mrmundt: actually, the Jenkins PR tests do run the expensive tests ... we need to have the main and PR tests run the same things in order to get meaningful coverage information)

Oh is that new? Because that wasn't the case before. ALRIGHT. Then it seems like it's a bug that the coverage reports aren't showing coverage on the expensive suite, too.

EDIT: AHA! Right, they only run on Jenkins, and yours doesn't have the Jenkins job yet :P

@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.71823% with 53 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.11%. Comparing base (e099f64) to head (4589624).

Files with missing lines Patch % Lines
pyomo/contrib/parmest/parmest.py 82.83% 23 Missing ⚠️
...mest/examples/reactor_design/multistart_example.py 31.81% 15 Missing ⚠️
...mest/examples/rooney_biegler/multistart_example.py 28.57% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3575      +/-   ##
==========================================
- Coverage   90.14%   90.11%   -0.04%     
==========================================
  Files         917      919       +2     
  Lines      109261   109430     +169     
==========================================
+ Hits        98494    98609     +115     
- Misses      10767    10821      +54     
Flag Coverage Δ
builders 29.08% <2.76%> (-0.04%) ⬇️
default 86.10% <60.22%> (?)
expensive 35.57% <6.07%> (?)
linux 87.65% <70.71%> (-2.01%) ⬇️
linux_other 87.65% <70.71%> (-0.03%) ⬇️
oldsolvers 28.01% <1.65%> (-0.05%) ⬇️
osx 83.08% <60.22%> (-0.04%) ⬇️
win 85.39% <60.22%> (-0.05%) ⬇️

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sscini

sscini commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

@adowling2 @slilonfe5 @smondal13 I think this is ready to go. Another pair of eyes on the finalized would be great. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Ready for design review

Development

Successfully merging this pull request may close these issues.

8 participants