Skip to content

[Pyomo.DoE] Add simultaneous design of multiple experiments - #3866

Open
smondal13 wants to merge 218 commits into
Pyomo:mainfrom
smondal13:add-multiexperiment
Open

[Pyomo.DoE] Add simultaneous design of multiple experiments#3866
smondal13 wants to merge 218 commits into
Pyomo:mainfrom
smondal13:add-multiexperiment

Conversation

@smondal13

@smondal13 smondal13 commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Fixes # .

Summary/Motivation:

This PR adds a new DesignOfExperiments.optimize_experiments() API in pyomo/contrib/doe/doe.py to support simultaneous optimization of multiple experiments in one workflow. The motivation is to provide a multi-experiment DoE interface with stronger initialization options, clearer mode handling (template vs. user-initialized experiments), and richer diagnostics/results than the existing single-experiment path.

Changes proposed in this PR:

  • Added API optimize_experiments() for multi-experiment DoE optimization.
  • Added Cholesky-based D- and A-optimality objective and Greybox-based D-, A-, E-, and ME- optimality objective
  • Implemented two operating modes:
    • Template mode: pass one experiment and set n_exp.
    • User-initialized mode: pass a list of experiments; n_exp is inferred/validated.
  • Added optional LHS-based initialization (initialization_method="lhs") with controls for:
    • sample count, seed, candidate evaluation parallelism, combination fim metric scoring parallelism,
    • worker count, chunk size, parallel threshold, and optional wall-clock budget.
  • Added symmetry-breaking constraints for multi-experiment solves:
    • supports user-specified variable through sym_break_cons suffix,
    • falls back to the first experiment input with a diagnostic warning when not provided.
  • Expanded output for this API:
    • per-scenario and per-experiment results (designs, outputs, measurement errors, FIM/sensitivities),
    • aggregated FIM metrics, timings, settings, names, diagnostics, and structured run_info.
  • Added JSON-safe serialization via _DoEResultsJSONEncoder for numpy/Pyomo-enum values when writing results_file.

Note:

  • Added new documentation.md which describes the API. This documentation is to help the reviewers to understand the API and will not be merged into Pyomo:main

Remove before merging

  • documentation.md
  • rb_multi.py

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.

…d replace `self.experiment` with `self.experiment_list[0]`. `doe/reactor_example.py` runs successfully.
…sing the `doe/reactor_multi_experiment.py`
…nt for `optimize_experiments()` and `compute_FIM()`
… both of sensitivity and optimize_experiments()
…A-opt gave different result for grid and optimization

@blnicho blnicho 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.

@smondal13 here is my next set of comments. I have 2 more files to look at.

Comment thread pyomo/contrib/doe/tests/test_doe_build.py Outdated
Comment thread pyomo/contrib/doe/tests/test_doe_build.py
Comment thread pyomo/contrib/doe/tests/test_doe_errors.py Outdated
Comment thread pyomo/contrib/doe/tests/test_doe_solve.py Outdated
Comment thread pyomo/contrib/doe/tests/test_doe_solve.py Outdated
Comment thread pyomo/contrib/doe/tests/test_doe_solve.py Outdated
Comment thread pyomo/contrib/doe/tests/test_doe_solve.py Outdated
Comment thread pyomo/contrib/doe/tests/test_doe_solve.py Outdated
Comment thread pyomo/contrib/doe/tests/test_doe_solve.py Outdated
Comment thread pyomo/contrib/doe/tests/test_doe_solve.py Outdated
smondal13 and others added 14 commits June 4, 2026 12:50
Co-authored-by: Bethany Nicholson <blnicho@users.noreply.github.com>
Co-authored-by: Bethany Nicholson <blnicho@users.noreply.github.com>
- Update the square-solve stub helper to use direct solver attribute access so the merged test helper matches the latest upstream cleanup.
- Preserve the local DOE error-test change that calls make_ipopt_solver() directly, which keeps the solver setup explicit and avoids the extra wrapper.
Add tests for `pseudo-A` initiation in grey_box
Comment thread pyomo/contrib/doe/doe.py

egb_block.outputs[self._grey_box_output_name()].set_value(float(output_value))

def _initialize_standard_objective_block(self, block, fim_np, parameter_names):

@smondal13 smondal13 Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@blnicho I have removed _initialize_cholesky_from_fim() and consolidated the shared FIM-derived initialization updates into _initialize_standard_objective_block(). Both the single- and multi-experiment designs were doing the same initialization work (L, L_inv, fim_inv, cov_trace, determinant/pseudo-trace state), so consolidating that logic avoids duplication and reduces the risk of the two paths drifting out of sync.

@smondal13

Copy link
Copy Markdown
Contributor Author

@blnicho @mrmundt can you run this again? It is showing the gjh failure

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

Projects

Status: Ready for final review

Development

Successfully merging this pull request may close these issues.

7 participants