Repository navigation
Conversation
…IPOPT Add rationale for deterministic solve-order and failure-injection tests, expand real-solver coverage across formulas and scaling modes, and document the Hessian interface. Developed with Codex assistance.
…rios Apply the chain rule to k_aug outputs, reject missing unfixed sensitivities, and retain direct parameter derivatives. Derive default Jacobian/FIM values from solved scenarios while preserving explicit initial arrays and live scenario references. Add analytical, IPOPT, and availability-gated k_aug regressions plus documentation. Developed with Codex assistance.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes # .
Summary/Motivation:
This PR collects a set of correctness fixes for Pyomo.DoE found while auditing
the finite-difference (sequential), k_aug, and grey-box code paths, together
with regression tests and documentation.
Changes proposed in this PR:
compute_FIM(method="sequential")withfd_formula="forward"or"backward"never solved or recorded the nominal point. It used the firstperturbed scenario as the reference instead, so the first column of the
sensitivity matrix was identically zero and the remaining columns were
wrong. For a linear test model with true sensitivities
[2, 1]and[1, -2],mainreturns[0, 2.5]and[0, -1.25]. Sensitivities and FIMvalues computed with these formulas are therefore wrong. The nominal response
is now solved first and used as the reference column. Central differences
(the default) were not affected by this bug.
the warm start for central differences. Outputs are read before the perturbed
parameter is reset, so Expression outputs that reference unknown parameters
directly are correct. Solve failures now name the failing scenario.
needed, with one clear warning per parameter (naming it, its perturbed range,
and the old and new bounds) instead of a
W1002warning per scenario.Perturbations are not clipped. Sequential evaluation restores the original
bounds, including when a solve fails.
create_doe_model()builds the scenario blocks by cloning a temporarybase_modeland then deletes it.parameter_scenariosused to keep pointingat components of that deleted model. Pyomo components hold only a weak
reference to their parent, so once
base_modelis garbage-collected thoseparameters are orphaned: they lose their path (
theta[0]instead ofscenario_blocks[0].theta[0]) andparam.model()is no longer the DoE model.On
mainthe lookups that follow only work while the base model happens tostill be alive. With a forced
gc.collect()between building the scenarioblocks and assembling the constraints,
create_doe_model()onmainfailswith
AttributeError: 'NoneType' object has no attribute '_parent'(reproducedwith an indexed parameter). Whether a normal run hits this depends on when
the garbage collector runs.
parameter_scenariosnow points at the matchingcomponents on
scenario_blocks[0], which stay alive with the model.sensitivities, include direct dependence on fixed unknown parameters, and
raise an error (instead of silently using a zero row) when an unfixed
dependency is missing from the k_aug output.
constraints, which k_aug may reject. The model is not modified.
jac_initial/fim_initialvalues from the already-solved finite-difference scenarios.Explicitly supplied arrays are preserved independently.
FIMExternalGreyBoxHessian now includes theoutput-constraint multiplier, as the
ExternalGreyBoxModelinterfacerequires.
set_output_constraint_multipliersvalidates the length, and themultiplier defaults to 1 for direct use.
get_measurement_error_values()returned the valuesof the output variables (the suffix keys) instead of sigma (the suffix
values). The
"Measurement Error"field inrun_doeresults is built fromit and was therefore wrong too. The FIM calculation reads the suffix directly
and was not affected.
run_doe(results_file=...): the old exacttype()check rejected realpathlib.Pathobjects (their type isPosixPath/WindowsPath). It nowaccepts any
pathlib.Pathorstr.test_doe_regressions.py,test_kaug_outputs.py,test_greybox.py, andtest_doe_build.py.AI-Use Disclosure
AI tools contributed to the development of this PR
Review process (select ONE):
Notes for reviewers (including @adowling2):
_sequential_FIM). The old code skipped the nominal solve ats == 0and never recorded a nominal response. It then used the first perturbed scenario as the reference column. So the first Jacobian column was exactly zero and the others were biased. The new code solves and records the nominal point and uses it as column 0. Central differences are unchanged apart from warm-starting. Please look at thecol_1/col_2logic closely.evaluate_hessian_outputs()now returnsmultiplier × Hinstead of the rawH. This is whatExternalGreyBoxModelexpects, but it changes results for anyone calling it directly with a non-unit multiplier. The multiplier defaults to 1 for direct use, andset_output_constraint_multipliersnow checks the length._extract_kaug_output_jacobian. A missing unfixed dependency now raises an error instead of silently giving a zero row, which could surface new errors for existing models.doe.pyand the DoE tests, so expect conflicts depending on merge order. Pyomo. DoE: Sensitivity initialization #3639 (sensitivity initialization) is closest to the "initialize FIM from solved scenarios" change.