Skip to content

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

Open
smondal13 wants to merge 136 commits intoPyomo:mainfrom
smondal13:add-multiexperiment
Open

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

Conversation

@smondal13
Copy link
Copy Markdown
Contributor

@smondal13 smondal13 commented Mar 2, 2026

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

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
- Updated the `DesignOfExperiments` class to accept either a single experiment or a list of experiments through the `experiment` parameter, replacing the previous `experiment_list` parameter.
- Modified related test cases to reflect this change, ensuring that both single and multiple experiments are handled correctly.
- Adjusted error messages and validation checks to align with the new parameter naming.
- Ensured backward compatibility by updating all references in the test suite and error handling.
- enhance documentation for init_solver usage in multi-experiment optimization
- extend optimize_experiments() to build and initialize grey-box objectives from aggregated scenario FIMs so the multi-experiment API can use the same external-metric path as run_doe().
- relax FIMExternalGreyBox initialization to accept explicit parameter ordering and dense FIM seeds so scenario-level total FIM blocks can reuse the grey-box implementation cleanly.
- add DOE build, validation, and greybox solve tests to cover multi-experiment solver routing, unsupported objective checks, and expected Rooney-Biegler results.
- Cleaned up the DesignOfExperiments class by simplifying reference and current finite difference blocks access.
- Updated greybox initialization to streamline the process and ensure proper parameter handling.
- Removed outdated tests related to pseudo_trace and other unsupported objectives, ensuring that the greybox path validation is robust.
- Added new tests to validate greybox outputs against NumPy computations for all supported objectives.
- Enhanced test coverage for multi-experiment scenarios, ensuring that the greybox solver is correctly utilized and that initialization behaves as expected.
- Improved assertions in tests to ensure accuracy and clarity in expected outcomes.
@@ -0,0 +1,206 @@
#### NO NEED TO CHECK THIS SCRIPT. THIS IS FOR ME TO UNDERSTAND THE RESULT AND WILL BE DELETED LATER.
Copy link
Copy Markdown
Contributor Author

@smondal13 smondal13 Mar 30, 2026

Choose a reason for hiding this comment

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

NO NEED TO REVIEW THIS SCRIPT

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