Skip to content

Add core symbolic gradient support to Pyomo.DoE#3928

Open
snarasi2 wants to merge 38 commits intoPyomo:mainfrom
snarasi2:clean_symbolic
Open

Add core symbolic gradient support to Pyomo.DoE#3928
snarasi2 wants to merge 38 commits intoPyomo:mainfrom
snarasi2:clean_symbolic

Conversation

@snarasi2
Copy link
Copy Markdown

@snarasi2 snarasi2 commented May 4, 2026

Fixes # .

This PR ports the core symbolic-gradient functionality from the historical pyomo-doe-symbolic work into the current pyomo.contrib.doe implementation.

Summary/Motivation:

Rather than merging the old branch directly, this change transplants the symbolic DoE pieces onto current main so that symbolic sensitivities work with the newer DoE implementation already present in Pyomo, including the current objective and GreyBox-oriented code paths.

This PR ports the core symbolic-gradient functionality from adowling2#7 onto current Pyomo main and adapts it to the current pyomo.contrib.doe implementation.

This contribution was prepared with coding assistance from OpenAI Codex. All design decisions, validation, testing, and quality-assurance responsibility remain with Shilpa Narasimhan.

Changes proposed in this PR:

  • Add GradientMethod support to DesignOfExperiments
  • Preserve the existing finite-difference workflow through the new gradient-method interface
  • Add a symbolic / PyNumero gradient path for DoE
  • Add an analytic FIM computation path for non-optimization FIM evaluation
  • Export ExperimentGradients from pyomo.contrib.doe
  • Refactor ExperimentGradients so symbolic and automatic differentiation are set up together
  • Add supporting symbolic-gradient utilities for labeled experiment models
  • Update DoE model construction so symbolic sensitivities can be used in the Jacobian-based DoE machinery
  • Add a guard preventing run_doe() from being called with GradientMethod.kaug
  • Add the polynomial example and polynomial-focused regression coverage
  • Add broader symbolic-versus-automatic gradient consistency tests
  • Add factorial-result dataframe tests
  • Add reactor regression tests against expected solutions
  • Clarify GreyBox cyipopt / MA57-HSL test behavior where relevant

Validation performed locally:

  • Black: python -m black -S -C --check --diff pyomo/contrib/doe → passed
  • Typos: typos --config .github/workflows/typos.toml pyomo/contrib/doe DOE_SYMBOLIC_PR_NOTES.md → passed
  • Focused DoE/GreyBox validation: 134 passed, 0 failed, 0 skipped
  • GreyBox cyipopt tests were run with MA57/HSL available in the local environment
  • The existing K_AUG-dependent DoE test path was validated locally after configuring the required runtime library path

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.

Shilpa Narasimhan added 30 commits April 1, 2026 14:20
Add schema, filtering, and error-path tests for factorial-result tables and DataFrame input handling.

Validation:
- 101 passed, 5 warnings, 10 subtests passed in 30.00s

Notes:
- plotting tests emit expected matplotlib warnings under the non-interactive Agg backend because draw_factorial_figure() calls plt.show().
Add a determinant-based reactor regression test, guard Codecov uploads when coverage.xml is absent, and align local formatting with Black expectations.

Validation:
- focused reactor regression subset: 2 passed, 28 deselected in 10.08s
- full DoE suite: 102 passed, 5 warnings, 10 subtests passed in 30.29s

Notes:
- plotting-related tests continue to emit expected matplotlib warnings under the non-interactive Agg backend because draw_factorial_figure() calls plt.show().
Add coverage for draw_factorial_figure guard branches covering more-than-two sensitivity variables and missing fixed design variables.

Validation:
- focused plotting-guard subset: 2 passed, 37 deselected in 1.92s
- full DoE suite: 104 passed, 5 warnings, 10 subtests passed in 31.47s

Notes:
- plotting-related tests continue to emit expected matplotlib warnings under the non-interactive Agg backend because draw_factorial_figure() calls plt.show().
@snarasi2
Copy link
Copy Markdown
Author

snarasi2 commented May 4, 2026

@adowling2 @slilonfe5 @smondal13 @sscini This is the new symbolic PR (created from the unpolluted branch)

@snarasi2
Copy link
Copy Markdown
Author

snarasi2 commented May 4, 2026

@blnicho — this PR (#3928) is the clean replacement for #3898. The original PR included unintended extra changes; this one contains only the intended symbolic DoE work and has been fully validated.

Could you please switch review/merge to this PR and we can close #3898?

@mrmundt
Copy link
Copy Markdown
Contributor

mrmundt commented May 4, 2026

@blnicho — this PR (#3928) is the clean replacement for #3898. The original PR included unintended extra changes; this one contains only the intended symbolic DoE work and has been fully validated.

Could you please switch review/merge to this PR and we can close #3898?

@snarasi2 - Done. #3898 is closed in favor of this one.

@sscini sscini moved this from Todo to Ready for design review in ParmEst & Pyomo.DoE Development May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Ready for design review

Development

Successfully merging this pull request may close these issues.

4 participants